diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-23 21:04:24 +0100 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-23 21:04:24 +0100 |
commit | 37d1aa41296f3ea1e912041d4fc201df54ad2639 (patch) | |
tree | 5b01aa010def0f2dcc739559237d627ceb44e3eb /src/control | |
parent | added some missing functions (diff) | |
download | re3-37d1aa41296f3ea1e912041d4fc201df54ad2639.tar re3-37d1aa41296f3ea1e912041d4fc201df54ad2639.tar.gz re3-37d1aa41296f3ea1e912041d4fc201df54ad2639.tar.bz2 re3-37d1aa41296f3ea1e912041d4fc201df54ad2639.tar.lz re3-37d1aa41296f3ea1e912041d4fc201df54ad2639.tar.xz re3-37d1aa41296f3ea1e912041d4fc201df54ad2639.tar.zst re3-37d1aa41296f3ea1e912041d4fc201df54ad2639.zip |
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/Remote.cpp | 3 | ||||
-rw-r--r-- | src/control/Remote.h | 2 | ||||
-rw-r--r-- | src/control/Script.cpp | 14 | ||||
-rw-r--r-- | src/control/Script10.cpp | 5 | ||||
-rw-r--r-- | src/control/Script4.cpp | 1 | ||||
-rw-r--r-- | src/control/Script9.cpp | 6 |
6 files changed, 18 insertions, 13 deletions
diff --git a/src/control/Remote.cpp b/src/control/Remote.cpp index 047b19f3..dc025549 100644 --- a/src/control/Remote.cpp +++ b/src/control/Remote.cpp @@ -9,7 +9,7 @@ #include "PlayerInfo.h" #include "Vehicle.h" -void +CVehicle* CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uint16 model) { CAutomobile *car = new CAutomobile(model, MISSION_VEHICLE); @@ -40,6 +40,7 @@ CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uin TheCamera.SetZoomValueCamStringScript(0); } else TheCamera.TakeControl(car, CCam::MODE_BEHINDCAR, INTERPOLATION, CAMCONTROL_SCRIPT); + return car; } void diff --git a/src/control/Remote.h b/src/control/Remote.h index 72cabb7c..4c40dd96 100644 --- a/src/control/Remote.h +++ b/src/control/Remote.h @@ -3,6 +3,6 @@ class CRemote { public: - static void GivePlayerRemoteControlledCar(float, float, float, float, uint16); + static CVehicle* GivePlayerRemoteControlledCar(float, float, float, float, uint16); static void TakeRemoteControlledCarFromPlayer(bool blowUp = true); }; diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 7712a335..e1e1fbc2 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -426,7 +426,7 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_ADD_SCORE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_IS_SCORE_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""), REGISTER_COMMAND(COMMAND_STORE_SCORE, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""), - REGISTER_COMMAND(COMMAND_GIVE_REMOTE_CONTROLLED_CAR_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_GIVE_REMOTE_CONTROLLED_CAR_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""), REGISTER_COMMAND(COMMAND_ALTER_WANTED_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_ALTER_WANTED_LEVEL_NO_DROP, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_IS_WANTED_LEVEL_GREATER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""), @@ -2140,9 +2140,7 @@ void CMissionCleanup::Process() default: break; } - m_sEntities[i].id = 0; - m_sEntities[i].type = CLEANUP_UNUSED; - m_nCount--; + RemoveEntityFromList(i, m_sEntities[i].type); } for (int i = 1; i < NUMSTREAMINFO; i++) { if (CStreaming::IsScriptOwnedModel(i)) @@ -2517,7 +2515,7 @@ int32* GetPointerToScriptVariable(CRunningScript* pScript, uint32* pIp) return &pScript->m_anLocalVariables[NUM_LOCAL_VARS + 8 + (type - ARGUMENT_TIMER)]; } script_assert(false && "wrong type for variable"); - return nil; + return &pScript->m_anLocalVariables[pScript->m_nLocalsPointer + (type - ARGUMENT_LOCAL)]; } int32 *CRunningScript::GetPointerToScriptVariable(uint32* pIp, int16 type) @@ -2912,7 +2910,9 @@ int8 CRunningScript::ProcessOneCommand() uint8 nLocalsOffset; if (command < ARRAY_SIZE(commands)) { script_assert(commands[command].id == command); + m_nIp -= 2; sprintf(commandInfo, m_nIp >= CTheScripts::MainScriptSize ? "M<%5d> " : "<%6d> ", m_nIp >= CTheScripts::MainScriptSize ? m_nIp - CTheScripts::MainScriptSize : m_nIp); + m_nIp += 2; if (m_bNotFlag) strcat(commandInfo, "NOT "); if (commands[command].position == -1) @@ -4934,7 +4934,9 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CRemote::GivePlayerRemoteControlledCar(pos.x, pos.y, pos.z, DEGTORAD(GET_FLOAT_PARAM(4)), MI_RCBANDIT); + CVehicle* pVehicle = CRemote::GivePlayerRemoteControlledCar(pos.x, pos.y, pos.z, DEGTORAD(GET_FLOAT_PARAM(4)), MI_RCBANDIT); + SET_INTEGER_PARAM(0, CPools::GetVehiclePool()->GetIndex(pVehicle)); + StoreParameters(&m_nIp, 1); return 0; } case COMMAND_ALTER_WANTED_LEVEL: diff --git a/src/control/Script10.cpp b/src/control/Script10.cpp index 536701b3..fef33848 100644 --- a/src/control/Script10.cpp +++ b/src/control/Script10.cpp @@ -74,7 +74,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command) case COMMAND_ADD_ARROW_3D_MARKER: { uint32 ip = m_nIp; - uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&m_nIp, 0); + uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&ip, 0); CollectParameters(&m_nIp, 10); CVector pos = GET_VECTOR_PARAM(0); CVector dir = GET_VECTOR_PARAM(3); @@ -213,7 +213,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command) case COMMAND_PRINT_WITH_2_NUMBERS_NOW_NO_BRIEF: { wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); - CollectParameters(&m_nIp, 3); + CollectParameters(&m_nIp, 4); CMessages::AddMessageJumpQWithNumber(key, GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), -1, -1, -1, -1); // 0 return 0; } @@ -321,6 +321,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command) strncpy(onscreen_str2, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); m_nIp += KEY_LENGTH_IN_SCRIPT; CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(1), onscreen_str1, 0); // TODO - second set of data + return 0; } case COMMAND_GET_PLAYER_STORED_WEAPON: { diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index c3eb2e89..d6a08c3d 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -935,6 +935,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) script_assert(pVehicle); pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle); pPed->WarpPedIntoCar(pVehicle); + pPed->RestorePreviousObjective(); return 0; } case COMMAND_WARP_CHAR_INTO_CAR: diff --git a/src/control/Script9.cpp b/src/control/Script9.cpp index 183f73e7..020221c4 100644 --- a/src/control/Script9.cpp +++ b/src/control/Script9.cpp @@ -636,7 +636,7 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command) case COMMAND_ADD_POINT_3D_MARKER: { uint32 ip = m_nIp; - uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&m_nIp, 0); + uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&ip, 0); static CVector vPreviousLocation; CollectParameters(&m_nIp, 7); CVector pos = GET_VECTOR_PARAM(0); @@ -737,10 +737,10 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command) } case COMMAND_SET_CHAR_ATTACKS_PLAYER_WITH_COPS: { - CollectParameters(&m_nIp, 1); + CollectParameters(&m_nIp, 2); CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->bAttacksPlayerWithCops = (GET_INTEGER_PARAM(0) != 0); + pPed->bAttacksPlayerWithCops = (GET_INTEGER_PARAM(1) != 0); return 0; } case COMMAND_REGISTER_FACE_PLANT_DISTANCE: |