mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-27 19:44:15 +01:00
script revision
This commit is contained in:
parent
ff0e039599
commit
4c822e8375
@ -57,6 +57,7 @@
|
|||||||
#include "RoadBlocks.h"
|
#include "RoadBlocks.h"
|
||||||
#include "RpAnimBlend.h"
|
#include "RpAnimBlend.h"
|
||||||
#include "Rubbish.h"
|
#include "Rubbish.h"
|
||||||
|
#include "SimpleModelInfo.h"
|
||||||
#include "Shadows.h"
|
#include "Shadows.h"
|
||||||
#include "SpecialFX.h"
|
#include "SpecialFX.h"
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
@ -1899,6 +1900,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
ped->CharCreatedBy = MISSION_CHAR;
|
ped->CharCreatedBy = MISSION_CHAR;
|
||||||
ped->bRespondsToThreats = false;
|
ped->bRespondsToThreats = false;
|
||||||
ped->bAllowMedicsToReviveMe = false;
|
ped->bAllowMedicsToReviveMe = false;
|
||||||
|
ped->bIsPlayerFriend = false;
|
||||||
CVector pos = *(CVector*)&ScriptParams[2];
|
CVector pos = *(CVector*)&ScriptParams[2];
|
||||||
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);
|
||||||
@ -1921,24 +1923,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||||
if (ped) {
|
CTheScripts::RemoveThisPed(ped);
|
||||||
if (ped->InVehicle()) {
|
|
||||||
if (ped->m_pMyVehicle->pDriver == ped) {
|
|
||||||
ped->m_pMyVehicle->RemoveDriver();
|
|
||||||
ped->m_pMyVehicle->SetStatus(STATUS_ABANDONED);
|
|
||||||
if (ped->m_pMyVehicle->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
|
|
||||||
ped->m_pMyVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
|
||||||
if (ped->m_nPedType == PEDTYPE_COP && ped->m_pMyVehicle->IsLawEnforcementVehicle())
|
|
||||||
ped->m_pMyVehicle->ChangeLawEnforcerState(0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ped->m_pMyVehicle->RemovePassenger(ped);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CWorld::RemoveReferencesToDeletedObject(ped);
|
|
||||||
delete ped;
|
|
||||||
--CPopulation::ms_nTotalMissionPeds;
|
|
||||||
}
|
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1955,19 +1940,26 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
ped->SetWanderPath(path);
|
ped->SetWanderPath(path);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Not implemented.
|
//case COMMAND_CHAR_WANDER_RANGE:
|
||||||
case COMMAND_CHAR_WANDER_RANGE:
|
|
||||||
*/
|
|
||||||
case COMMAND_CHAR_FOLLOW_PATH:
|
case COMMAND_CHAR_FOLLOW_PATH:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 4);
|
CollectParameters(&m_nIp, 6);
|
||||||
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||||
assert(ped);
|
assert(ped);
|
||||||
|
if (ped->GetPedState() == PED_ATTACK || ped->GetPedState() == PED_FIGHT || !ped->IsPedInControl())
|
||||||
|
return 0;
|
||||||
CVector pos = *(CVector*)&ScriptParams[1];
|
CVector pos = *(CVector*)&ScriptParams[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);
|
||||||
|
float radius = *(float*)&ScriptParams[4];
|
||||||
|
eMoveState state;
|
||||||
|
switch (ScriptParams[5]) {
|
||||||
|
case 0: state = PEDMOVE_WALK;
|
||||||
|
case 1: state = PEDMOVE_SPRINT;
|
||||||
|
default: assert(0);
|
||||||
|
}
|
||||||
ped->ClearAll();
|
ped->ClearAll();
|
||||||
ped->SetFollowPath(pos);
|
ped->SetFollowPath(pos, radius, state, nil, nil, 999999);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_CHAR_SET_IDLE:
|
case COMMAND_CHAR_SET_IDLE:
|
||||||
@ -2012,44 +2004,27 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
CVector pos = *(CVector*)&ScriptParams[1];
|
CVector pos = *(CVector*)&ScriptParams[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);
|
||||||
/* The following block was once again written
|
// removed dumb stuff again
|
||||||
* by someone not familiar with virtual functions.
|
|
||||||
* It doesn't require any ifs at all.
|
|
||||||
* To keep as close to original as possible, I'll keep it.
|
|
||||||
* Maybe there was more commented out/debug
|
|
||||||
* stuff, but I doubt it.
|
|
||||||
*/
|
|
||||||
if (!vehicle) {
|
if (!vehicle) {
|
||||||
pos.z += ped->GetDistanceFromCentreOfMassToBaseOfModel();
|
pos.z += ped->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||||
ped->Teleport(pos);
|
ped->Teleport(pos);
|
||||||
CTheScripts::ClearSpaceForMissionEntity(pos, ped);
|
CTheScripts::ClearSpaceForMissionEntity(pos, ped);
|
||||||
}
|
for (int i = 0; i < ped->m_numNearPeds; i++) {
|
||||||
else if (vehicle->IsBoat()) {
|
CPed* pNearPed = ped->m_nearPeds[i];
|
||||||
pos.z += vehicle->GetDistanceFromCentreOfMassToBaseOfModel();
|
if (pNearPed->m_leader == ped) {
|
||||||
vehicle->Teleport(pos);
|
pNearPed->Teleport(pos);
|
||||||
CTheScripts::ClearSpaceForMissionEntity(pos, vehicle);
|
pNearPed->PositionPedOutOfCollision(); // TODO(MIAMI): this is PositionAnyPedOutOfCollision!!!
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pos.z += vehicle->GetDistanceFromCentreOfMassToBaseOfModel();
|
pos.z += vehicle->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||||
vehicle->Teleport(pos);
|
vehicle->Teleport(pos);
|
||||||
CTheScripts::ClearSpaceForMissionEntity(pos, vehicle);
|
CTheScripts::ClearSpaceForMissionEntity(pos, vehicle);
|
||||||
}
|
}
|
||||||
/* Short version of this command.
|
|
||||||
*
|
|
||||||
* CollectParameters(&m_nIp, 4);
|
|
||||||
* CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
|
||||||
* assert(ped);
|
|
||||||
* CEntity* entityToMove = ped->bInVehicle ? ped->m_pMyVehicle : ped;
|
|
||||||
* CVector pos = *(CVector*)&ScriptParams[1];
|
|
||||||
* if (pos.z <= MAP_Z_LOW_LIMIT)
|
|
||||||
* pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
|
||||||
* pos.z += entityToMove->GetDistanceFromCentreOfMassToBaseOfModel();
|
|
||||||
* entityToMove->Teleport(pos);
|
|
||||||
* CTheScripts::ClearSpaceForMissionEntity(pos, entityToMove);
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
case COMMAND_IS_CHAR_STILL_ALIVE:
|
case COMMAND_IS_CHAR_STILL_ALIVE:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
@ -2057,6 +2032,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
UpdateCompareFlag(ped && ped->GetPedState() != PED_DEAD && ped->GetPedState() != PED_DIE);
|
UpdateCompareFlag(ped && ped->GetPedState() != PED_DEAD && ped->GetPedState() != PED_DIE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
case COMMAND_IS_CHAR_IN_AREA_2D:
|
case COMMAND_IS_CHAR_IN_AREA_2D:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 6);
|
CollectParameters(&m_nIp, 6);
|
||||||
@ -2124,7 +2100,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
boat->SetStatus(STATUS_ABANDONED);
|
boat->SetStatus(STATUS_ABANDONED);
|
||||||
boat->bIsLocked = true;
|
boat->bIsLocked = true;
|
||||||
boat->AutoPilot.m_nCarMission = MISSION_NONE;
|
boat->AutoPilot.m_nCarMission = MISSION_NONE;
|
||||||
boat->AutoPilot.m_nTempAction = TEMPACT_NONE; /* Animation ID? */
|
boat->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
||||||
boat->AutoPilot.m_nCruiseSpeed = boat->AutoPilot.m_fMaxTrafficSpeed = 20.0f;
|
boat->AutoPilot.m_nCruiseSpeed = boat->AutoPilot.m_fMaxTrafficSpeed = 20.0f;
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
boat->bIsStaticWaitingForCollision = true;
|
boat->bIsStaticWaitingForCollision = true;
|
||||||
@ -2147,7 +2123,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
car->bIsLocked = true;
|
car->bIsLocked = true;
|
||||||
CCarCtrl::JoinCarWithRoadSystem(car);
|
CCarCtrl::JoinCarWithRoadSystem(car);
|
||||||
car->AutoPilot.m_nCarMission = MISSION_NONE;
|
car->AutoPilot.m_nCarMission = MISSION_NONE;
|
||||||
car->AutoPilot.m_nTempAction = TEMPACT_NONE; /* Animation ID? */
|
car->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
||||||
car->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
car->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||||
car->AutoPilot.m_nCruiseSpeed = car->AutoPilot.m_fMaxTrafficSpeed = 9.0f;
|
car->AutoPilot.m_nCruiseSpeed = car->AutoPilot.m_fMaxTrafficSpeed = 9.0f;
|
||||||
car->AutoPilot.m_nCurrentLane = car->AutoPilot.m_nNextLane = 0;
|
car->AutoPilot.m_nCurrentLane = car->AutoPilot.m_nNextLane = 0;
|
||||||
@ -2277,6 +2253,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
case COMMAND_IS_CAR_STILL_ALIVE:
|
case COMMAND_IS_CAR_STILL_ALIVE:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
@ -2284,6 +2261,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
UpdateCompareFlag(car && car->GetStatus() != STATUS_WRECKED && (car->IsBoat() || !car->bIsInWater));
|
UpdateCompareFlag(car && car->GetStatus() != STATUS_WRECKED && (car->IsBoat() || !car->bIsInWater));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
case COMMAND_SET_CAR_CRUISE_SPEED:
|
case COMMAND_SET_CAR_CRUISE_SPEED:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
@ -2358,32 +2336,28 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
return 0;
|
return 0;
|
||||||
case COMMAND_PRINT_BIG:
|
case COMMAND_PRINT_BIG:
|
||||||
{
|
{
|
||||||
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
|
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
|
||||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
CMessages::AddBigMessage(key, ScriptParams[0], ScriptParams[1] - 1);
|
CMessages::AddBigMessage(key, ScriptParams[0], ScriptParams[1] - 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_PRINT:
|
case COMMAND_PRINT:
|
||||||
{
|
{
|
||||||
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
|
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
|
||||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
CMessages::AddMessage(key, ScriptParams[0], ScriptParams[1]);
|
CMessages::AddMessage(key, ScriptParams[0], ScriptParams[1]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_PRINT_NOW:
|
case COMMAND_PRINT_NOW:
|
||||||
{
|
{
|
||||||
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
|
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
|
||||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
CMessages::AddMessageJumpQ(key, ScriptParams[0], ScriptParams[1]);
|
CMessages::AddMessageJumpQ(key, ScriptParams[0], ScriptParams[1]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_PRINT_SOON:
|
case COMMAND_PRINT_SOON:
|
||||||
{
|
{
|
||||||
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
|
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
|
||||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
CMessages::AddMessageSoon(key, ScriptParams[0], ScriptParams[1]);
|
CMessages::AddMessageSoon(key, ScriptParams[0], ScriptParams[1]);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2420,15 +2394,15 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
case COMMAND_DEBUG_OFF:
|
case COMMAND_DEBUG_OFF:
|
||||||
CTheScripts::DbgFlag = false;
|
CTheScripts::DbgFlag = false;
|
||||||
return 0;
|
return 0;
|
||||||
|
/*
|
||||||
case COMMAND_RETURN_TRUE:
|
case COMMAND_RETURN_TRUE:
|
||||||
UpdateCompareFlag(true);
|
UpdateCompareFlag(true);
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_RETURN_FALSE:
|
case COMMAND_RETURN_FALSE:
|
||||||
UpdateCompareFlag(false);
|
UpdateCompareFlag(false);
|
||||||
return 0;
|
return 0;
|
||||||
/* Special command only used by compiler.
|
|
||||||
case COMMAND_VAR_INT:
|
|
||||||
*/
|
*/
|
||||||
|
//case COMMAND_VAR_INT:
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
@ -2481,8 +2455,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
{
|
{
|
||||||
if (!m_bIsMissionScript)
|
if (!m_bIsMissionScript)
|
||||||
return 0;
|
return 0;
|
||||||
if (strcmp(m_abScriptName, "love3") == 0) /* A Drop in the Ocean */
|
|
||||||
CPickups::RemoveAllFloatingPickups();
|
|
||||||
CTheScripts::MissionCleanup.Process();
|
CTheScripts::MissionCleanup.Process();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2625,29 +2597,23 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||||
UpdateCompareFlag(pPed->bInVehicle);
|
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_IS_PLAYER_IN_ANY_CAR:
|
case COMMAND_IS_PLAYER_IN_ANY_CAR:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
|
CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
|
||||||
UpdateCompareFlag(pPed->bInVehicle);
|
UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_IS_BUTTON_PRESSED:
|
case COMMAND_IS_BUTTON_PRESSED:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
bool value = GetPadState(ScriptParams[0], ScriptParams[1]) != 0;
|
UpdateCompareFlag(GetPadState(ScriptParams[0], ScriptParams[1]) != 0);
|
||||||
if (CGame::playingIntro && ScriptParams[0] == 0 && ScriptParams[1] == 12) {
|
|
||||||
if (CPad::GetPad(0)->GetLeftMouseJustDown() ||
|
|
||||||
CPad::GetPad(0)->GetEnterJustDown() ||
|
|
||||||
CPad::GetPad(0)->GetCharJustDown(' '))
|
|
||||||
value = true;
|
|
||||||
}
|
|
||||||
UpdateCompareFlag(value);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
case COMMAND_GET_PAD_STATE:
|
case COMMAND_GET_PAD_STATE:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
@ -2655,6 +2621,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
case COMMAND_LOCATE_PLAYER_ANY_MEANS_2D:
|
case COMMAND_LOCATE_PLAYER_ANY_MEANS_2D:
|
||||||
case COMMAND_LOCATE_PLAYER_ON_FOOT_2D:
|
case COMMAND_LOCATE_PLAYER_ON_FOOT_2D:
|
||||||
case COMMAND_LOCATE_PLAYER_IN_CAR_2D:
|
case COMMAND_LOCATE_PLAYER_IN_CAR_2D:
|
||||||
@ -2721,6 +2688,9 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
pObj->SetOrientation(0.0f, 0.0f, 0.0f);
|
pObj->SetOrientation(0.0f, 0.0f, 0.0f);
|
||||||
pObj->GetMatrix().UpdateRW();
|
pObj->GetMatrix().UpdateRW();
|
||||||
pObj->UpdateRwFrame();
|
pObj->UpdateRwFrame();
|
||||||
|
CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(mi);
|
||||||
|
if (pModelInfo->IsBuilding() && ((CSimpleModelInfo*)pModelInfo)->m_isBigBuilding)
|
||||||
|
pObj->SetupBigBuilding();
|
||||||
CTheScripts::ClearSpaceForMissionEntity(pos, pObj);
|
CTheScripts::ClearSpaceForMissionEntity(pos, pObj);
|
||||||
CWorld::Add(pObj);
|
CWorld::Add(pObj);
|
||||||
ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
|
ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
|
||||||
@ -2745,6 +2715,8 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
case COMMAND_ADD_SCORE:
|
case COMMAND_ADD_SCORE:
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
CWorld::Players[ScriptParams[0]].m_nMoney += ScriptParams[1];
|
CWorld::Players[ScriptParams[0]].m_nMoney += ScriptParams[1];
|
||||||
|
if (CWorld::Players[ScriptParams[0]].m_nMoney < 0)
|
||||||
|
CWorld::Players[ScriptParams[0]].m_nMoney = 0;
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_IS_SCORE_GREATER:
|
case COMMAND_IS_SCORE_GREATER:
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
@ -2787,12 +2759,14 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
case COMMAND_HAS_DEATHARREST_BEEN_EXECUTED:
|
case COMMAND_HAS_DEATHARREST_BEEN_EXECUTED:
|
||||||
UpdateCompareFlag(m_bDeatharrestExecuted);
|
UpdateCompareFlag(m_bDeatharrestExecuted);
|
||||||
return 0;
|
return 0;
|
||||||
|
/*
|
||||||
case COMMAND_ADD_AMMO_TO_PLAYER:
|
case COMMAND_ADD_AMMO_TO_PLAYER:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 3);
|
CollectParameters(&m_nIp, 3);
|
||||||
CWorld::Players[ScriptParams[0]].m_pPed->GrantAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]);
|
CWorld::Players[ScriptParams[0]].m_pPed->GrantAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
case COMMAND_ADD_AMMO_TO_CHAR:
|
case COMMAND_ADD_AMMO_TO_CHAR:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 3);
|
CollectParameters(&m_nIp, 3);
|
||||||
@ -2801,10 +2775,8 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
pPed->GrantAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]);
|
pPed->GrantAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Not implemented
|
//case COMMAND_ADD_AMMO_TO_CAR:
|
||||||
case COMMAND_ADD_AMMO_TO_CAR:
|
//case COMMAND_IS_PLAYER_STILL_ALIVE:
|
||||||
case COMMAND_IS_PLAYER_STILL_ALIVE:
|
|
||||||
*/
|
|
||||||
case COMMAND_IS_PLAYER_DEAD:
|
case COMMAND_IS_PLAYER_DEAD:
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_WASTED);
|
UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_WASTED);
|
||||||
@ -2813,14 +2785,14 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||||
UpdateCompareFlag(!pPed || pPed->GetPedState() == PED_DIE || pPed->GetPedState() == PED_DEAD);
|
UpdateCompareFlag(!pPed || pPed->DyingOrDead());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_IS_CAR_DEAD:
|
case COMMAND_IS_CAR_DEAD:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||||
UpdateCompareFlag(!pVehicle || pVehicle->GetStatus() == STATUS_WRECKED || !pVehicle->IsBoat() && pVehicle->bIsInWater);
|
UpdateCompareFlag(!pVehicle || pVehicle->GetStatus() == STATUS_WRECKED || pVehicle->bIsDrowning);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_SET_CHAR_THREAT_SEARCH:
|
case COMMAND_SET_CHAR_THREAT_SEARCH:
|
||||||
@ -2831,9 +2803,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
pPed->m_fearFlags |= ScriptParams[1];
|
pPed->m_fearFlags |= ScriptParams[1];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Not implemented.
|
//case COMMAND_SET_CHAR_THREAT_REACTION:
|
||||||
case COMMAND_SET_CHAR_THREAT_REACTION:
|
|
||||||
*/
|
|
||||||
case COMMAND_SET_CHAR_OBJ_NO_OBJ:
|
case COMMAND_SET_CHAR_OBJ_NO_OBJ:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
@ -2843,12 +2813,10 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
pPed->ClearObjective();
|
pPed->ClearObjective();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Not implemented.
|
//case COMMAND_ORDER_DRIVER_OUT_OF_CAR:
|
||||||
case COMMAND_ORDER_DRIVER_OUT_OF_CAR:
|
//case COMMAND_ORDER_CHAR_TO_DRIVE_CAR:
|
||||||
case COMMAND_ORDER_CHAR_TO_DRIVE_CAR:
|
//case COMMAND_ADD_PATROL_POINT:
|
||||||
case COMMAND_ADD_PATROL_POINT:
|
//case COMMAND_IS_PLAYER_IN_GANGZONE:
|
||||||
case COMMAND_IS_PLAYER_IN_GANGZONE:
|
|
||||||
*/
|
|
||||||
case COMMAND_IS_PLAYER_IN_ZONE:
|
case COMMAND_IS_PLAYER_IN_ZONE:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
@ -2867,8 +2835,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_pPed->GetPedState() == PED_DRIVING &&
|
UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_pPed->GetPedState() == PED_DRIVING &&
|
||||||
CPad::GetPad(ScriptParams[0])->GetHorn());
|
CPad::GetPad(ScriptParams[0])->GetHorn());
|
||||||
/* Is it correct that same parameter is used both as index of Players */
|
|
||||||
/* and as ID of pad? Pratically this parameter is always 0 anyway of course. */
|
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_HAS_CHAR_SPOTTED_PLAYER:
|
case COMMAND_HAS_CHAR_SPOTTED_PLAYER:
|
||||||
{
|
{
|
||||||
@ -2878,10 +2844,8 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
UpdateCompareFlag(pPed->OurPedCanSeeThisOne(CWorld::Players[ScriptParams[1]].m_pPed));
|
UpdateCompareFlag(pPed->OurPedCanSeeThisOne(CWorld::Players[ScriptParams[1]].m_pPed));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Not implemented.
|
//case COMMAND_ORDER_CHAR_TO_BACKDOOR:
|
||||||
case COMMAND_ORDER_CHAR_TO_BACKDOOR:
|
//case COMMAND_ADD_CHAR_TO_GANG:
|
||||||
case COMMAND_ADD_CHAR_TO_GANG:
|
|
||||||
*/
|
|
||||||
case COMMAND_IS_CHAR_OBJECTIVE_PASSED:
|
case COMMAND_IS_CHAR_OBJECTIVE_PASSED:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
@ -2937,6 +2901,9 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
pPed->CharCreatedBy = MISSION_CHAR;
|
pPed->CharCreatedBy = MISSION_CHAR;
|
||||||
pPed->bRespondsToThreats = false;
|
pPed->bRespondsToThreats = false;
|
||||||
pPed->bAllowMedicsToReviveMe = false;
|
pPed->bAllowMedicsToReviveMe = false;
|
||||||
|
pPed->bIsPlayerFriend = false;
|
||||||
|
if (pVehicle->bIsBus)
|
||||||
|
pPed->bRenderPedInCar = false;
|
||||||
pPed->SetPosition(pVehicle->GetPosition());
|
pPed->SetPosition(pVehicle->GetPosition());
|
||||||
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
|
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
|
||||||
pPed->SetPedState(PED_DRIVING);
|
pPed->SetPedState(PED_DRIVING);
|
||||||
@ -2986,7 +2953,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
pPlayer->m_pPed->SetPedState(PED_IDLE);
|
pPlayer->m_pPed->SetPedState(PED_IDLE);
|
||||||
pPlayer->m_pPed->bUsesCollision = true;
|
pPlayer->m_pPed->bUsesCollision = true;
|
||||||
pPlayer->m_pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
pPlayer->m_pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||||
pPlayer->m_pPed->AddWeaponModel(CWeaponInfo::GetWeaponInfo(pPlayer->m_pPed->GetWeapon()->m_eWeaponType)->m_nModelId);
|
pPlayer->m_pPed->ReplaceWeaponWhenExitingVehicle();
|
||||||
pPlayer->m_pPed->RemoveInCarAnims();
|
pPlayer->m_pPed->RemoveInCarAnims();
|
||||||
if (pPlayer->m_pPed->m_pVehicleAnim)
|
if (pPlayer->m_pPed->m_pVehicleAnim)
|
||||||
pPlayer->m_pPed->m_pVehicleAnim->blendDelta = -1000.0f;
|
pPlayer->m_pPed->m_pVehicleAnim->blendDelta = -1000.0f;
|
||||||
@ -3000,9 +2967,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
CTheScripts::ClearSpaceForMissionEntity(pos, pPlayer->m_pPed);
|
CTheScripts::ClearSpaceForMissionEntity(pos, pPlayer->m_pPed);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Not implemented.
|
//case COMMAND_MAKE_CHAR_DO_NOTHING:
|
||||||
case COMMAND_MAKE_CHAR_DO_NOTHING:
|
|
||||||
*/
|
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
@ -7035,28 +7000,16 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||||
if (pPed && pPed->CharCreatedBy == MISSION_CHAR){
|
if (pPed && pPed->CharCreatedBy == MISSION_CHAR){
|
||||||
CWorld::RemoveReferencesToDeletedObject(pPed);
|
CWorld::RemoveReferencesToDeletedObject(pPed);
|
||||||
if (pPed->bInVehicle){
|
if (pPed->bInVehicle && pPed->m_pMyVehicle)
|
||||||
if (pPed->m_pMyVehicle){
|
CTheScripts::RemoveThisPed(pPed);
|
||||||
if (pPed == pPed->m_pMyVehicle->pDriver){
|
else{
|
||||||
pPed->m_pMyVehicle->RemoveDriver();
|
|
||||||
pPed->m_pMyVehicle->SetStatus(STATUS_ABANDONED);
|
|
||||||
if (pPed->m_pMyVehicle->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
|
|
||||||
pPed->m_pMyVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
|
||||||
if (pPed->m_nPedType == PEDTYPE_COP && pPed->m_pMyVehicle->IsLawEnforcementVehicle())
|
|
||||||
pPed->m_pMyVehicle->ChangeLawEnforcerState(0);
|
|
||||||
}else{
|
|
||||||
pPed->m_pMyVehicle->RemovePassenger(pPed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete pPed;
|
|
||||||
--CPopulation::ms_nTotalMissionPeds;
|
|
||||||
}else{
|
|
||||||
pPed->CharCreatedBy = RANDOM_CHAR;
|
pPed->CharCreatedBy = RANDOM_CHAR;
|
||||||
pPed->bRespondsToThreats = true;
|
pPed->bRespondsToThreats = true;
|
||||||
pPed->bScriptObjectiveCompleted = false;
|
pPed->bScriptObjectiveCompleted = false;
|
||||||
pPed->ClearLeader();
|
pPed->ClearLeader();
|
||||||
--CPopulation::ms_nTotalMissionPeds;
|
--CPopulation::ms_nTotalMissionPeds;
|
||||||
pPed->bFadeOut = true;
|
pPed->bFadeOut = true;
|
||||||
|
CWorld::RemoveReferencesToDeletedObject(pPed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
@ -7252,7 +7205,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
pPed->m_nLastPedState = PED_NONE;
|
pPed->m_nLastPedState = PED_NONE;
|
||||||
pPed->bUsesCollision = true;
|
pPed->bUsesCollision = true;
|
||||||
pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||||
pPed->AddWeaponModel(CWeaponInfo::GetWeaponInfo(pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType)->m_nModelId);
|
pPed->ReplaceWeaponWhenExitingVehicle();
|
||||||
pPed->RemoveInCarAnims();
|
pPed->RemoveInCarAnims();
|
||||||
if (pPed->m_pVehicleAnim)
|
if (pPed->m_pVehicleAnim)
|
||||||
pPed->m_pVehicleAnim->blendDelta = -1000.0f;
|
pPed->m_pVehicleAnim->blendDelta = -1000.0f;
|
||||||
@ -10543,7 +10496,9 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
|||||||
pPed->CharCreatedBy = MISSION_CHAR;
|
pPed->CharCreatedBy = MISSION_CHAR;
|
||||||
pPed->bRespondsToThreats = false;
|
pPed->bRespondsToThreats = false;
|
||||||
pPed->bAllowMedicsToReviveMe = false;
|
pPed->bAllowMedicsToReviveMe = false;
|
||||||
// TODO(MIAMI): two more flags and more stuff
|
pPed->bIsPlayerFriend = false;
|
||||||
|
if (pVehicle->bIsBus)
|
||||||
|
pPed->bRenderPedInCar = false;
|
||||||
pPed->SetPosition(pVehicle->GetPosition());
|
pPed->SetPosition(pVehicle->GetPosition());
|
||||||
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
|
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
|
||||||
pPed->SetPedState(PED_DRIVING);
|
pPed->SetPedState(PED_DRIVING);
|
||||||
@ -10572,7 +10527,9 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
|||||||
pPed->CharCreatedBy = MISSION_CHAR;
|
pPed->CharCreatedBy = MISSION_CHAR;
|
||||||
pPed->bRespondsToThreats = false;
|
pPed->bRespondsToThreats = false;
|
||||||
pPed->bAllowMedicsToReviveMe = false;
|
pPed->bAllowMedicsToReviveMe = false;
|
||||||
// TODO(MIAMI): two more flags and more stuff (ClearFollowPath)
|
pPed->bIsPlayerFriend = false;
|
||||||
|
if (pVehicle->bIsBus)
|
||||||
|
pPed->bRenderPedInCar = false;
|
||||||
pPed->SetPosition(pVehicle->GetPosition());
|
pPed->SetPosition(pVehicle->GetPosition());
|
||||||
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
|
pPed->SetOrientation(0.0f, 0.0f, 0.0f);
|
||||||
CPopulation::ms_nTotalMissionPeds++;
|
CPopulation::ms_nTotalMissionPeds++;
|
||||||
@ -10585,9 +10542,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
|||||||
pPed->m_pMyVehicle = pVehicle;
|
pPed->m_pMyVehicle = pVehicle;
|
||||||
pPed->m_pMyVehicle->RegisterReference((CEntity**)&pPed->m_pMyVehicle);
|
pPed->m_pMyVehicle->RegisterReference((CEntity**)&pPed->m_pMyVehicle);
|
||||||
pPed->bInVehicle = true;
|
pPed->bInVehicle = true;
|
||||||
// TODO
|
|
||||||
pPed->SetPedState(PED_DRIVING);
|
pPed->SetPedState(PED_DRIVING);
|
||||||
|
|
||||||
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
|
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
@ -10799,6 +10754,30 @@ bool CRunningScript::ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool f
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CTheScripts::RemoveThisPed(CPed* pPed)
|
||||||
|
{
|
||||||
|
if (pPed) {
|
||||||
|
bool bWasMissionPed = pPed->CharCreatedBy == MISSION_CHAR;
|
||||||
|
if (pPed->InVehicle() && pPed->m_pMyVehicle) {
|
||||||
|
if (pPed->m_pMyVehicle->pDriver == pPed) {
|
||||||
|
pPed->m_pMyVehicle->RemoveDriver();
|
||||||
|
pPed->m_pMyVehicle->SetStatus(STATUS_ABANDONED);
|
||||||
|
if (pPed->m_pMyVehicle->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
|
||||||
|
pPed->m_pMyVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||||
|
if (pPed->m_nPedType == PEDTYPE_COP && pPed->m_pMyVehicle->IsLawEnforcementVehicle())
|
||||||
|
pPed->m_pMyVehicle->ChangeLawEnforcerState(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pPed->m_pMyVehicle->RemovePassenger(pPed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CWorld::RemoveReferencesToDeletedObject(pPed);
|
||||||
|
delete pPed;
|
||||||
|
if (bWasMissionPed)
|
||||||
|
--CPopulation::ms_nTotalMissionPeds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32 CTheScripts::GetNewUniqueScriptSphereIndex(int32 index)
|
int32 CTheScripts::GetNewUniqueScriptSphereIndex(int32 index)
|
||||||
{
|
{
|
||||||
if (ScriptSphereArray[index].m_Index >= UINT16_MAX - 1)
|
if (ScriptSphereArray[index].m_Index >= UINT16_MAX - 1)
|
||||||
|
@ -367,6 +367,7 @@ private:
|
|||||||
static int32 GetNewUniqueScriptSphereIndex(int32 index);
|
static int32 GetNewUniqueScriptSphereIndex(int32 index);
|
||||||
static void RemoveScriptSphere(int32 index);
|
static void RemoveScriptSphere(int32 index);
|
||||||
static void RemoveScriptTextureDictionary();
|
static void RemoveScriptTextureDictionary();
|
||||||
|
static void RemoveThisPed(CPed* pPed);
|
||||||
|
|
||||||
friend class CRunningScript;
|
friend class CRunningScript;
|
||||||
friend class CHud;
|
friend class CHud;
|
||||||
|
@ -619,14 +619,15 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
|
|||||||
#ifdef KANGAROO_CHEAT
|
#ifdef KANGAROO_CHEAT
|
||||||
m_ped_flagI80 = false;
|
m_ped_flagI80 = false;
|
||||||
#endif
|
#endif
|
||||||
#ifdef VC_PED_PORTS
|
|
||||||
bSomeVCflag1 = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bReachedAttractorHeadingTarget = false;
|
bReachedAttractorHeadingTarget = false;
|
||||||
bTurnedAroundOnAttractor = false;
|
bTurnedAroundOnAttractor = false;
|
||||||
bCarPassenger = false;
|
bCarPassenger = false;
|
||||||
bMiamiViceCop = false;
|
bMiamiViceCop = false;
|
||||||
|
#ifdef VC_PED_PORTS
|
||||||
|
bHeadStuckInCollision = false;
|
||||||
|
#endif
|
||||||
|
bIsPlayerFriend = true;
|
||||||
bDeadPedInFrontOfCar = false;
|
bDeadPedInFrontOfCar = false;
|
||||||
|
|
||||||
if ((CGeneral::GetRandomNumber() & 3) == 0)
|
if ((CGeneral::GetRandomNumber() & 3) == 0)
|
||||||
@ -10662,7 +10663,7 @@ CPed::ProcessControl(void)
|
|||||||
flyDir = 1;
|
flyDir = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flyDir != 0 && !bSomeVCflag1) {
|
if (flyDir != 0 && !bHeadStuckInCollision) {
|
||||||
SetPosition((flyDir == 2 ? obstacleForFlyingOtherDir.point : obstacleForFlying.point));
|
SetPosition((flyDir == 2 ? obstacleForFlyingOtherDir.point : obstacleForFlying.point));
|
||||||
GetMatrix().GetPosition().z += FEET_OFFSET;
|
GetMatrix().GetPosition().z += FEET_OFFSET;
|
||||||
GetMatrix().UpdateRW();
|
GetMatrix().UpdateRW();
|
||||||
@ -10769,11 +10770,11 @@ CPed::ProcessControl(void)
|
|||||||
|
|
||||||
if (CWorld::ProcessVerticalLine(offsetToCheck, GetPosition().z - FEET_OFFSET, foundCol, foundEnt, true, true, false, true, false, false, nil)) {
|
if (CWorld::ProcessVerticalLine(offsetToCheck, GetPosition().z - FEET_OFFSET, foundCol, foundEnt, true, true, false, true, false, false, nil)) {
|
||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
if (!bSomeVCflag1 || FEET_OFFSET + foundCol.point.z < GetPosition().z) {
|
if (!bHeadStuckInCollision || FEET_OFFSET + foundCol.point.z < GetPosition().z) {
|
||||||
GetMatrix().GetPosition().z = FEET_OFFSET + foundCol.point.z;
|
GetMatrix().GetPosition().z = FEET_OFFSET + foundCol.point.z;
|
||||||
GetMatrix().UpdateRW();
|
GetMatrix().UpdateRW();
|
||||||
if (bSomeVCflag1)
|
if (bHeadStuckInCollision)
|
||||||
bSomeVCflag1 = false;
|
bHeadStuckInCollision = false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
GetMatrix().GetPosition().z = FEET_OFFSET + foundCol.point.z;
|
GetMatrix().GetPosition().z = FEET_OFFSET + foundCol.point.z;
|
||||||
@ -10843,15 +10844,15 @@ CPed::ProcessControl(void)
|
|||||||
if (IsPedInControl() && !bIsStanding && !m_pDamageEntity && CheckIfInTheAir()) {
|
if (IsPedInControl() && !bIsStanding && !m_pDamageEntity && CheckIfInTheAir()) {
|
||||||
SetInTheAir();
|
SetInTheAir();
|
||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
bSomeVCflag1 = false;
|
bHeadStuckInCollision = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
if (bSomeVCflag1) {
|
if (bHeadStuckInCollision) {
|
||||||
CVector posToCheck = GetPosition();
|
CVector posToCheck = GetPosition();
|
||||||
posToCheck.z += 0.9f;
|
posToCheck.z += 0.9f;
|
||||||
if (!CWorld::TestSphereAgainstWorld(posToCheck, 0.2f, this, true, true, false, true, false, false))
|
if (!CWorld::TestSphereAgainstWorld(posToCheck, 0.2f, this, true, true, false, true, false, false))
|
||||||
bSomeVCflag1 = false;
|
bHeadStuckInCollision = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ProcessObjective();
|
ProcessObjective();
|
||||||
@ -15339,10 +15340,10 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
|
|||||||
if (CCollision::IsStoredPolyStillValidVerticalLine(pos, potentialGroundZ, intersectionPoint, &m_collPoly)) {
|
if (CCollision::IsStoredPolyStillValidVerticalLine(pos, potentialGroundZ, intersectionPoint, &m_collPoly)) {
|
||||||
bStillOnValidPoly = true;
|
bStillOnValidPoly = true;
|
||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
if(!bSomeVCflag1 || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
|
if(!bHeadStuckInCollision || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
|
||||||
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
|
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
|
||||||
if (bSomeVCflag1)
|
if (bHeadStuckInCollision)
|
||||||
bSomeVCflag1 = false;
|
bHeadStuckInCollision = false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
|
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
|
||||||
@ -15417,10 +15418,10 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
if (!bSomeVCflag1 || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
|
if (!bHeadStuckInCollision || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
|
||||||
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
|
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
|
||||||
if (bSomeVCflag1)
|
if (bHeadStuckInCollision)
|
||||||
bSomeVCflag1 = false;
|
bHeadStuckInCollision = false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
|
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
|
||||||
@ -15507,7 +15508,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
|
|||||||
sphereNormal.x = -m_vecMoveSpeed.x / Max(0.001f, speed);
|
sphereNormal.x = -m_vecMoveSpeed.x / Max(0.001f, speed);
|
||||||
sphereNormal.y = -m_vecMoveSpeed.y / Max(0.001f, speed);
|
sphereNormal.y = -m_vecMoveSpeed.y / Max(0.001f, speed);
|
||||||
GetMatrix().GetPosition().z -= 0.05f;
|
GetMatrix().GetPosition().z -= 0.05f;
|
||||||
bSomeVCflag1 = true;
|
bHeadStuckInCollision = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
sphereNormal.Normalise();
|
sphereNormal.Normalise();
|
||||||
@ -16038,8 +16039,9 @@ CPed::SetSolicit(uint32 time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CPed::SetFollowPath(CVector dest)
|
CPed::SetFollowPath(CVector dest, float radius, eMoveState state, CEntity* pFollowedPed, CEntity*, int time)
|
||||||
{
|
{
|
||||||
|
// TODO(MIAMI): new follow
|
||||||
if (m_nPedState == PED_FOLLOW_PATH)
|
if (m_nPedState == PED_FOLLOW_PATH)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -418,9 +418,6 @@ public:
|
|||||||
uint32 bVehExitWillBeInstant : 1;
|
uint32 bVehExitWillBeInstant : 1;
|
||||||
uint32 bHasAlreadyBeenRecorded : 1;
|
uint32 bHasAlreadyBeenRecorded : 1;
|
||||||
uint32 bFallenDown : 1;
|
uint32 bFallenDown : 1;
|
||||||
#ifdef VC_PED_PORTS
|
|
||||||
uint32 bSomeVCflag1 : 1;
|
|
||||||
#endif
|
|
||||||
#ifdef PED_SKIN
|
#ifdef PED_SKIN
|
||||||
uint32 bDontAcceptIKLookAts : 1; // TODO: find uses of this
|
uint32 bDontAcceptIKLookAts : 1; // TODO: find uses of this
|
||||||
#endif
|
#endif
|
||||||
@ -433,6 +430,10 @@ public:
|
|||||||
uint32 bHasAlreadyUsedAttractor : 1; // 0x155 0x1
|
uint32 bHasAlreadyUsedAttractor : 1; // 0x155 0x1
|
||||||
uint32 bCarPassenger : 1; // 0x155 0x4
|
uint32 bCarPassenger : 1; // 0x155 0x4
|
||||||
uint32 bMiamiViceCop : 1; // 0x155 0x20
|
uint32 bMiamiViceCop : 1; // 0x155 0x20
|
||||||
|
uint32 bIsPlayerFriend : 1; // 0x156 0x10
|
||||||
|
#ifdef VC_PED_PORTS
|
||||||
|
uint32 bHeadStuckInCollision : 1; // 0x156 0x20
|
||||||
|
#endif
|
||||||
uint32 bDeadPedInFrontOfCar : 1; // 0x156 0x40
|
uint32 bDeadPedInFrontOfCar : 1; // 0x156 0x40
|
||||||
|
|
||||||
uint8 CharCreatedBy;
|
uint8 CharCreatedBy;
|
||||||
@ -666,7 +667,9 @@ public:
|
|||||||
void SetPointGunAt(CEntity*);
|
void SetPointGunAt(CEntity*);
|
||||||
bool Seek(void);
|
bool Seek(void);
|
||||||
bool SetWanderPath(int8);
|
bool SetWanderPath(int8);
|
||||||
bool SetFollowPath(CVector);
|
bool SetFollowPath(CVector dest, float radius, eMoveState state, CEntity*, CEntity*, int);
|
||||||
|
bool SetFollowPathStatic(void);
|
||||||
|
bool SetFollowPathDynamic(void);
|
||||||
void ClearAttackByRemovingAnim(void);
|
void ClearAttackByRemovingAnim(void);
|
||||||
void SetStoredState(void);
|
void SetStoredState(void);
|
||||||
void StopNonPartialAnims(void);
|
void StopNonPartialAnims(void);
|
||||||
@ -873,7 +876,12 @@ public:
|
|||||||
CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; }
|
CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; }
|
||||||
|
|
||||||
PedState GetPedState(void) { return m_nPedState; }
|
PedState GetPedState(void) { return m_nPedState; }
|
||||||
void SetPedState(PedState state) { m_nPedState = state; }
|
void SetPedState(PedState state)
|
||||||
|
{
|
||||||
|
if (GetPedState() == PED_FOLLOW_PATH)
|
||||||
|
ClearFollowPath();
|
||||||
|
m_nPedState = state;
|
||||||
|
}
|
||||||
bool Dead(void) { return m_nPedState == PED_DEAD; }
|
bool Dead(void) { return m_nPedState == PED_DEAD; }
|
||||||
bool Dying(void) { return m_nPedState == PED_DIE; }
|
bool Dying(void) { return m_nPedState == PED_DIE; }
|
||||||
bool DyingOrDead(void) { return m_nPedState == PED_DIE || m_nPedState == PED_DEAD; }
|
bool DyingOrDead(void) { return m_nPedState == PED_DIE || m_nPedState == PED_DEAD; }
|
||||||
|
@ -2853,6 +2853,7 @@ CAutomobile::ProcessBuoyancy(void)
|
|||||||
|
|
||||||
if(impulseRatio > 0.5f){
|
if(impulseRatio > 0.5f){
|
||||||
bIsInWater = true;
|
bIsInWater = true;
|
||||||
|
bIsDrowning = true;
|
||||||
if(m_vecMoveSpeed.z < -0.1f)
|
if(m_vecMoveSpeed.z < -0.1f)
|
||||||
m_vecMoveSpeed.z = -0.1f;
|
m_vecMoveSpeed.z = -0.1f;
|
||||||
|
|
||||||
@ -2867,8 +2868,11 @@ CAutomobile::ProcessBuoyancy(void)
|
|||||||
if(pPassengers[i]->IsPlayer() || !bWaterTight)
|
if(pPassengers[i]->IsPlayer() || !bWaterTight)
|
||||||
pPassengers[i]->InflictDamage(nil, WEAPONTYPE_DROWNING, CTimer::GetTimeStep(), PEDPIECE_TORSO, 0);
|
pPassengers[i]->InflictDamage(nil, WEAPONTYPE_DROWNING, CTimer::GetTimeStep(), PEDPIECE_TORSO, 0);
|
||||||
}
|
}
|
||||||
}else
|
}
|
||||||
|
else {
|
||||||
bIsInWater = false;
|
bIsInWater = false;
|
||||||
|
bIsDrowning = false;
|
||||||
|
}
|
||||||
|
|
||||||
static uint32 nGenerateRaindrops = 0;
|
static uint32 nGenerateRaindrops = 0;
|
||||||
static uint32 nGenerateWaterCircles = 0;
|
static uint32 nGenerateWaterCircles = 0;
|
||||||
@ -2950,6 +2954,7 @@ CAutomobile::ProcessBuoyancy(void)
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
bIsInWater = false;
|
bIsInWater = false;
|
||||||
|
bIsDrowning = false;
|
||||||
bTouchingWater = false;
|
bTouchingWater = false;
|
||||||
|
|
||||||
static RwRGBA splashCol = {155, 155, 185, 196};
|
static RwRGBA splashCol = {155, 155, 185, 196};
|
||||||
|
@ -273,9 +273,17 @@ CBoat::ProcessControl(void)
|
|||||||
if(0.1f * m_fMass * GRAVITY*CTimer::GetTimeStep() < buoyanceImpulse.z){
|
if(0.1f * m_fMass * GRAVITY*CTimer::GetTimeStep() < buoyanceImpulse.z){
|
||||||
bBoatInWater = true;
|
bBoatInWater = true;
|
||||||
bIsInWater = true;
|
bIsInWater = true;
|
||||||
|
if (GetUp().z < -0.6f && Abs(GetMoveSpeed().x) < 0.05 && Abs(GetMoveSpeed().y) < 0.05) {
|
||||||
|
bIsDrowning = true;
|
||||||
|
if (pDriver)
|
||||||
|
pDriver->InflictDamage(nil, WEAPONTYPE_DROWNING, CTimer::GetTimeStep(), PEDPIECE_TORSO, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
bIsDrowning = false;
|
||||||
}else{
|
}else{
|
||||||
bBoatInWater = false;
|
bBoatInWater = false;
|
||||||
bIsInWater = false;
|
bIsInWater = false;
|
||||||
|
bIsDrowning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fVolumeUnderWater = mod_Buoyancy.m_volumeUnderWater;
|
m_fVolumeUnderWater = mod_Buoyancy.m_volumeUnderWater;
|
||||||
@ -519,6 +527,7 @@ CBoat::ProcessControl(void)
|
|||||||
}else{
|
}else{
|
||||||
bBoatInWater = false;
|
bBoatInWater = false;
|
||||||
bIsInWater = false;
|
bIsInWater = false;
|
||||||
|
bIsDrowning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_bIsAnchored){
|
if(m_bIsAnchored){
|
||||||
|
@ -104,6 +104,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
|
|||||||
m_nCarHornPattern = 0;
|
m_nCarHornPattern = 0;
|
||||||
m_nCarHornDelay = 0;
|
m_nCarHornDelay = 0;
|
||||||
bPartOfConvoy = false;
|
bPartOfConvoy = false;
|
||||||
|
bIsDrowning = false;
|
||||||
bCreatedAsPoliceVehicle = false;
|
bCreatedAsPoliceVehicle = false;
|
||||||
bParking = false;
|
bParking = false;
|
||||||
m_nAlarmState = 0;
|
m_nAlarmState = 0;
|
||||||
|
@ -182,10 +182,16 @@ public:
|
|||||||
uint8 bVehicleColProcessed : 1;// Has ProcessEntityCollision been processed for this car?
|
uint8 bVehicleColProcessed : 1;// Has ProcessEntityCollision been processed for this car?
|
||||||
uint8 bIsCarParkVehicle : 1; // Car has been created using the special CAR_PARK script command
|
uint8 bIsCarParkVehicle : 1; // Car has been created using the special CAR_PARK script command
|
||||||
uint8 bHasAlreadyBeenRecorded : 1; // Used for replays
|
uint8 bHasAlreadyBeenRecorded : 1; // Used for replays
|
||||||
|
|
||||||
uint8 bPartOfConvoy : 1;
|
uint8 bPartOfConvoy : 1;
|
||||||
|
//uint8 bHeliMinimumTilt : 1; // This heli should have almost no tilt really
|
||||||
|
//uint8 bAudioChangingGear : 1; // sounds like vehicle is changing gear
|
||||||
|
|
||||||
|
uint8 bIsDrowning : 1; // is vehicle occupants taking damage in water (i.e. vehicle is dead in water)
|
||||||
|
//uint8 bTyresDontBurst : 1; // If this is set the tyres are invincible
|
||||||
uint8 bCreatedAsPoliceVehicle : 1;// True if this guy was created as a police vehicle (enforcer, policecar, miamivice car etc)
|
uint8 bCreatedAsPoliceVehicle : 1;// True if this guy was created as a police vehicle (enforcer, policecar, miamivice car etc)
|
||||||
|
//uint8 bRestingOnPhysical : 1; // Dont go static cause car is sitting on a physical object that might get removed
|
||||||
uint8 bParking : 1;
|
uint8 bParking : 1;
|
||||||
|
//uint8 bCanPark : 1;
|
||||||
|
|
||||||
uint8 m_bombType : 3;
|
uint8 m_bombType : 3;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user