1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 11:10:01 +00:00

script fixes

This commit is contained in:
Nikolay Korolev 2021-01-23 23:04:24 +03:00
parent 3326603265
commit 37d1aa4129
8 changed files with 20 additions and 14 deletions

View file

@ -9,7 +9,7 @@
#include "PlayerInfo.h" #include "PlayerInfo.h"
#include "Vehicle.h" #include "Vehicle.h"
void CVehicle*
CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uint16 model) CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uint16 model)
{ {
CAutomobile *car = new CAutomobile(model, MISSION_VEHICLE); 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); TheCamera.SetZoomValueCamStringScript(0);
} else } else
TheCamera.TakeControl(car, CCam::MODE_BEHINDCAR, INTERPOLATION, CAMCONTROL_SCRIPT); TheCamera.TakeControl(car, CCam::MODE_BEHINDCAR, INTERPOLATION, CAMCONTROL_SCRIPT);
return car;
} }
void void

View file

@ -3,6 +3,6 @@
class CRemote class CRemote
{ {
public: public:
static void GivePlayerRemoteControlledCar(float, float, float, float, uint16); static CVehicle* GivePlayerRemoteControlledCar(float, float, float, float, uint16);
static void TakeRemoteControlledCarFromPlayer(bool blowUp = true); static void TakeRemoteControlledCarFromPlayer(bool blowUp = true);
}; };

View file

@ -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_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_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_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, 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_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, ""), 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: default:
break; break;
} }
m_sEntities[i].id = 0; RemoveEntityFromList(i, m_sEntities[i].type);
m_sEntities[i].type = CLEANUP_UNUSED;
m_nCount--;
} }
for (int i = 1; i < NUMSTREAMINFO; i++) { for (int i = 1; i < NUMSTREAMINFO; i++) {
if (CStreaming::IsScriptOwnedModel(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)]; return &pScript->m_anLocalVariables[NUM_LOCAL_VARS + 8 + (type - ARGUMENT_TIMER)];
} }
script_assert(false && "wrong type for variable"); 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) int32 *CRunningScript::GetPointerToScriptVariable(uint32* pIp, int16 type)
@ -2912,7 +2910,9 @@ int8 CRunningScript::ProcessOneCommand()
uint8 nLocalsOffset; uint8 nLocalsOffset;
if (command < ARRAY_SIZE(commands)) { if (command < ARRAY_SIZE(commands)) {
script_assert(commands[command].id == command); 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); 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) if (m_bNotFlag)
strcat(commandInfo, "NOT "); strcat(commandInfo, "NOT ");
if (commands[command].position == -1) if (commands[command].position == -1)
@ -4934,7 +4934,9 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
CVector pos = GET_VECTOR_PARAM(1); CVector pos = GET_VECTOR_PARAM(1);
if (pos.z <= MAP_Z_LOW_LIMIT) if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); 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; return 0;
} }
case COMMAND_ALTER_WANTED_LEVEL: case COMMAND_ALTER_WANTED_LEVEL:

View file

@ -74,7 +74,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
case COMMAND_ADD_ARROW_3D_MARKER: case COMMAND_ADD_ARROW_3D_MARKER:
{ {
uint32 ip = m_nIp; uint32 ip = m_nIp;
uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&m_nIp, 0); uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&ip, 0);
CollectParameters(&m_nIp, 10); CollectParameters(&m_nIp, 10);
CVector pos = GET_VECTOR_PARAM(0); CVector pos = GET_VECTOR_PARAM(0);
CVector dir = GET_VECTOR_PARAM(3); CVector dir = GET_VECTOR_PARAM(3);
@ -213,7 +213,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
case COMMAND_PRINT_WITH_2_NUMBERS_NOW_NO_BRIEF: case COMMAND_PRINT_WITH_2_NUMBERS_NOW_NO_BRIEF:
{ {
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); 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 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; return 0;
} }
@ -321,6 +321,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
strncpy(onscreen_str2, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); strncpy(onscreen_str2, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
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 CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(1), onscreen_str1, 0); // TODO - second set of data
return 0;
} }
case COMMAND_GET_PLAYER_STORED_WEAPON: case COMMAND_GET_PLAYER_STORED_WEAPON:
{ {

View file

@ -935,6 +935,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
script_assert(pVehicle); script_assert(pVehicle);
pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle); pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle);
pPed->WarpPedIntoCar(pVehicle); pPed->WarpPedIntoCar(pVehicle);
pPed->RestorePreviousObjective();
return 0; return 0;
} }
case COMMAND_WARP_CHAR_INTO_CAR: case COMMAND_WARP_CHAR_INTO_CAR:

View file

@ -636,7 +636,7 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
case COMMAND_ADD_POINT_3D_MARKER: case COMMAND_ADD_POINT_3D_MARKER:
{ {
uint32 ip = m_nIp; uint32 ip = m_nIp;
uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&m_nIp, 0); uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&ip, 0);
static CVector vPreviousLocation; static CVector vPreviousLocation;
CollectParameters(&m_nIp, 7); CollectParameters(&m_nIp, 7);
CVector pos = GET_VECTOR_PARAM(0); CVector pos = GET_VECTOR_PARAM(0);
@ -737,10 +737,10 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
} }
case COMMAND_SET_CHAR_ATTACKS_PLAYER_WITH_COPS: 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)); CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed); script_assert(pPed);
pPed->bAttacksPlayerWithCops = (GET_INTEGER_PARAM(0) != 0); pPed->bAttacksPlayerWithCops = (GET_INTEGER_PARAM(1) != 0);
return 0; return 0;
} }
case COMMAND_REGISTER_FACE_PLANT_DISTANCE: case COMMAND_REGISTER_FACE_PLANT_DISTANCE:

View file

@ -767,7 +767,7 @@ extern bool gbRenderDebugEnvMap;
"A Date with Death (Toshiko Kasen)", "Cash in Kazuki's Chips (Toshiko Kasen)" "A Date with Death (Toshiko Kasen)", "Cash in Kazuki's Chips (Toshiko Kasen)"
}; };
missionEntry = DebugMenuAddVar("Debug", "Select mission", &nextMissionToSwitch, nil, 1, 0, 96, missions); missionEntry = DebugMenuAddVar("Debug", "Select mission", &nextMissionToSwitch, nil, 1, 0, ARRAY_SIZE(missions) - 1, missions);
DebugMenuEntrySetWrap(missionEntry, true); DebugMenuEntrySetWrap(missionEntry, true);
DebugMenuAddCmd("Debug", "Start selected mission ", SwitchToMission); DebugMenuAddCmd("Debug", "Start selected mission ", SwitchToMission);
#endif #endif

View file

@ -79,6 +79,7 @@ CBike::CBike(int32 id, uint8 CreatedBy)
m_bikeAnimType = ASSOCGRP_BIKE_STANDARD; m_bikeAnimType = ASSOCGRP_BIKE_STANDARD;
break; break;
case MI_SANCHEZ: case MI_SANCHEZ:
case MI_SANCHEZ2:
m_bikeAnimType = ASSOCGRP_BIKE_DIRT; m_bikeAnimType = ASSOCGRP_BIKE_DIRT;
break; break;
default: m_bikeAnimType = ASSOCGRP_BIKE_STANDARD; //assert(0 && "invalid bike model ID"); // TODO default: m_bikeAnimType = ASSOCGRP_BIKE_STANDARD; //assert(0 && "invalid bike model ID"); // TODO