some fixes

This commit is contained in:
Nikolay Korolev 2020-05-23 01:43:12 +03:00
parent 6e51ed3c53
commit 7bf561d440
5 changed files with 35 additions and 11 deletions

View File

@ -294,7 +294,6 @@ private:
case GARAGE_HIDEOUT_TEN: return 9; case GARAGE_HIDEOUT_TEN: return 9;
case GARAGE_HIDEOUT_ELEVEN: return 10; case GARAGE_HIDEOUT_ELEVEN: return 10;
case GARAGE_HIDEOUT_TWELVE: return 11; case GARAGE_HIDEOUT_TWELVE: return 11;
default: assert(0);
} }
return -1; return -1;
} }

View File

@ -4414,7 +4414,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
} }
case COMMAND_SET_CAR_HEAVY: case COMMAND_SET_CAR_HEAVY:
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle); assert(pVehicle);
if (ScriptParams[1] != 0) { if (ScriptParams[1] != 0) {
@ -10144,7 +10144,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
UpdateCompareFlag(CModelInfo::GetModelInfo(ScriptParams[0]) != nil); UpdateCompareFlag(CModelInfo::GetModelInfo(ScriptParams[0]) != nil);
return 0; return 0;
case COMMAND_SHUT_CHAR_UP: case COMMAND_SHUT_CHAR_UP:
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 2);
debug("SHUT_CHAR_UP not implemented"); // TODO(MIAMI) debug("SHUT_CHAR_UP not implemented"); // TODO(MIAMI)
return 0; return 0;
case COMMAND_SET_ENABLE_RC_DETONATE: case COMMAND_SET_ENABLE_RC_DETONATE:
@ -10588,6 +10588,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
debug("SWITCH_SECURITY_CAMERA is not implemented\n"); // TODO(MIAMI) debug("SWITCH_SECURITY_CAMERA is not implemented\n"); // TODO(MIAMI)
return 0;
} }
//case COMMAND_IS_CHAR_IN_FLYING_VEHICLE: //case COMMAND_IS_CHAR_IN_FLYING_VEHICLE:
case COMMAND_IS_PLAYER_IN_FLYING_VEHICLE: case COMMAND_IS_PLAYER_IN_FLYING_VEHICLE:
@ -11153,7 +11154,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
//case COMMAND_IS_CAR_DROWNING_IN_WATER: //case COMMAND_IS_CAR_DROWNING_IN_WATER:
case COMMAND_IS_CHAR_DROWNING_IN_WATER: case COMMAND_IS_CHAR_DROWNING_IN_WATER:
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
UpdateCompareFlag(pPed && pPed->bIsDrowning); UpdateCompareFlag(pPed && pPed->bIsDrowning);
return 0; return 0;
@ -11253,10 +11254,11 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
} }
case COMMAND_CLEAR_CHAR_WAIT_STATE: case COMMAND_CLEAR_CHAR_WAIT_STATE:
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); assert(pPed);
pPed->ClearWaitState(); pPed->ClearWaitState();
return 0;
} }
case COMMAND_GET_RANDOM_CAR_OF_TYPE_IN_AREA_NO_SAVE: case COMMAND_GET_RANDOM_CAR_OF_TYPE_IN_AREA_NO_SAVE:
{ {

View File

@ -206,6 +206,8 @@ void CControllerConfigManager::InitDefaultControlConfiguration()
SetControllerKeyAssociatedWithAction (PED_LOOKBEHIND, rsPADEND, KEYBOARD); SetControllerKeyAssociatedWithAction (PED_LOOKBEHIND, rsPADEND, KEYBOARD);
SetControllerKeyAssociatedWithAction (PED_LOOKBEHIND, rsCAPSLK, OPTIONAL_EXTRA); SetControllerKeyAssociatedWithAction (PED_LOOKBEHIND, rsCAPSLK, OPTIONAL_EXTRA);
SetControllerKeyAssociatedWithAction (PED_DUCK, 'C', KEYBOARD);
SetControllerKeyAssociatedWithAction (PED_FIREWEAPON, rsPADINS, KEYBOARD); SetControllerKeyAssociatedWithAction (PED_FIREWEAPON, rsPADINS, KEYBOARD);
SetControllerKeyAssociatedWithAction (PED_FIREWEAPON, rsLCTRL, OPTIONAL_EXTRA); SetControllerKeyAssociatedWithAction (PED_FIREWEAPON, rsLCTRL, OPTIONAL_EXTRA);
@ -218,6 +220,8 @@ void CControllerConfigManager::InitDefaultControlConfiguration()
SetControllerKeyAssociatedWithAction (PED_JUMPING, rsRCTRL, KEYBOARD); SetControllerKeyAssociatedWithAction (PED_JUMPING, rsRCTRL, KEYBOARD);
SetControllerKeyAssociatedWithAction (PED_JUMPING, ' ', OPTIONAL_EXTRA); SetControllerKeyAssociatedWithAction (PED_JUMPING, ' ', OPTIONAL_EXTRA);
SetControllerKeyAssociatedWithAction (PED_ANSWER_PHONE, rsTAB, KEYBOARD);
if ( _dwOperatingSystemVersion == OS_WIN98 ) if ( _dwOperatingSystemVersion == OS_WIN98 )
SetControllerKeyAssociatedWithAction(PED_SPRINT, rsSHIFT, OPTIONAL_EXTRA); // BUG: must be KEYBOARD ? SetControllerKeyAssociatedWithAction(PED_SPRINT, rsSHIFT, OPTIONAL_EXTRA); // BUG: must be KEYBOARD ?
else else
@ -259,7 +263,7 @@ void CControllerConfigManager::InitDefaultControlConfiguration()
SetControllerKeyAssociatedWithAction (VEHICLE_TURRETDOWN, rsPADRIGHT, KEYBOARD); SetControllerKeyAssociatedWithAction (VEHICLE_TURRETDOWN, rsPADRIGHT, KEYBOARD);
SetControllerKeyAssociatedWithAction (CAMERA_CHANGE_VIEW_ALL_SITUATIONS, rsHOME, KEYBOARD); SetControllerKeyAssociatedWithAction (CAMERA_CHANGE_VIEW_ALL_SITUATIONS, rsHOME, KEYBOARD);
SetControllerKeyAssociatedWithAction (CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 'C', OPTIONAL_EXTRA); SetControllerKeyAssociatedWithAction (CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 'V', OPTIONAL_EXTRA);
for (int32 i = 0; i < MAX_SIMS; i++) for (int32 i = 0; i < MAX_SIMS; i++)
{ {
@ -336,13 +340,14 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK); SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
case 10: case 10:
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_DUCK, 10, JOYSTICK);
case 9: case 9:
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK); SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
case 8: case 8:
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
case 7: case 7:
SetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, 7, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, 7, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
case 6: case 6:
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
@ -384,13 +389,14 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK); SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
case 10: case 10:
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_DUCK, 10, JOYSTICK);
case 9: case 9:
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK); SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
case 8: case 8:
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
case 7: case 7:
SetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, 7, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, 7, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK); SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
case 6: case 6:
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK); SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
@ -431,6 +437,8 @@ void CControllerConfigManager::InitialiseControllerActionNameArray()
SETACTIONNAME(PED_CYCLE_TARGET_LEFT); SETACTIONNAME(PED_CYCLE_TARGET_LEFT);
SETACTIONNAME(PED_CYCLE_TARGET_RIGHT); SETACTIONNAME(PED_CYCLE_TARGET_RIGHT);
SETACTIONNAME(PED_CENTER_CAMERA_BEHIND_PLAYER); SETACTIONNAME(PED_CENTER_CAMERA_BEHIND_PLAYER);
SETACTIONNAME(PED_DUCK);
SETACTIONNAME(PED_ANSWER_PHONE);
SETACTIONNAME(VEHICLE_LOOKBEHIND); SETACTIONNAME(VEHICLE_LOOKBEHIND);
SETACTIONNAME(VEHICLE_LOOKLEFT); SETACTIONNAME(VEHICLE_LOOKLEFT);
SETACTIONNAME(VEHICLE_LOOKRIGHT); SETACTIONNAME(VEHICLE_LOOKRIGHT);
@ -754,6 +762,8 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonDown_FirstPersonOnl
state.Square = 255; state.Square = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, type)) if (button == GetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, type))
state.Cross = 255; state.Cross = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_DUCK, type))
state.RightShock = 255;
} }
void CControllerConfigManager::AffectControllerStateOn_ButtonDown_ThirdPersonOnly(int32 button, eControllerType type, CControllerState &state) void CControllerConfigManager::AffectControllerStateOn_ButtonDown_ThirdPersonOnly(int32 button, eControllerType type, CControllerState &state)
@ -762,12 +772,16 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonDown_ThirdPersonOnl
state.RightShock = 255; state.RightShock = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_JUMPING, type)) if (button == GetControllerKeyAssociatedWithAction(PED_JUMPING, type))
state.Square = 255; state.Square = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, type))
state.LeftShoulder1 = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, type)) if (button == GetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, type))
state.LeftShoulder2 = 255; state.LeftShoulder2 = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, type)) if (button == GetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, type))
state.RightShoulder2 = 255; state.RightShoulder2 = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_SPRINT, type)) if (button == GetControllerKeyAssociatedWithAction(PED_SPRINT, type))
state.Cross = 255; state.Cross = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_DUCK, type))
state.RightShock = 255;
if (FrontEndMenuManager.m_ControlMethod == CONTROL_CLASSIC) if (FrontEndMenuManager.m_ControlMethod == CONTROL_CLASSIC)
{ {
@ -1616,6 +1630,10 @@ void CControllerConfigManager::DeleteMatching3rdPersonControls(e_ControllerActio
ClearSettingsAssociatedWithAction(PED_JUMPING, type); ClearSettingsAssociatedWithAction(PED_JUMPING, type);
if (key == GetControllerKeyAssociatedWithAction(PED_SPRINT, type)) if (key == GetControllerKeyAssociatedWithAction(PED_SPRINT, type))
ClearSettingsAssociatedWithAction(PED_SPRINT, type); ClearSettingsAssociatedWithAction(PED_SPRINT, type);
if (key == GetControllerKeyAssociatedWithAction(PED_DUCK, type))
ClearSettingsAssociatedWithAction(PED_DUCK, type);
if (key == GetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, type))
ClearSettingsAssociatedWithAction(PED_ANSWER_PHONE, type);
if (FrontEndMenuManager.m_ControlMethod == CONTROL_CLASSIC) if (FrontEndMenuManager.m_ControlMethod == CONTROL_CLASSIC)
{ {
@ -1803,6 +1821,8 @@ e_ControllerActionType CControllerConfigManager::GetActionType(e_ControllerActio
case PED_CYCLE_WEAPON_RIGHT: case PED_CYCLE_WEAPON_RIGHT:
case PED_JUMPING: case PED_JUMPING:
case PED_SPRINT: case PED_SPRINT:
case PED_DUCK:
case PED_ANSWER_PHONE:
case PED_CYCLE_TARGET_LEFT: case PED_CYCLE_TARGET_LEFT:
case PED_CYCLE_TARGET_RIGHT: case PED_CYCLE_TARGET_RIGHT:
case PED_CENTER_CAMERA_BEHIND_PLAYER: case PED_CENTER_CAMERA_BEHIND_PLAYER:

View File

@ -32,6 +32,8 @@ enum e_ControllerAction
PED_JUMPING, PED_JUMPING,
PED_SPRINT, PED_SPRINT,
PED_LOOKBEHIND, PED_LOOKBEHIND,
PED_DUCK,
PED_ANSWER_PHONE,
VEHICLE_ACCELERATE, VEHICLE_ACCELERATE,
VEHICLE_BRAKE, VEHICLE_BRAKE,
VEHICLE_CHANGE_RADIO_STATION, VEHICLE_CHANGE_RADIO_STATION,

View File

@ -6025,7 +6025,6 @@ CPed::SetWaitState(eWaitState state, void *time)
case WAITSTATE_GROUND_ATTACK: case WAITSTATE_GROUND_ATTACK:
case WAITSTATE_LANCESITTING: case WAITSTATE_LANCESITTING:
case WAITSTATE_PLAYANIM_HANDSUP_SIMPLE: case WAITSTATE_PLAYANIM_HANDSUP_SIMPLE:
assert(0);
default: default:
ClearWaitState(); ClearWaitState();
RestoreHeadingRate(); RestoreHeadingRate();
@ -18533,7 +18532,7 @@ CPed::Save(uint8*& buf)
CopyToBuf(buf, m_fHealth); CopyToBuf(buf, m_fHealth);
CopyToBuf(buf, m_fArmour); CopyToBuf(buf, m_fArmour);
SkipSaveBuf(buf, 148); SkipSaveBuf(buf, 148);
for (int i = 0; i < 10; i++) // has to be hardcoded for (int i = 0; i < 13; i++) // has to be hardcoded
m_weapons[i].Save(buf); m_weapons[i].Save(buf);
SkipSaveBuf(buf, 5); SkipSaveBuf(buf, 5);
CopyToBuf(buf, m_maxWeaponTypeAllowed); CopyToBuf(buf, m_maxWeaponTypeAllowed);
@ -18555,8 +18554,10 @@ CPed::Load(uint8*& buf)
SkipSaveBuf(buf, 148); SkipSaveBuf(buf, 148);
CWeapon bufWeapon; CWeapon bufWeapon;
for (int i = 0; i < 10; i++) { // has to be hardcoded for (int i = 0; i < 13; i++) { // has to be hardcoded
bufWeapon.Load(buf); bufWeapon.Load(buf);
if (i >= 10)
continue; // tmp hack before we fix save/load
if (bufWeapon.m_eWeaponType != WEAPONTYPE_UNARMED) { if (bufWeapon.m_eWeaponType != WEAPONTYPE_UNARMED) {
int modelId = CWeaponInfo::GetWeaponInfo(bufWeapon.m_eWeaponType)->m_nModelId; int modelId = CWeaponInfo::GetWeaponInfo(bufWeapon.m_eWeaponType)->m_nModelId;