mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-23 01:29:16 +01:00
Merge branch 'master' of git://github.com/GTAmodding/re3 into erorcun
This commit is contained in:
commit
06ed308bb1
@ -72,8 +72,8 @@ public:
|
||||
int8 m_nPreviousDirection;
|
||||
int8 m_nCurrentDirecton;
|
||||
int8 m_nNextDirection;
|
||||
int8 m_nPreviousPathDirection;
|
||||
int8 m_nCurrentPathDirection;
|
||||
int8 m_nPreviousLane;
|
||||
int8 m_nCurrentLane;
|
||||
eCarDrivingStyle m_nDrivingStyle;
|
||||
eCarMission m_nCarMission;
|
||||
eCarTempAction m_nAnimationId;
|
||||
@ -101,8 +101,7 @@ public:
|
||||
m_nCurrentPathNodeInfo = m_nNextPathNodeInfo;
|
||||
m_nNextDirection = 1;
|
||||
m_nCurrentDirecton = m_nNextDirection;
|
||||
m_nCurrentPathDirection = 0;
|
||||
m_nPreviousPathDirection = m_nCurrentPathDirection;
|
||||
m_nPreviousLane = m_nCurrentLane = 0;
|
||||
m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||
m_nCarMission = MISSION_NONE;
|
||||
m_nAnimationId = TEMPACT_NONE;
|
||||
|
5
src/control/CarAI.cpp
Normal file
5
src/control/CarAI.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "CarAI.h"
|
||||
|
||||
WRAPPER void CCarAI::UpdateCarAI(CVehicle*) { EAXJMP(0x413E50); }
|
9
src/control/CarAI.h
Normal file
9
src/control/CarAI.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
class CVehicle;
|
||||
|
||||
class CCarAI
|
||||
{
|
||||
public:
|
||||
static void UpdateCarAI(CVehicle*);
|
||||
};
|
@ -12,3 +12,7 @@ WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0);
|
||||
WRAPPER void CCarCtrl::AddToCarArray(int32 id, int32 vehclass) { EAXJMP(0x4182F0); }
|
||||
WRAPPER void CCarCtrl::UpdateCarCount(CVehicle*, bool) { EAXJMP(0x4202E0); }
|
||||
WRAPPER int32 CCarCtrl::ChooseCarModel(int32 vehclass) { EAXJMP(0x418110); }
|
||||
WRAPPER bool CCarCtrl::JoinCarWithRoadSystemGotoCoors(CVehicle*, CVector, bool) { EAXJMP(0x41FA00); }
|
||||
WRAPPER void CCarCtrl::JoinCarWithRoadSystem(CVehicle*) { EAXJMP(0x41F820); }
|
||||
WRAPPER void CCarCtrl::SteerAICarWithPhysics(CVehicle*) { EAXJMP(0x41DA60); }
|
||||
WRAPPER void CCarCtrl::UpdateCarOnRails(CVehicle*) { EAXJMP(0x418880); }
|
||||
|
@ -9,6 +9,10 @@ public:
|
||||
static void AddToCarArray(int32 id, int32 vehclass);
|
||||
static void UpdateCarCount(CVehicle*, bool);
|
||||
static int32 ChooseCarModel(int32 vehclass);
|
||||
static bool JoinCarWithRoadSystemGotoCoors(CVehicle*, CVector, bool);
|
||||
static void JoinCarWithRoadSystem(CVehicle*);
|
||||
static void SteerAICarWithPhysics(CVehicle*);
|
||||
static void UpdateCarOnRails(CVehicle*);
|
||||
|
||||
static int32 &NumLawEnforcerCars;
|
||||
static int32 &NumAmbulancesOnDuty;
|
||||
|
@ -63,6 +63,8 @@ CGarages::IsModelIndexADoor(uint32 id)
|
||||
id == MI_CRUSHERLID;
|
||||
}
|
||||
|
||||
WRAPPER void CGarages::TriggerMessage(char *text, int16, uint16 time, int16) { EAXJMP(0x426B20); }
|
||||
|
||||
#if 0
|
||||
WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
|
||||
#else
|
||||
|
@ -22,5 +22,6 @@ public:
|
||||
|
||||
public:
|
||||
static bool IsModelIndexADoor(uint32 id);
|
||||
static void TriggerMessage(char *text, int16, uint16 time, int16);
|
||||
static void PrintMessages(void);
|
||||
};
|
||||
|
@ -7,7 +7,9 @@ PedGroup *CPopulation::ms_pPedGroups = (PedGroup*)0x6E9248;
|
||||
bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6;
|
||||
int32 &CPopulation::m_AllRandomPedsThisType = *(int32*)0x5FA570;
|
||||
float &CPopulation::PedDensityMultiplier = *(float*)0x5FA56C;
|
||||
uint32 &CPopulation::ms_nTotalMissionPeds = *(uint32*)0x8F5F70;
|
||||
|
||||
WRAPPER void CPopulation::UpdatePedCount(uint32, bool) { EAXJMP(0x4F5A60); }
|
||||
WRAPPER void CPopulation::DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool) { EAXJMP(0x4F6200); }
|
||||
WRAPPER CPed *CPopulation::AddPedInCar(CVehicle *vehicle) { EAXJMP(0x4F5800); }
|
||||
WRAPPER bool CPopulation::IsPointInSafeZone(CVector *coors) { EAXJMP(0x4F60C0); }
|
||||
|
@ -15,8 +15,10 @@ public:
|
||||
static bool &ms_bGivePedsWeapons;
|
||||
static int32 &m_AllRandomPedsThisType;
|
||||
static float &PedDensityMultiplier;
|
||||
static uint32 &ms_nTotalMissionPeds;
|
||||
|
||||
static void UpdatePedCount(uint32, bool);
|
||||
static void DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool);
|
||||
static CPed *AddPedInCar(CVehicle *vehicle);
|
||||
static bool IsPointInSafeZone(CVector *coors);
|
||||
};
|
||||
|
5
src/control/Remote.cpp
Normal file
5
src/control/Remote.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "Remote.h"
|
||||
|
||||
WRAPPER void CRemote::TakeRemoteControlledCarFromPlayer(void) { EAXJMP(0x435DA0); }
|
7
src/control/Remote.h
Normal file
7
src/control/Remote.h
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
class CRemote
|
||||
{
|
||||
public:
|
||||
static void TakeRemoteControlledCarFromPlayer(void);
|
||||
};
|
@ -4,10 +4,17 @@
|
||||
#include "Script.h"
|
||||
#include "ScriptCommands.h"
|
||||
|
||||
#include "Boat.h"
|
||||
#include "Camera.h"
|
||||
#include "CarCtrl.h"
|
||||
#include "CivilianPed.h"
|
||||
#include "Clock.h"
|
||||
#include "CopPed.h"
|
||||
#include "DMAudio.h"
|
||||
#include "EmergencyPed.h"
|
||||
#include "FileMgr.h"
|
||||
#include "General.h"
|
||||
#include "HandlingMgr.h"
|
||||
#include "Hud.h"
|
||||
#include "Messages.h"
|
||||
#include "ModelIndices.h"
|
||||
@ -18,9 +25,11 @@
|
||||
#include "Population.h"
|
||||
#include "Replay.h"
|
||||
#include "Streaming.h"
|
||||
#include "Text.h"
|
||||
#include "User.h"
|
||||
#include "Weather.h"
|
||||
#include "World.h"
|
||||
#include "Zones.h"
|
||||
|
||||
uint8 (&CTheScripts::ScriptSpace)[SIZE_SCRIPT_SPACE] = *(uint8(*)[SIZE_SCRIPT_SPACE])*(uintptr*)0x74B248;
|
||||
CRunningScript(&CTheScripts::ScriptsArray)[MAX_NUM_SCRIPTS] = *(CRunningScript(*)[MAX_NUM_SCRIPTS])*(uintptr*)0x6F5C08;
|
||||
@ -701,7 +710,7 @@ int8 CRunningScript::ProcessCommandsFrom0To99(int32 command)
|
||||
return 0;
|
||||
case COMMAND_SHAKE_CAM:
|
||||
CollectParameters(&m_nIp, 1);
|
||||
TheCamera.CamShake(ScriptParams[0] / 1000.0f);
|
||||
CamShakeNoPos(&TheCamera, ScriptParams[0] / 1000.0f);
|
||||
return 0;
|
||||
case COMMAND_SET_VAR_INT:
|
||||
{
|
||||
@ -1342,6 +1351,7 @@ int8 CRunningScript::ProcessCommandsFrom0To99(int32 command)
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
@ -1374,7 +1384,813 @@ void CRunningScript::UpdateCompareFlag(bool flag)
|
||||
}
|
||||
|
||||
|
||||
WRAPPER int8 CRunningScript::ProcessCommandsFrom100To199(int32 command) { EAXJMP(0x43AEA0); }
|
||||
int8 CRunningScript::ProcessCommandsFrom100To199(int32 command)
|
||||
{
|
||||
switch (command) {
|
||||
case COMMAND_SUB_INT_LVAR_FROM_INT_VAR:
|
||||
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) -= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_SUB_INT_VAR_FROM_INT_LVAR:
|
||||
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_SUB_FLOAT_LVAR_FROM_FLOAT_VAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_SUB_FLOAT_VAR_FROM_FLOAT_LVAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_MULT_INT_VAR_BY_INT_VAR:
|
||||
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_MULT_INT_LVAR_BY_INT_VAR:
|
||||
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) *= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_MULT_INT_VAR_BY_INT_LVAR:
|
||||
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_MULT_INT_LVAR_BY_INT_LVAR:
|
||||
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) *= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_VAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_LVAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_DIV_INT_VAR_BY_INT_VAR:
|
||||
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_DIV_INT_LVAR_BY_INT_VAR:
|
||||
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) /= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_DIV_INT_VAR_BY_INT_LVAR:
|
||||
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_DIV_INT_LVAR_BY_INT_LVAR:
|
||||
*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) /= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_VAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_LVAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_ADD_TIMED_VAL_TO_FLOAT_VAR:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
CollectParameters(&m_nIp, 1);
|
||||
*(float*)ptr += CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_ADD_TIMED_VAL_TO_FLOAT_LVAR:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
CollectParameters(&m_nIp, 1);
|
||||
*(float*)ptr += CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_LVAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_SUB_TIMED_VAL_FROM_FLOAT_VAR:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
CollectParameters(&m_nIp, 1);
|
||||
*(float*)ptr -= CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SUB_TIMED_VAL_FROM_FLOAT_LVAR:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
CollectParameters(&m_nIp, 1);
|
||||
*(float*)ptr -= CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_LVAR:
|
||||
*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL) -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
case COMMAND_SET_VAR_INT_TO_VAR_INT:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_LVAR_INT_TO_VAR_INT:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_VAR_INT_TO_LVAR_INT:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_LVAR_INT_TO_LVAR_INT:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_VAR_FLOAT_TO_VAR_FLOAT:
|
||||
{
|
||||
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT:
|
||||
{
|
||||
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT:
|
||||
{
|
||||
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_LVAR_FLOAT_TO_LVAR_FLOAT:
|
||||
{
|
||||
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CSET_VAR_INT_TO_VAR_FLOAT:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CSET_VAR_FLOAT_TO_VAR_INT:
|
||||
{
|
||||
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT:
|
||||
{
|
||||
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT:
|
||||
{
|
||||
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT:
|
||||
{
|
||||
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_ABS_VAR_INT:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
*ptr = ABS(*ptr);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_ABS_LVAR_INT:
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
*ptr = ABS(*ptr);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_ABS_VAR_FLOAT:
|
||||
{
|
||||
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
*ptr = ABS(*ptr);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_ABS_LVAR_FLOAT:
|
||||
{
|
||||
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
||||
*ptr = ABS(*ptr);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_GENERATE_RANDOM_FLOAT:
|
||||
{
|
||||
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
CGeneral::GetRandomNumber();
|
||||
CGeneral::GetRandomNumber();
|
||||
CGeneral::GetRandomNumber(); /* To make it EXTRA random! */
|
||||
*ptr = CGeneral::GetRandomNumber() / 65536.0f;
|
||||
/* Between 0 and 0.5 on PC (oh well...), never used in original script. */
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_GENERATE_RANDOM_INT:
|
||||
/* On PC between 0 and 32767, even though script expects values between 0 and 65536 */
|
||||
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) = CGeneral::GetRandomNumber();
|
||||
return 0;
|
||||
case COMMAND_CREATE_CHAR:
|
||||
{
|
||||
CollectParameters(&m_nIp, 5);
|
||||
switch (ScriptParams[1]) {
|
||||
case MI_COP:
|
||||
if (ScriptParams[0] = PEDTYPE_COP)
|
||||
ScriptParams[1] = COP_STREET;
|
||||
break;
|
||||
case MI_SWAT:
|
||||
if (ScriptParams[0] = PEDTYPE_COP)
|
||||
ScriptParams[1] = COP_SWAT;
|
||||
break;
|
||||
case MI_FBI:
|
||||
if (ScriptParams[0] = PEDTYPE_COP)
|
||||
ScriptParams[1] = COP_FBI;
|
||||
break;
|
||||
case MI_ARMY:
|
||||
if (ScriptParams[0] = PEDTYPE_COP)
|
||||
ScriptParams[1] = COP_ARMY;
|
||||
break;
|
||||
case MI_MEDIC:
|
||||
if (ScriptParams[0] = PEDTYPE_EMERGENCY)
|
||||
ScriptParams[1] = PEDTYPE_EMERGENCY;
|
||||
break;
|
||||
case MI_FIREMAN:
|
||||
if (ScriptParams[0] = PEDTYPE_FIREMAN)
|
||||
ScriptParams[1] = PEDTYPE_FIREMAN;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
CPed* ped;
|
||||
if (ScriptParams[0] == PEDTYPE_COP)
|
||||
ped = new CCopPed((eCopType)ScriptParams[1]);
|
||||
else if (ScriptParams[0] == PEDTYPE_EMERGENCY || ScriptParams[0] == PEDTYPE_FIREMAN)
|
||||
ped = new CEmergencyPed(ScriptParams[1]);
|
||||
else
|
||||
ped = new CCivilianPed(ScriptParams[0], ScriptParams[1]);
|
||||
ped->CharCreatedBy = MISSION_CHAR;
|
||||
ped->bRespondsToThreats = false;
|
||||
ped->m_ped_flagG2 = false;
|
||||
CVector pos = *(CVector*)&ScriptParams[2];
|
||||
if (pos.z <= -100.0f)
|
||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||
pos.z += 1.0f;
|
||||
ped->GetPosition() = pos;
|
||||
ped->SetOrientation(0.0f, 0.0f, 0.0f);
|
||||
CTheScripts::ClearSpaceForMissionEntity(pos, ped);
|
||||
CWorld::Add(ped);
|
||||
ped->m_level = CTheZones::GetLevelFromPosition(pos);
|
||||
CPopulation::ms_nTotalMissionPeds++;
|
||||
ScriptParams[0] = CPools::GetPedPool()->GetIndex(ped);
|
||||
StoreParameters(&m_nIp, 1);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_DELETE_CHAR:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||
if (ped) {
|
||||
if (ped->bInVehicle && ped->m_pMyVehicle) {
|
||||
if (ped->m_pMyVehicle->pDriver == ped) {
|
||||
ped->m_pMyVehicle->RemoveDriver();
|
||||
ped->m_pMyVehicle->m_status = 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)
|
||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CHAR_WANDER_DIR:
|
||||
{
|
||||
CollectParameters(&m_nIp, 2);
|
||||
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||
assert(ped);
|
||||
ped->ClearAll();
|
||||
int8 path = ScriptParams[1];
|
||||
if (ScriptParams[1] < 0 || ScriptParams[1] > 7)
|
||||
path = CGeneral::GetRandomNumberInRange(0, 7);
|
||||
ped->SetWanderPath(path);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CHAR_FOLLOW_PATH:
|
||||
{
|
||||
CollectParameters(&m_nIp, 4);
|
||||
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||
assert(ped);
|
||||
CVector pos = *(CVector*)&ScriptParams[1];
|
||||
if (pos.z <= -100.0f)
|
||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||
ped->ClearAll();
|
||||
ped->SetFollowPath(pos);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CHAR_SET_IDLE:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||
assert(ped);
|
||||
ped->m_bScriptObjectiveCompleted = false;
|
||||
ped->SetObjective(OBJECTIVE_IDLE);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_GET_CHAR_COORDINATES:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||
assert(ped);
|
||||
CVehicle* vehicle;
|
||||
CVector pos;
|
||||
/* Seems a bit clumsy but I'll leave original flow */
|
||||
if (ped->bInVehicle)
|
||||
vehicle = ped->m_pMyVehicle;
|
||||
else
|
||||
vehicle = nil;
|
||||
if (vehicle)
|
||||
pos = vehicle->GetPosition();
|
||||
else
|
||||
pos = ped->GetPosition();
|
||||
*(CVector*)&ScriptParams[0] = pos;
|
||||
StoreParameters(&m_nIp, 3);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_CHAR_COORDINATES:
|
||||
{
|
||||
CollectParameters(&m_nIp, 4);
|
||||
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||
assert(ped);
|
||||
CVehicle* vehicle;
|
||||
if (ped->bInVehicle)
|
||||
vehicle = ped->m_pMyVehicle;
|
||||
else
|
||||
vehicle = nil;
|
||||
CVector pos = *(CVector*)&ScriptParams[1];
|
||||
if (pos.z <= -100.0f)
|
||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||
/* The following block was once again written
|
||||
* 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) {
|
||||
pos.z += ped->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||
ped->Teleport(pos);
|
||||
CTheScripts::ClearSpaceForMissionEntity(pos, ped);
|
||||
}
|
||||
else if (vehicle->IsBoat()) {
|
||||
pos.z += vehicle->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||
vehicle->Teleport(pos);
|
||||
CTheScripts::ClearSpaceForMissionEntity(pos, vehicle);
|
||||
}
|
||||
else {
|
||||
pos.z += vehicle->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||
vehicle->Teleport(pos);
|
||||
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 <= -100.0f)
|
||||
* pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||
* pos.z += entityToMove->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||
* entityToMove->Teleport(pos);
|
||||
* CTheScripts::ClearSpaceForMissionEntity(pos, entityToMove);
|
||||
*
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_CHAR_STILL_ALIVE:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||
UpdateCompareFlag(ped && ped->m_status != PED_DEAD && ped->m_status != PED_DIE);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_CHAR_IN_AREA_2D:
|
||||
{
|
||||
CollectParameters(&m_nIp, 6);
|
||||
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||
assert(ped);
|
||||
CVehicle* vehicle;
|
||||
if (ped->bInVehicle)
|
||||
vehicle = ped->m_pMyVehicle;
|
||||
else
|
||||
vehicle = nil;
|
||||
float x1, y1, x2, y2;
|
||||
x1 = *(float*)&ScriptParams[1];
|
||||
y1 = *(float*)&ScriptParams[2];
|
||||
x2 = *(float*)&ScriptParams[3];
|
||||
y2 = *(float*)&ScriptParams[4];
|
||||
if (vehicle)
|
||||
UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, x2, y2));
|
||||
else
|
||||
UpdateCompareFlag(ped->IsWithinArea(x1, y1, x2, y2));
|
||||
CTheScripts::HighlightImportantArea((uint32)this + m_nIp, x1, y1, x2, y2, -100.0f);
|
||||
if (CTheScripts::DbgFlag)
|
||||
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_CHAR_IN_AREA_3D:
|
||||
{
|
||||
CollectParameters(&m_nIp, 8);
|
||||
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||
assert(ped);
|
||||
CVehicle* vehicle;
|
||||
if (ped->bInVehicle)
|
||||
vehicle = ped->m_pMyVehicle;
|
||||
else
|
||||
vehicle = nil;
|
||||
float x1, y1, z1, x2, y2, z2;
|
||||
x1 = *(float*)&ScriptParams[1];
|
||||
y1 = *(float*)&ScriptParams[2];
|
||||
z1 = *(float*)&ScriptParams[3];
|
||||
x2 = *(float*)&ScriptParams[4];
|
||||
y2 = *(float*)&ScriptParams[5];
|
||||
z2 = *(float*)&ScriptParams[6];
|
||||
if (vehicle)
|
||||
UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
|
||||
else
|
||||
UpdateCompareFlag(ped->IsWithinArea(x1, y1, z1, x2, y2, z2));
|
||||
CTheScripts::HighlightImportantArea((uint32)this + m_nIp, x1, y1, x2, y2, -100.0f);
|
||||
if (CTheScripts::DbgFlag)
|
||||
CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CREATE_CAR:
|
||||
{
|
||||
CollectParameters(&m_nIp, 4);
|
||||
int32 handle;
|
||||
if (CModelInfo::IsBoatModel(ScriptParams[0])) {
|
||||
CBoat* boat = new CBoat(ScriptParams[0], MISSION_VEHICLE);
|
||||
CVector pos = *(CVector*)&ScriptParams[1];
|
||||
if (pos.z <= -100.0f)
|
||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||
pos.z += boat->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||
boat->GetPosition() = pos;
|
||||
CTheScripts::ClearSpaceForMissionEntity(pos, boat);
|
||||
boat->m_status = STATUS_ABANDONED;
|
||||
boat->bIsLocked = true;
|
||||
boat->AutoPilot.m_nCarMission = MISSION_NONE;
|
||||
boat->AutoPilot.m_nAnimationId = TEMPACT_NONE; /* Animation ID? */
|
||||
boat->AutoPilot.m_nCruiseSpeed = boat->AutoPilot.m_fMaxTrafficSpeed = 20.0f;
|
||||
CWorld::Add(boat);
|
||||
handle = CPools::GetVehiclePool()->GetIndex(boat);
|
||||
}
|
||||
else {
|
||||
CVehicle* car;
|
||||
if (!CModelInfo::IsBikeModel(ScriptParams[0]))
|
||||
car = new CAutomobile(ScriptParams[0], MISSION_VEHICLE);
|
||||
CVector pos = *(CVector*)&ScriptParams[1];
|
||||
if (pos.z <= -100.0f)
|
||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||
car->GetPosition() = pos;
|
||||
CTheScripts::ClearSpaceForMissionEntity(pos, car);
|
||||
car->m_status = STATUS_ABANDONED;
|
||||
car->bIsLocked = true;
|
||||
car->AutoPilot.m_nCarMission = MISSION_NONE;
|
||||
car->AutoPilot.m_nAnimationId = TEMPACT_NONE; /* Animation ID? */
|
||||
car->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||
car->AutoPilot.m_nCruiseSpeed = car->AutoPilot.m_fMaxTrafficSpeed = 9.0f;
|
||||
car->AutoPilot.m_nPreviousLane = car->AutoPilot.m_nCurrentLane = 0;
|
||||
car->bEngineOn = false;
|
||||
car->m_level = CTheZones::GetLevelFromPosition(pos);
|
||||
car->bHasBeenOwnedByPlayer = true;
|
||||
CWorld::Add(car);
|
||||
handle = CPools::GetVehiclePool()->GetIndex(car);
|
||||
}
|
||||
ScriptParams[0] = handle;
|
||||
StoreParameters(&m_nIp, 1);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(handle, CLEANUP_CAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_DELETE_CAR:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
if (car) {
|
||||
CWorld::Remove(car);
|
||||
CWorld::RemoveReferencesToDeletedObject(car);
|
||||
delete car;
|
||||
}
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CAR_GOTO_COORDINATES:
|
||||
{
|
||||
CollectParameters(&m_nIp, 4);
|
||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
assert(car);
|
||||
CVector pos = *(CVector*)&ScriptParams[1];
|
||||
if (pos.z <= -100.0f)
|
||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||
if (CCarCtrl::JoinCarWithRoadSystemGotoCoors(car, pos, false))
|
||||
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
|
||||
else
|
||||
car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS;
|
||||
car->m_status = STATUS_PHYSICS;
|
||||
car->bEngineOn = true;
|
||||
car->AutoPilot.m_nCruiseSpeed = max(car->AutoPilot.m_nCruiseSpeed, 6);
|
||||
car->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CAR_WANDER_RANDOMLY:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
assert(car);
|
||||
CCarCtrl::JoinCarWithRoadSystem(car);
|
||||
car->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||
car->bEngineOn = true;
|
||||
car->AutoPilot.m_nCruiseSpeed = max(car->AutoPilot.m_nCruiseSpeed, 6);
|
||||
car->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CAR_SET_IDLE:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
assert(car);
|
||||
car->AutoPilot.m_nCarMission = MISSION_NONE;
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_GET_CAR_COORDINATES:
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
assert(car);
|
||||
*(CVector*)&ScriptParams[0] = car->GetPosition();
|
||||
StoreParameters(&m_nIp, 3);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_CAR_COORDINATES:
|
||||
{
|
||||
CollectParameters(&m_nIp, 4);
|
||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
assert(car);
|
||||
CVector pos = *(CVector*)&ScriptParams[1];
|
||||
if (pos.z <= -100.0f)
|
||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||
car->bIsStatic = false;
|
||||
/* Again weird usage of virtual functions. */
|
||||
if (car->IsBoat()) {
|
||||
car->Teleport(pos);
|
||||
CTheScripts::ClearSpaceForMissionEntity(pos, car);
|
||||
}
|
||||
else {
|
||||
car->Teleport(pos);
|
||||
CTheScripts::ClearSpaceForMissionEntity(pos, car);
|
||||
/* May the following be inlined CCarCtrl function? */
|
||||
switch (car->AutoPilot.m_nCarMission) {
|
||||
case MISSION_CRUISE:
|
||||
CCarCtrl::JoinCarWithRoadSystem(car);
|
||||
break;
|
||||
case MISSION_RAMPLAYER_FARAWAY:
|
||||
case MISSION_RAMPLAYER_CLOSE:
|
||||
case MISSION_BLOCKPLAYER_FARAWAY:
|
||||
case MISSION_BLOCKPLAYER_CLOSE:
|
||||
case MISSION_BLOCKPLAYER_HANDBRAKESTOP:
|
||||
CCarCtrl::JoinCarWithRoadSystemGotoCoors(car, FindPlayerCoors(), false);
|
||||
break;
|
||||
case MISSION_GOTOCOORDS:
|
||||
case MISSION_GOTOCOORDS_STRAIGHT:
|
||||
CCarCtrl::JoinCarWithRoadSystemGotoCoors(car, car->AutoPilot.m_vecDestinationCoors, false);
|
||||
break;
|
||||
case MISSION_GOTOCOORDS_ACCURATE:
|
||||
case MISSION_GOTO_COORDS_STRAIGHT_ACCURATE:
|
||||
CCarCtrl::JoinCarWithRoadSystemGotoCoors(car, car->AutoPilot.m_vecDestinationCoors, false);
|
||||
break;
|
||||
case MISSION_RAMCAR_FARAWAY:
|
||||
case MISSION_RAMCAR_CLOSE:
|
||||
case MISSION_BLOCKCAR_FARAWAY:
|
||||
case MISSION_BLOCKCAR_CLOSE:
|
||||
case MISSION_BLOCKCAR_HANDBRAKESTOP:
|
||||
CCarCtrl::JoinCarWithRoadSystemGotoCoors(car, car->AutoPilot.m_pTargetCar->GetPosition(), false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_CAR_STILL_ALIVE:
|
||||
{
|
||||
CollectParameters(&m_nIp, 4);
|
||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
UpdateCompareFlag(car && car->m_status != STATUS_WRECKED && (car->IsBoat() || !car->bIsInWater));
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_CAR_CRUISE_SPEED:
|
||||
{
|
||||
CollectParameters(&m_nIp, 2);
|
||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
assert(car);
|
||||
car->AutoPilot.m_nCruiseSpeed = min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_CAR_DRIVING_STYLE:
|
||||
{
|
||||
CollectParameters(&m_nIp, 2);
|
||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
assert(car);
|
||||
car->AutoPilot.m_nDrivingStyle = (eCarDrivingStyle)ScriptParams[1];
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_CAR_MISSION:
|
||||
{
|
||||
CollectParameters(&m_nIp, 2);
|
||||
CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
assert(car);
|
||||
car->AutoPilot.m_nCarMission = (eCarMission)ScriptParams[1];
|
||||
car->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
||||
car->bEngineOn = true;
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_CAR_IN_AREA_2D:
|
||||
{
|
||||
CollectParameters(&m_nIp, 6);
|
||||
CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
assert(vehicle);
|
||||
float x1, y1, x2, y2;
|
||||
x1 = *(float*)&ScriptParams[1];
|
||||
y1 = *(float*)&ScriptParams[2];
|
||||
x2 = *(float*)&ScriptParams[3];
|
||||
y2 = *(float*)&ScriptParams[4];
|
||||
UpdateCompareFlag(vehicle->IsWithinArea(x1, y1, x2, y2));
|
||||
CTheScripts::HighlightImportantArea((uint32)this + m_nIp, x1, y1, x2, y2, -100.0f);
|
||||
if (CTheScripts::DbgFlag)
|
||||
CTheScripts::DrawDebugSquare(x1, y1, x2, y2);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_CAR_IN_AREA_3D:
|
||||
{
|
||||
CollectParameters(&m_nIp, 8);
|
||||
CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
assert(vehicle);
|
||||
float x1, y1, z1, x2, y2, z2;
|
||||
x1 = *(float*)&ScriptParams[1];
|
||||
y1 = *(float*)&ScriptParams[2];
|
||||
z1 = *(float*)&ScriptParams[3];
|
||||
x2 = *(float*)&ScriptParams[4];
|
||||
y2 = *(float*)&ScriptParams[5];
|
||||
z2 = *(float*)&ScriptParams[6];
|
||||
UpdateCompareFlag(vehicle->IsWithinArea(x1, y1, z1, x2, y2, z2));
|
||||
CTheScripts::HighlightImportantArea((uint32)this + m_nIp, x1, y1, x2, y2, -100.0f);
|
||||
if (CTheScripts::DbgFlag)
|
||||
CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SPECIAL_0:
|
||||
case COMMAND_SPECIAL_1:
|
||||
case COMMAND_SPECIAL_2:
|
||||
case COMMAND_SPECIAL_3:
|
||||
case COMMAND_SPECIAL_4:
|
||||
case COMMAND_SPECIAL_5:
|
||||
case COMMAND_SPECIAL_6:
|
||||
case COMMAND_SPECIAL_7:
|
||||
assert(0);
|
||||
return 0;
|
||||
case COMMAND_PRINT_BIG:
|
||||
{
|
||||
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
|
||||
m_nIp += 8;
|
||||
CollectParameters(&m_nIp, 2);
|
||||
CMessages::AddBigMessage(key, ScriptParams[0], ScriptParams[1] - 1);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_PRINT:
|
||||
{
|
||||
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
|
||||
m_nIp += 8;
|
||||
CollectParameters(&m_nIp, 2);
|
||||
CMessages::AddMessage(key, ScriptParams[0], ScriptParams[1]);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_PRINT_NOW:
|
||||
{
|
||||
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
|
||||
m_nIp += 8;
|
||||
CollectParameters(&m_nIp, 2);
|
||||
CMessages::AddMessageJumpQ(key, ScriptParams[0], ScriptParams[1]);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_PRINT_SOON:
|
||||
{
|
||||
wchar* key = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
|
||||
m_nIp += 8;
|
||||
CollectParameters(&m_nIp, 2);
|
||||
CMessages::AddMessage(key, ScriptParams[0], ScriptParams[1]);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CLEAR_PRINTS:
|
||||
CMessages::ClearMessages();
|
||||
return 0;
|
||||
case COMMAND_GET_TIME_OF_DAY:
|
||||
ScriptParams[0] = CClock::GetHours();
|
||||
ScriptParams[1] = CClock::GetMinutes();
|
||||
StoreParameters(&m_nIp, 2);
|
||||
return 0;
|
||||
case COMMAND_SET_TIME_OF_DAY:
|
||||
CollectParameters(&m_nIp, 2);
|
||||
CClock::SetGameClock(ScriptParams[0], ScriptParams[1]);
|
||||
return 0;
|
||||
case COMMAND_GET_MINUTES_TO_TIME_OF_DAY:
|
||||
CollectParameters(&m_nIp, 2);
|
||||
ScriptParams[0] = CClock::GetGameClockMinutesUntil(ScriptParams[0], ScriptParams[1]);
|
||||
StoreParameters(&m_nIp, 1);
|
||||
return 0;
|
||||
case COMMAND_IS_POINT_ON_SCREEN:
|
||||
{
|
||||
CollectParameters(&m_nIp, 4);
|
||||
CVector pos = *(CVector*)&ScriptParams[0];
|
||||
if (pos.z <= -100)
|
||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||
UpdateCompareFlag(TheCamera.IsSphereVisible(pos, *(float*)&ScriptParams[3]));
|
||||
}
|
||||
case COMMAND_DEBUG_ON:
|
||||
CTheScripts::DbgFlag = true;
|
||||
return 0;
|
||||
case COMMAND_DEBUG_OFF:
|
||||
CTheScripts::DbgFlag = false;
|
||||
return 0;
|
||||
case COMMAND_RETURN_TRUE:
|
||||
UpdateCompareFlag(true);
|
||||
return 0;
|
||||
case COMMAND_RETURN_FALSE:
|
||||
UpdateCompareFlag(false);
|
||||
return 0;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
WRAPPER int8 CRunningScript::ProcessCommandsFrom200To299(int32 command) { EAXJMP(0x43D530); }
|
||||
WRAPPER int8 CRunningScript::ProcessCommandsFrom300To399(int32 command) { EAXJMP(0x43ED30); }
|
||||
WRAPPER int8 CRunningScript::ProcessCommandsFrom400To499(int32 command) { EAXJMP(0x440CB0); }
|
||||
|
@ -23,7 +23,7 @@ WRAPPER void CCamera::DrawBordersForWideScreen(void) { EAXJMP(0x46B430); }
|
||||
WRAPPER void CCamera::CalculateDerivedValues(void) { EAXJMP(0x46EEA0); }
|
||||
WRAPPER void CCamera::Restore(void) { EAXJMP(0x46F990); }
|
||||
WRAPPER void CCamera::SetWidescreenOff(void) { EAXJMP(0x46FF10); }
|
||||
WRAPPER void CCamera::CamShake(float) { EAXJMP(0x46B100); }
|
||||
WRAPPER void CamShakeNoPos(CCamera*, float) { EAXJMP(0x46B100); }
|
||||
|
||||
bool
|
||||
CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat)
|
||||
@ -40,6 +40,13 @@ CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CCamera::IsSphereVisible(const CVector ¢er, float radius)
|
||||
{
|
||||
CMatrix mat = m_cameraMatrix;
|
||||
return IsSphereVisible(center, radius, &mat);
|
||||
}
|
||||
|
||||
bool
|
||||
CCamera::IsPointVisible(const CVector ¢er, const CMatrix *mat)
|
||||
{
|
||||
@ -1290,7 +1297,7 @@ CCam::GetWeaponFirstPersonOn()
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x42C760, &CCamera::IsSphereVisible, PATCH_JUMP);
|
||||
InjectHook(0x42C760, (bool (CCamera::*)(const CVector ¢er, float radius, const CMatrix *mat))&CCamera::IsSphereVisible, PATCH_JUMP);
|
||||
InjectHook(0x46FD00, &CCamera::SetFadeColour, PATCH_JUMP);
|
||||
|
||||
InjectHook(0x46FD40, &CCamera::SetMotionBlur, PATCH_JUMP);
|
||||
|
@ -445,6 +445,7 @@ int m_iModeObbeCamIsInForCar;
|
||||
CVector &GetGameCamPosition(void) { return m_vecGameCamPos; }
|
||||
bool IsPointVisible(const CVector ¢er, const CMatrix *mat);
|
||||
bool IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat);
|
||||
bool IsSphereVisible(const CVector ¢er, float radius);
|
||||
bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
|
||||
int GetLookDirection(void);
|
||||
|
||||
@ -465,7 +466,6 @@ int m_iModeObbeCamIsInForCar;
|
||||
void DrawBordersForWideScreen(void);
|
||||
void Restore(void);
|
||||
void SetWidescreenOff(void);
|
||||
void CamShake(float);
|
||||
|
||||
void dtor(void) { this->CCamera::~CCamera(); }
|
||||
};
|
||||
@ -478,3 +478,5 @@ static_assert(offsetof(CCamera, m_BlurBlue) == 0x9C, "CCamera: error");
|
||||
static_assert(offsetof(CCamera, Cams) == 0x1A4, "CCamera: error");
|
||||
static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size");
|
||||
extern CCamera &TheCamera;
|
||||
|
||||
void CamShakeNoPos(CCamera*, float);
|
||||
|
@ -9,7 +9,11 @@ WRAPPER char CMessages::WideStringCompare(wchar* str1, wchar* str2, unsigned sho
|
||||
WRAPPER void CMessages::InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst) { EAXJMP(0x52A1A0); }
|
||||
WRAPPER void CMessages::InsertPlayerControlKeysInString(wchar* src) { EAXJMP(0x52A490); }
|
||||
WRAPPER int CMessages::GetWideStringLength(wchar* src) { EAXJMP(0x529490); }
|
||||
WRAPPER void CMessages::AddMessage(wchar*, uint32, uint16) { EAXJMP(0x529900); }
|
||||
WRAPPER void CMessages::AddBigMessage(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529EB0); }
|
||||
WRAPPER void CMessages::AddMessage(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529900); }
|
||||
WRAPPER void CMessages::AddMessageJumpQ(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529A10); }
|
||||
WRAPPER void CMessages::AddMessageSoon(wchar* key, uint32 time, uint16 pos) { EAXJMP(0x529AF0); }
|
||||
WRAPPER void CMessages::ClearMessages() { EAXJMP(0x529CE0); }
|
||||
|
||||
tPreviousBrief *CMessages::PreviousBriefs = (tPreviousBrief *)0x713C08;
|
||||
tMessage *CMessages::BriefMessages = (tMessage *)0x8786E0;
|
||||
|
@ -41,5 +41,9 @@ public:
|
||||
static void InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst);
|
||||
static void InsertPlayerControlKeysInString(wchar* src);
|
||||
static int GetWideStringLength(wchar *src);
|
||||
static void AddMessage(wchar*, uint32, uint16);
|
||||
static void AddBigMessage(wchar* key, uint32 time, uint16 pos);
|
||||
static void AddMessage(wchar* key, uint32 time, uint16 pos);
|
||||
static void AddMessageJumpQ(wchar* key, uint32 time, uint16 pos);
|
||||
static void AddMessageSoon(wchar* key, uint32 time, uint16 pos);
|
||||
static void ClearMessages();
|
||||
};
|
||||
|
@ -28,6 +28,8 @@ bool &CWorld::bSecondShift = *(bool*)0x95CD54;
|
||||
bool &CWorld::bForceProcessControl = *(bool*)0x95CD6C;
|
||||
bool &CWorld::bProcessCutsceneOnly = *(bool*)0x95CD8B;
|
||||
|
||||
WRAPPER void CWorld::RemoveReferencesToDeletedObject(CEntity*) { EAXJMP(0x4B3BF0); }
|
||||
|
||||
void
|
||||
CWorld::Add(CEntity *ent)
|
||||
{
|
||||
@ -605,12 +607,12 @@ CWorld::FindObjectsInRange(CVector ¢re, float distance, bool ignoreZ, short
|
||||
minY = 0;
|
||||
|
||||
int maxX = GetSectorIndexX(centre.x + distance);
|
||||
if (maxX >= 100)
|
||||
maxX = 100;
|
||||
if (maxX >= NUMSECTORS_X)
|
||||
maxX = NUMSECTORS_X;
|
||||
|
||||
int maxY = GetSectorIndexY(centre.y + distance);
|
||||
if (maxY >= 100)
|
||||
maxY = 100;
|
||||
if (maxY >= NUMSECTORS_Y)
|
||||
maxY = NUMSECTORS_Y;
|
||||
|
||||
AdvanceCurrentScanCode();
|
||||
|
||||
@ -656,12 +658,12 @@ CWorld::TestSphereAgainstWorld(CVector centre, float distance, CEntity* entityTo
|
||||
minY = 0;
|
||||
|
||||
int maxX = GetSectorIndexX(centre.x + distance);
|
||||
if (maxX >= 100)
|
||||
maxX = 100;
|
||||
if (maxX >= NUMSECTORS_X)
|
||||
maxX = NUMSECTORS_X;
|
||||
|
||||
int maxY = GetSectorIndexY(centre.y + distance);
|
||||
if (maxY >= 100)
|
||||
maxY = 100;
|
||||
if (maxY >= NUMSECTORS_Y)
|
||||
maxY = NUMSECTORS_Y;
|
||||
|
||||
AdvanceCurrentScanCode();
|
||||
|
||||
|
@ -102,6 +102,7 @@ public:
|
||||
static float FindGroundZForCoord(float x, float y);
|
||||
static float FindGroundZFor3DCoord(float x, float y, float z, bool *found);
|
||||
static float FindRoofZFor3DCoord(float x, float y, float z, bool *found);
|
||||
static void RemoveReferencesToDeletedObject(CEntity*);
|
||||
|
||||
static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); }
|
||||
static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }
|
||||
|
@ -178,3 +178,4 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
|
||||
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define ABS(a) (((a) < 0) ? (-a) : (a))
|
||||
|
@ -13,14 +13,11 @@ enum eEntityType
|
||||
ENTITY_TYPE_PED,
|
||||
ENTITY_TYPE_OBJECT,
|
||||
ENTITY_TYPE_DUMMY,
|
||||
ENTITY_TYPE_6,
|
||||
ENTITY_TYPE_7,
|
||||
};
|
||||
|
||||
enum eEntityStatus
|
||||
{
|
||||
// from SA MTA! let's hope they didn't change from III
|
||||
STATUS_PLAYER = 0,
|
||||
STATUS_PLAYER,
|
||||
STATUS_PLAYER_PLAYBACKFROMBUFFER,
|
||||
STATUS_SIMPLE,
|
||||
STATUS_PHYSICS,
|
||||
@ -32,8 +29,6 @@ enum eEntityStatus
|
||||
STATUS_PLANE,
|
||||
STATUS_PLAYER_REMOTE,
|
||||
STATUS_PLAYER_DISABLED,
|
||||
//STATUS_TRAILER,
|
||||
//STATUS_SIMPLE_TRAILER
|
||||
};
|
||||
|
||||
class CEntity : public CPlaceable
|
||||
|
@ -175,6 +175,13 @@ CModelInfo::IsBoatModel(int32 id)
|
||||
((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BOAT;
|
||||
}
|
||||
|
||||
bool
|
||||
CModelInfo::IsBikeModel(int32 id)
|
||||
{
|
||||
return GetModelInfo(id)->m_type == MITYPE_VEHICLE &&
|
||||
((CVehicleModelInfo*)GetModelInfo(id))->m_vehicleType == VEHICLE_TYPE_BIKE;
|
||||
}
|
||||
|
||||
void
|
||||
CModelInfo::RemoveColModelsFromOtherLevels(eLevelName level)
|
||||
{
|
||||
|
@ -36,5 +36,6 @@ public:
|
||||
}
|
||||
|
||||
static bool IsBoatModel(int32 id);
|
||||
static bool IsBikeModel(int32 id);
|
||||
static void RemoveColModelsFromOtherLevels(eLevelName level);
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ WRAPPER void CCivilianPed::ProcessControl(void) { EAXJMP(0x4BFFE0); }
|
||||
|
||||
CCivilianPed::CCivilianPed(int pedtype, int mi) : CPed(pedtype)
|
||||
{
|
||||
CPed::SetModelIndex(mi);
|
||||
SetModelIndex(mi);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
m_nearPeds[i] = nil;
|
||||
|
@ -1,6 +1,64 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "CopPed.h"
|
||||
#include "ModelIndices.h"
|
||||
|
||||
WRAPPER void CCopPed::ProcessControl() { EAXJMP(0x4C1400); }
|
||||
|
||||
CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
|
||||
{
|
||||
m_nCopType = copType;
|
||||
switch (copType) {
|
||||
case COP_STREET:
|
||||
SetModelIndex(MI_COP);
|
||||
GiveWeapon(WEAPONTYPE_COLT45, 1000);
|
||||
m_currentWeapon = WEAPONTYPE_UNARMED;
|
||||
m_fArmour = 0.0f;
|
||||
m_wepSkills = 208; /* TODO: what is this? seems unused */
|
||||
m_wepAccuracy = 60;
|
||||
break;
|
||||
case COP_FBI:
|
||||
SetModelIndex(MI_FBI);
|
||||
GiveWeapon(WEAPONTYPE_COLT45, 1000);
|
||||
GiveWeapon(WEAPONTYPE_AK47, 1000);
|
||||
SetCurrentWeapon(WEAPONTYPE_AK47);
|
||||
m_fArmour = 100.0f;
|
||||
m_wepSkills = 176; /* TODO: what is this? seems unused */
|
||||
m_wepAccuracy = 76;
|
||||
break;
|
||||
case COP_SWAT:
|
||||
SetModelIndex(MI_SWAT);
|
||||
GiveWeapon(WEAPONTYPE_COLT45, 1000);
|
||||
GiveWeapon(WEAPONTYPE_UZI, 1000);
|
||||
SetCurrentWeapon(WEAPONTYPE_UZI);
|
||||
m_fArmour = 50.0f;
|
||||
m_wepSkills = 32; /* TODO: what is this? seems unused */
|
||||
m_wepAccuracy = 64;
|
||||
break;
|
||||
case COP_ARMY:
|
||||
SetModelIndex(MI_ARMY);
|
||||
GiveWeapon(WEAPONTYPE_COLT45, 1000);
|
||||
GiveWeapon(WEAPONTYPE_M16, 1000);
|
||||
GiveWeapon(WEAPONTYPE_GRENADE, 10);
|
||||
SetCurrentWeapon(WEAPONTYPE_M16);
|
||||
m_fArmour = 100.0f;
|
||||
m_wepSkills = 32; /* TODO: what is this? seems unused */
|
||||
m_wepAccuracy = 84;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m_bIsInPursuit = false;
|
||||
field_1350 = 1;
|
||||
m_bIsDisabledCop = false;
|
||||
field_1356 = 0;
|
||||
m_attackTimer = 0;
|
||||
field_1351 = 0;
|
||||
m_bZoneDisabledButClose = false;
|
||||
m_bZoneDisabled = false;
|
||||
field_1364 = -1;
|
||||
m_pPointGunAt = nil;
|
||||
}
|
||||
|
||||
CCopPed::~CCopPed()
|
||||
{
|
||||
@ -12,9 +70,11 @@ WRAPPER void CCopPed::ClearPursuit(void) { EAXJMP(0x4C28C0); }
|
||||
class CCopPed_ : public CCopPed
|
||||
{
|
||||
public:
|
||||
CCopPed *ctor(eCopType type) { return ::new (this) CCopPed(type); };
|
||||
void dtor(void) { CCopPed::~CCopPed(); }
|
||||
};
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4C11B0, &CCopPed_::ctor, PATCH_JUMP);
|
||||
InjectHook(0x4C13E0, &CCopPed_::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -31,9 +31,11 @@ public:
|
||||
int8 field_1366;
|
||||
int8 field_1367;
|
||||
|
||||
CCopPed(eCopType);
|
||||
~CCopPed();
|
||||
|
||||
void ClearPursuit(void);
|
||||
void ProcessControl(void);
|
||||
};
|
||||
|
||||
static_assert(sizeof(CCopPed) == 0x558, "CCopPed: error");
|
||||
|
@ -1,13 +1,38 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "EmergencyPed.h"
|
||||
#include "ModelIndices.h"
|
||||
|
||||
class CEmergencyPed_ : public CEmergencyPed
|
||||
{
|
||||
public:
|
||||
CEmergencyPed *ctor(int pedtype) { return ::new (this) CEmergencyPed(pedtype); };
|
||||
void dtor(void) { CEmergencyPed::~CEmergencyPed(); }
|
||||
};
|
||||
|
||||
WRAPPER void CEmergencyPed::ProcessControl(void) { EAXJMP(0x4C2F10); }
|
||||
|
||||
CEmergencyPed::CEmergencyPed(uint32 type) : CPed(type)
|
||||
{
|
||||
switch (type){
|
||||
case PEDTYPE_EMERGENCY:
|
||||
SetModelIndex(MI_MEDIC);
|
||||
m_pRevivedPed = nil;
|
||||
field_1360 = 0;
|
||||
break;
|
||||
case PEDTYPE_FIREMAN:
|
||||
SetModelIndex(MI_FIREMAN);
|
||||
m_pRevivedPed = nil;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m_nEmergencyPedState = 0;
|
||||
m_pAttendedAccident = nil;
|
||||
field_1356 = 0;
|
||||
}
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x4C2E40, &CEmergencyPed_::ctor, PATCH_JUMP);
|
||||
InjectHook(0x4C2EF0, &CEmergencyPed_::dtor, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
@ -1,11 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "Fire.h"
|
||||
#include "Ped.h"
|
||||
|
||||
class CEmergencyPed : public CPed
|
||||
{
|
||||
public:
|
||||
// 0x53C
|
||||
uint8 stuff[24];
|
||||
CPed* m_pRevivedPed;
|
||||
int32 m_nEmergencyPedState; // looks like flags
|
||||
void* m_pAttendedAccident; //TODO: CAccident*
|
||||
CFire* m_pAttendedFire;
|
||||
int8 field_1356;
|
||||
int32 field_1360;
|
||||
|
||||
CEmergencyPed(uint32);
|
||||
void ProcessControl(void);
|
||||
};
|
||||
static_assert(sizeof(CEmergencyPed) == 0x554, "CEmergencyPed: error");
|
||||
|
@ -47,6 +47,9 @@ WRAPPER void CPed::SetDuck(uint32) { EAXJMP(0x4E4920); }
|
||||
WRAPPER void CPed::RegisterThreatWithGangPeds(CEntity*) { EAXJMP(0x4E3870); }
|
||||
WRAPPER void CPed::MakeChangesForNewWeapon(int8) { EAXJMP(0x4F2560); }
|
||||
WRAPPER void CPed::SetSeek(CVector, float) { EAXJMP(0x4D14B0); }
|
||||
WRAPPER bool CPed::Seek(void) { EAXJMP(0x4D1640); }
|
||||
WRAPPER void CPed::SetWanderPath(int8) { EAXJMP(0x4D2750); }
|
||||
WRAPPER void CPed::SetFollowPath(CVector) { EAXJMP(0x4D2EA0); }
|
||||
|
||||
bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44;
|
||||
bool &CPed::bPedCheat2 = *(bool*)0x95CD5A;
|
||||
@ -394,7 +397,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
|
||||
m_ped_flagD10 = false;
|
||||
m_ped_flagD20 = false;
|
||||
m_ped_flagD40 = false;
|
||||
m_ped_flagD80 = false;
|
||||
m_bScriptObjectiveCompleted = false;
|
||||
|
||||
m_ped_flagE1 = false;
|
||||
m_ped_flagE2 = false;
|
||||
@ -1405,7 +1408,7 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
|
||||
|
||||
if (vehicle->pDriver == ped) {
|
||||
vehicle->RemoveDriver();
|
||||
if (vehicle->m_nDoorLock == CARLOCK_COP_CAR)
|
||||
if (vehicle->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
|
||||
vehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||
|
||||
if (ped->m_nPedType == PEDTYPE_COP && vehicle->IsLawEnforcementVehicle())
|
||||
@ -1457,7 +1460,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enter
|
||||
seatOffset = 0.0f;
|
||||
vehDoorOffset = offsetToOpenVanDoor;
|
||||
} else {
|
||||
seatOffset = veh->m_handling->fSeatOffsetDistance * seatPosMult;
|
||||
seatOffset = veh->pHandling->fSeatOffsetDistance * seatPosMult;
|
||||
if (veh->bLowVehicle) {
|
||||
vehDoorOffset = offsetToOpenLowCarDoor;
|
||||
} else {
|
||||
@ -2730,8 +2733,8 @@ CPed::QuitEnteringCar(void)
|
||||
m_pVehicleAnim = nil;
|
||||
|
||||
if (veh) {
|
||||
if (veh->m_autoPilot.m_nCruiseSpeed == 0)
|
||||
veh->m_autoPilot.m_nCruiseSpeed = 17;
|
||||
if (veh->AutoPilot.m_nCruiseSpeed == 0)
|
||||
veh->AutoPilot.m_nCruiseSpeed = 17;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3049,7 +3052,7 @@ CPed::CheckForPointBlankPeds(CPed *pedToVerify)
|
||||
neededAngle = CGeneral::LimitRadianAngle(neededAngle);
|
||||
m_fRotationCur = CGeneral::LimitRadianAngle(m_fRotationCur);
|
||||
|
||||
float neededTurn = Abs(neededTurn - m_fRotationCur);
|
||||
float neededTurn = Abs(neededAngle - m_fRotationCur);
|
||||
|
||||
if (neededTurn > PI)
|
||||
neededTurn = 2*PI - neededTurn;
|
||||
|
@ -210,7 +210,7 @@ public:
|
||||
uint8 m_ped_flagD10 : 1;
|
||||
uint8 m_ped_flagD20 : 1;
|
||||
uint8 m_ped_flagD40 : 1; // reset when objective changes
|
||||
uint8 m_ped_flagD80 : 1;
|
||||
uint8 m_bScriptObjectiveCompleted : 1;
|
||||
|
||||
uint8 m_ped_flagE1 : 1;
|
||||
uint8 m_ped_flagE2 : 1;
|
||||
@ -469,6 +469,9 @@ public:
|
||||
bool CheckIfInTheAir(void);
|
||||
void ClearAll(void);
|
||||
void SetPointGunAt(CEntity*);
|
||||
bool Seek(void);
|
||||
void SetWanderPath(int8);
|
||||
void SetFollowPath(CVector);
|
||||
|
||||
// Static methods
|
||||
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
|
||||
|
@ -12,7 +12,12 @@
|
||||
#include "World.h"
|
||||
#include "SurfaceTable.h"
|
||||
#include "HandlingMgr.h"
|
||||
#include "Record.h"
|
||||
#include "Remote.h"
|
||||
#include "Population.h"
|
||||
#include "CarCtrl.h"
|
||||
#include "CarAI.h"
|
||||
#include "Garages.h"
|
||||
#include "PathFind.h"
|
||||
#include "Ped.h"
|
||||
#include "PlayerPed.h"
|
||||
@ -38,7 +43,370 @@ CAutomobile::SetModelIndex(uint32 id)
|
||||
SetupModelNodes();
|
||||
}
|
||||
|
||||
WRAPPER void CAutomobile::ProcessControl(void) { EAXJMP(0x531470); }
|
||||
//WRAPPER void CAutomobile::ProcessControl(void) { EAXJMP(0x531470); }
|
||||
void
|
||||
CAutomobile::ProcessControl(void)
|
||||
{
|
||||
int i;
|
||||
CColModel *colModel;
|
||||
|
||||
if(m_veh_flagC80)
|
||||
colModel = &CWorld::Players[CWorld::PlayerInFocus].m_ColModel;
|
||||
else
|
||||
colModel = GetColModel();
|
||||
bWarnedPeds = false;
|
||||
|
||||
// skip if the collision isn't for the current level
|
||||
if(colModel->level > LEVEL_NONE && colModel->level != CCollision::ms_collisionInMemory)
|
||||
return;
|
||||
|
||||
// Improve grip of vehicles in certain cases
|
||||
bool strongGrip1 = false;
|
||||
bool strongGrip2 = false;
|
||||
if(FindPlayerVehicle() && this != FindPlayerVehicle()){
|
||||
switch(AutoPilot.m_nCarMission){
|
||||
case MISSION_RAMPLAYER_FARAWAY:
|
||||
case MISSION_RAMPLAYER_CLOSE:
|
||||
case MISSION_BLOCKPLAYER_FARAWAY:
|
||||
case MISSION_BLOCKPLAYER_CLOSE:
|
||||
if(FindPlayerSpeed().Magnitude() > 0.3f){
|
||||
strongGrip1 = true;
|
||||
if(FindPlayerSpeed().Magnitude() > 0.4f){
|
||||
if(m_vecMoveSpeed.Magnitude() < 0.3f)
|
||||
strongGrip2 = true;
|
||||
}else{
|
||||
if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f)
|
||||
strongGrip2 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(bIsBus)
|
||||
ProcessAutoBusDoors();
|
||||
|
||||
ProcessCarAlarm();
|
||||
|
||||
// Scan if this car is committing a crime that the police can see
|
||||
if(m_status != STATUS_ABANDONED && m_status != STATUS_WRECKED &&
|
||||
m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE && m_status != STATUS_PLAYER_DISABLED){
|
||||
switch(GetModelIndex())
|
||||
case MI_FBICAR:
|
||||
case MI_POLICE:
|
||||
case MI_ENFORCER:
|
||||
case MI_SECURICA:
|
||||
case MI_RHINO:
|
||||
case MI_BARRACKS:
|
||||
ScanForCrimes();
|
||||
}
|
||||
|
||||
// Process driver
|
||||
if(pDriver){
|
||||
if(!bHadDriver && m_bombType == 5){
|
||||
// If someone enters the car and there is a bomb, detonate
|
||||
m_nBombTimer = 1000;
|
||||
m_pBlowUpEntity = field_4DC;
|
||||
if(m_pBlowUpEntity)
|
||||
m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity);
|
||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f);
|
||||
}
|
||||
bHadDriver = true;
|
||||
|
||||
if(IsUpsideDown() && CanPedEnterCar()){
|
||||
if(!pDriver->IsPlayer() &&
|
||||
!(pDriver->m_leader && pDriver->m_leader->bInVehicle) &&
|
||||
pDriver->CharCreatedBy != MISSION_CHAR)
|
||||
pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this);
|
||||
}
|
||||
}else
|
||||
bHadDriver = false;
|
||||
|
||||
// Process passengers
|
||||
if(m_nNumPassengers != 0 && IsUpsideDown() && CanPedEnterCar()){
|
||||
for(i = 0; i < m_nNumMaxPassengers; i++)
|
||||
if(pPassengers[i])
|
||||
if(!pPassengers[i]->IsPlayer() &&
|
||||
!(pPassengers[i]->m_leader && pPassengers[i]->m_leader->bInVehicle) &&
|
||||
pPassengers[i]->CharCreatedBy != MISSION_CHAR)
|
||||
pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this);
|
||||
}
|
||||
|
||||
// CRubbish::StirUp
|
||||
|
||||
// blend in clump
|
||||
int clumpAlpha = CVisibilityPlugins::GetClumpAlpha((RpClump*)m_rwObject);
|
||||
if(bFadeOut){
|
||||
clumpAlpha -= 8;
|
||||
if(clumpAlpha < 0)
|
||||
clumpAlpha = 0;
|
||||
}else if(clumpAlpha < 255){
|
||||
clumpAlpha += 16;
|
||||
if(clumpAlpha > 255)
|
||||
clumpAlpha = 255;
|
||||
}
|
||||
CVisibilityPlugins::SetClumpAlpha((RpClump*)m_rwObject, clumpAlpha);
|
||||
|
||||
AutoPilot.m_flag1 = false;
|
||||
AutoPilot.m_flag2 = false;
|
||||
|
||||
// Set Center of Mass to make car more stable
|
||||
if(strongGrip1 || bCheat3)
|
||||
m_vecCentreOfMass.z = 0.3f*m_aSuspensionSpringLength[0] + -1.0*m_fHeightAboveRoad;
|
||||
else if(pHandling->Flags & HANDLING_NONPLAYER_STABILISER && m_status == STATUS_PHYSICS)
|
||||
m_vecCentreOfMass.z = pHandling->CentreOfMass.z - 0.2f*pHandling->Dimension.z;
|
||||
else
|
||||
m_vecCentreOfMass.z = pHandling->CentreOfMass.z;
|
||||
|
||||
// Process depending on status
|
||||
|
||||
bool playerRemote = false;
|
||||
switch(m_status){
|
||||
case STATUS_PLAYER_REMOTE:
|
||||
if(CPad::GetPad(0)->WeaponJustDown()){
|
||||
BlowUpCar(FindPlayerPed());
|
||||
CRemote::TakeRemoteControlledCarFromPlayer();
|
||||
}
|
||||
|
||||
if(GetModelIndex() == MI_RCBANDIT){
|
||||
CVector pos = GetPosition();
|
||||
// FindPlayerCoors unused
|
||||
if(RcbanditCheckHitWheels() || bIsInWater || CPopulation::IsPointInSafeZone(&pos)){
|
||||
if(CPopulation::IsPointInSafeZone(&pos))
|
||||
CGarages::TriggerMessage("HM2_5", -1, 5000, -1);
|
||||
CRemote::TakeRemoteControlledCarFromPlayer();
|
||||
BlowUpCar(FindPlayerPed());
|
||||
}
|
||||
}
|
||||
|
||||
if(CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle == this)
|
||||
playerRemote = true;
|
||||
// fall through
|
||||
case STATUS_PLAYER:
|
||||
if(playerRemote ||
|
||||
pDriver && pDriver->GetPedState() != PED_EXIT_CAR && pDriver->GetPedState() != PED_DRAG_FROM_CAR){
|
||||
// process control input if controlled by player
|
||||
if(playerRemote || pDriver->m_nPedType == PEDTYPE_PLAYER1)
|
||||
ProcessControlInputs(0);
|
||||
|
||||
PruneReferences();
|
||||
|
||||
if(m_status == STATUS_PLAYER && CRecordDataForChase::Status != RECORDSTATE_1)
|
||||
DoDriveByShootings();
|
||||
}
|
||||
break;
|
||||
|
||||
case STATUS_SIMPLE:
|
||||
CCarAI::UpdateCarAI(this);
|
||||
CPhysical::ProcessControl();
|
||||
CCarCtrl::UpdateCarOnRails(this);
|
||||
|
||||
m_nWheelsOnGround_2 = 4;
|
||||
m_nWheelsOnGroundPrev = m_nWheelsOnGround;
|
||||
m_nWheelsOnGround = 4;
|
||||
|
||||
pHandling->Transmission.CalculateGearForSimpleCar(AutoPilot.m_fMaxTrafficSpeed/50.0f, m_nCurrentGear);
|
||||
|
||||
{
|
||||
float wheelRot = ProcessWheelRotation(WHEEL_STATE_0, GetForward(), m_vecMoveSpeed, 0.35f);
|
||||
for(i = 0; i < 4; i++)
|
||||
m_aWheelRotation[i] += wheelRot;
|
||||
}
|
||||
|
||||
PlayHornIfNecessary();
|
||||
ReduceHornCounter();
|
||||
bVehicleColProcessed = false;
|
||||
// that's all we do for simple vehicles
|
||||
return;
|
||||
|
||||
case STATUS_PHYSICS:
|
||||
CCarAI::UpdateCarAI(this);
|
||||
CCarCtrl::SteerAICarWithPhysics(this);
|
||||
PlayHornIfNecessary();
|
||||
break;
|
||||
|
||||
case STATUS_ABANDONED:
|
||||
m_fBrakePedal = 0.2f;
|
||||
bIsHandbrakeOn = false;
|
||||
|
||||
m_fSteerAngle = 0.0f;
|
||||
m_fGasPedal = 0.0f;
|
||||
m_nCarHornTimer = 0;
|
||||
break;
|
||||
|
||||
case STATUS_WRECKED:
|
||||
m_fBrakePedal = 0.05f;
|
||||
bIsHandbrakeOn = true;
|
||||
|
||||
m_fSteerAngle = 0.0f;
|
||||
m_fGasPedal = 0.0f;
|
||||
m_nCarHornTimer = 0;
|
||||
break;
|
||||
|
||||
case STATUS_PLAYER_DISABLED:
|
||||
m_fBrakePedal = 1.0f;
|
||||
bIsHandbrakeOn = true;
|
||||
|
||||
m_fSteerAngle = 0.0f;
|
||||
m_fGasPedal = 0.0f;
|
||||
m_nCarHornTimer = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(GetPosition().z < -0.6f){
|
||||
assert(0);
|
||||
}
|
||||
|
||||
bool skipPhysics = false;
|
||||
if(!bIsStuck){
|
||||
assert(0);
|
||||
}
|
||||
|
||||
// Postpone
|
||||
for(i = 0; i < 4; i++)
|
||||
if(m_aGroundPhysical[i] && !CWorld::bForceProcessControl && m_aGroundPhysical[i]->bIsInSafePosition){
|
||||
bWasPostponed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// VehicleDamage
|
||||
|
||||
// special control
|
||||
switch(GetModelIndex()){
|
||||
case MI_FIRETRUCK:
|
||||
case MI_RHINO:
|
||||
case MI_YARDIE:
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
if(skipPhysics){
|
||||
bHasContacted = false;
|
||||
bIsInSafePosition = false;
|
||||
bWasPostponed = false;
|
||||
bHasHitWall = false;
|
||||
m_nCollisionRecords = 0;
|
||||
bHasCollided = false;
|
||||
bVehicleColProcessed = false;
|
||||
m_nDamagePieceType = 0;
|
||||
m_fDamageImpulse = 0.0f;
|
||||
m_pDamageEntity = nil;
|
||||
m_vecTurnFriction = CVector(0.0f, 0.0f, 0.0f);
|
||||
m_vecMoveFriction = CVector(0.0f, 0.0f, 0.0f);
|
||||
}else{
|
||||
|
||||
// This has to be done if ProcessEntityCollision wasn't called
|
||||
if(!bVehicleColProcessed){
|
||||
CMatrix mat(GetMatrix());
|
||||
bIsStuck = false;
|
||||
bHasContacted = false;
|
||||
bIsInSafePosition = false;
|
||||
bWasPostponed = false;
|
||||
bHasHitWall = false;
|
||||
m_fDistanceTravelled = 0.0f;
|
||||
field_EF = false;
|
||||
m_phy_flagA80 = false;
|
||||
ApplyMoveSpeed();
|
||||
ApplyTurnSpeed();
|
||||
for(i = 0; CheckCollision() && i < 5; i++){
|
||||
GetMatrix() = mat;
|
||||
ApplyMoveSpeed();
|
||||
ApplyTurnSpeed();
|
||||
}
|
||||
bIsInSafePosition = true;
|
||||
bIsStuck = false;
|
||||
}
|
||||
|
||||
CPhysical::ProcessControl();
|
||||
|
||||
ProcessBuoyancy();
|
||||
|
||||
// Rescale spring ratios, i.e. subtract wheel radius
|
||||
for(i = 0; i < 4; i++){
|
||||
// wheel radius in relation to suspension line
|
||||
float wheelRadius = 1.0f - m_aSuspensionSpringLength[i]/m_aSuspensionLineLength[i];
|
||||
// rescale such that 0.0 is fully compressed and 1.0 is fully extended
|
||||
m_aSuspensionSpringRatio[i] = (m_aSuspensionSpringRatio[i]-wheelRadius)/(1.0f-wheelRadius);
|
||||
}
|
||||
|
||||
float fwdSpeed = DotProduct(m_vecMoveSpeed, GetForward());
|
||||
CVector contactPoints[4]; // relative to model
|
||||
CVector contactSpeeds[4]; // speed at contact points
|
||||
CVector springDirections[4]; // normalized, in model space
|
||||
|
||||
for(i = 0; i < 4; i++){
|
||||
// Set spring under certain circumstances
|
||||
if(Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING)
|
||||
m_aSuspensionSpringRatio[i] = 1.0f;
|
||||
else if(Damage.GetWheelStatus(i) == WHEEL_STATUS_BURST){
|
||||
// wheel more bumpy the faster we are
|
||||
if(CGeneral::GetRandomNumberInRange(0, (uint16)(40*fwdSpeed) + 98) < 100){
|
||||
m_aSuspensionSpringRatio[i] += 0.3f*(m_aSuspensionLineLength[i]-m_aSuspensionSpringLength[i])/m_aSuspensionSpringLength[i];
|
||||
if(m_aSuspensionSpringRatio[i] > 1.0f)
|
||||
m_aSuspensionSpringRatio[i] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// get points and directions if spring is compressed
|
||||
if(m_aSuspensionSpringRatio[i] < 1.0f){
|
||||
contactPoints[i] = m_aWheelColPoints[i].point - GetPosition();
|
||||
springDirections[i] = Multiply3x3(GetMatrix(), colModel->lines[i].p1 - colModel->lines[i].p0);
|
||||
springDirections[i].Normalise();
|
||||
}
|
||||
}
|
||||
|
||||
// Make springs push up vehicle
|
||||
for(i = 0; i < 4; i++){
|
||||
if(m_aSuspensionSpringRatio[i] < 1.0f){
|
||||
float bias = pHandling->fSuspensionBias;
|
||||
if(i == 1 || i == 3) // rear
|
||||
bias = 1.0f - bias;
|
||||
|
||||
ApplySpringCollision(pHandling->fSuspensionForceLevel,
|
||||
springDirections[i], contactPoints[i],
|
||||
m_aSuspensionSpringRatio[i], bias);
|
||||
m_aWheelSkidmarkMuddy[i] =
|
||||
m_aWheelColPoints[i].surfaceB == SURFACE_GRASS ||
|
||||
m_aWheelColPoints[i].surfaceB == SURFACE_DIRTTRACK ||
|
||||
m_aWheelColPoints[i].surfaceB == SURFACE_SAND;
|
||||
}else{
|
||||
contactPoints[i] = Multiply3x3(GetMatrix(), colModel->lines[i].p1);
|
||||
}
|
||||
}
|
||||
|
||||
// Get speed at contact points
|
||||
for(i = 0; i < 4; i++){
|
||||
contactSpeeds[i] = GetSpeed(contactPoints[i]);
|
||||
if(m_aGroundPhysical[i]){
|
||||
// subtract movement of physical we're standing on
|
||||
contactSpeeds[i] -= m_aGroundPhysical[i]->GetSpeed(m_aGroundOffset[i]);
|
||||
#ifndef FIX_BUGS
|
||||
// this shouldn't be reset because we still need it below
|
||||
m_aGroundPhysical[i] = nil;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// dampen springs
|
||||
for(i = 0; i < 4; i++)
|
||||
if(m_aSuspensionSpringRatio[i] < 1.0f)
|
||||
ApplySpringDampening(pHandling->fSuspensionDampingLevel,
|
||||
springDirections[i], contactPoints[i], contactSpeeds[i]);
|
||||
|
||||
// Get speed at contact points again
|
||||
for(i = 0; i < 4; i++){
|
||||
contactSpeeds[i] = GetSpeed(contactPoints[i]);
|
||||
if(m_aGroundPhysical[i]){
|
||||
// subtract movement of physical we're standing on
|
||||
contactSpeeds[i] -= m_aGroundPhysical[i]->GetSpeed(m_aGroundOffset[i]);
|
||||
m_aGroundPhysical[i] = nil;
|
||||
}
|
||||
}
|
||||
|
||||
assert(0);
|
||||
}
|
||||
|
||||
assert(0 && "misc stuff");
|
||||
}
|
||||
|
||||
void
|
||||
CAutomobile::Teleport(CVector pos)
|
||||
@ -230,7 +598,7 @@ CAutomobile::ProcessControlInputs(uint8 pad)
|
||||
fValue = -sq(m_fSteerRatio);
|
||||
else
|
||||
fValue = sq(m_fSteerRatio);
|
||||
m_fSteerAngle = DEGTORAD(m_handling->fSteeringLock) * fValue;
|
||||
m_fSteerAngle = DEGTORAD(pHandling->fSteeringLock) * fValue;
|
||||
|
||||
if(bComedyControls){
|
||||
int rnd = CGeneral::GetRandomNumber() % 10;
|
||||
@ -271,6 +639,21 @@ CAutomobile::ProcessControlInputs(uint8 pad)
|
||||
}
|
||||
}
|
||||
|
||||
WRAPPER void
|
||||
CAutomobile::ProcessBuoyancy(void)
|
||||
{ EAXJMP(0x5308D0);
|
||||
}
|
||||
|
||||
WRAPPER void
|
||||
CAutomobile::DoDriveByShootings(void)
|
||||
{ EAXJMP(0x564000);
|
||||
}
|
||||
|
||||
WRAPPER int32
|
||||
CAutomobile::RcbanditCheckHitWheels(void)
|
||||
{ EAXJMP(0x53C990);
|
||||
}
|
||||
|
||||
void
|
||||
CAutomobile::GetComponentWorldPosition(int32 component, CVector &pos)
|
||||
{
|
||||
@ -524,7 +907,7 @@ CAutomobile::BlowUpCar(CEntity *culprit)
|
||||
|
||||
m_fHealth = 0.0f;
|
||||
m_nBombTimer = 0;
|
||||
m_auto_flagA7 = 0;
|
||||
m_bombType = 0;
|
||||
|
||||
TheCamera.CamShake(0.7f, GetPosition().x, GetPosition().y, GetPosition().z);
|
||||
|
||||
@ -660,8 +1043,8 @@ CAutomobile::PlayCarHorn(void)
|
||||
void
|
||||
CAutomobile::PlayHornIfNecessary(void)
|
||||
{
|
||||
if(m_autoPilot.m_flag2 ||
|
||||
m_autoPilot.m_flag1)
|
||||
if(AutoPilot.m_flag2 ||
|
||||
AutoPilot.m_flag1)
|
||||
if(!HasCarStoppedBecauseOfLight())
|
||||
PlayCarHorn();
|
||||
}
|
||||
@ -694,23 +1077,23 @@ CAutomobile::SetupSuspensionLines(void)
|
||||
m_aWheelPosition[i] = posn.z;
|
||||
|
||||
// uppermost wheel position
|
||||
posn.z += m_handling->fSuspensionUpperLimit;
|
||||
posn.z += pHandling->fSuspensionUpperLimit;
|
||||
colModel->lines[i].p0 = posn;
|
||||
|
||||
// lowermost wheel position
|
||||
posn.z += m_handling->fSuspensionLowerLimit - m_handling->fSuspensionUpperLimit;
|
||||
posn.z += pHandling->fSuspensionLowerLimit - pHandling->fSuspensionUpperLimit;
|
||||
// lowest point on tyre
|
||||
posn.z -= mi->m_wheelScale*0.5f;
|
||||
colModel->lines[i].p1 = posn;
|
||||
|
||||
// this is length of the spring at rest
|
||||
m_aSuspensionSpringLength[i] = m_handling->fSuspensionUpperLimit - m_handling->fSuspensionLowerLimit;
|
||||
m_aSuspensionSpringLength[i] = pHandling->fSuspensionUpperLimit - pHandling->fSuspensionLowerLimit;
|
||||
m_aSuspensionLineLength[i] = colModel->lines[i].p0.z - colModel->lines[i].p1.z;
|
||||
}
|
||||
|
||||
// Compress spring somewhat to get normal height on road
|
||||
m_fHeightAboveRoad = -(colModel->lines[0].p0.z + (colModel->lines[0].p1.z - colModel->lines[0].p0.z)*
|
||||
(1.0f - 1.0f/(8.0f*m_handling->fSuspensionForceLevel)));
|
||||
(1.0f - 1.0f/(8.0f*pHandling->fSuspensionForceLevel)));
|
||||
for(i = 0; i < 4; i++)
|
||||
m_aWheelPosition[i] = mi->m_wheelScale*0.5f - m_fHeightAboveRoad;
|
||||
|
||||
@ -761,20 +1144,20 @@ CAutomobile::HasCarStoppedBecauseOfLight(void)
|
||||
if(m_status != STATUS_SIMPLE && m_status != STATUS_PHYSICS)
|
||||
return false;
|
||||
|
||||
if(m_autoPilot.m_nCurrentRouteNode && m_autoPilot.m_nNextRouteNode){
|
||||
CPathNode *curnode = &ThePaths.m_pathNodes[m_autoPilot.m_nCurrentRouteNode];
|
||||
if(AutoPilot.m_nCurrentRouteNode && AutoPilot.m_nNextRouteNode){
|
||||
CPathNode *curnode = &ThePaths.m_pathNodes[AutoPilot.m_nCurrentRouteNode];
|
||||
for(i = 0; i < curnode->numLinks; i++)
|
||||
if(ThePaths.m_connections[curnode->firstLink + i] == m_autoPilot.m_nNextRouteNode)
|
||||
if(ThePaths.m_connections[curnode->firstLink + i] == AutoPilot.m_nNextRouteNode)
|
||||
break;
|
||||
if(i < curnode->numLinks &&
|
||||
ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[curnode->firstLink + i]].trafficLightType & 3) // TODO
|
||||
return true;
|
||||
}
|
||||
|
||||
if(m_autoPilot.m_nCurrentRouteNode && m_autoPilot.m_nPrevRouteNode){
|
||||
CPathNode *curnode = &ThePaths.m_pathNodes[m_autoPilot.m_nCurrentRouteNode];
|
||||
if(AutoPilot.m_nCurrentRouteNode && AutoPilot.m_nPrevRouteNode){
|
||||
CPathNode *curnode = &ThePaths.m_pathNodes[AutoPilot.m_nCurrentRouteNode];
|
||||
for(i = 0; i < curnode->numLinks; i++)
|
||||
if(ThePaths.m_connections[curnode->firstLink + i] == m_autoPilot.m_nPrevRouteNode)
|
||||
if(ThePaths.m_connections[curnode->firstLink + i] == AutoPilot.m_nPrevRouteNode)
|
||||
break;
|
||||
if(i < curnode->numLinks &&
|
||||
ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[curnode->firstLink + i]].trafficLightType & 3) // TODO
|
||||
@ -861,7 +1244,7 @@ CAutomobile::Fix(void)
|
||||
|
||||
Damage.ResetDamageStatus();
|
||||
|
||||
if(m_handling->Flags & HANDLING_NO_DOORS){
|
||||
if(pHandling->Flags & HANDLING_NO_DOORS){
|
||||
Damage.SetDoorStatus(DOOR_FRONT_LEFT, DOOR_STATUS_MISSING);
|
||||
Damage.SetDoorStatus(DOOR_FRONT_RIGHT, DOOR_STATUS_MISSING);
|
||||
Damage.SetDoorStatus(DOOR_REAR_LEFT, DOOR_STATUS_MISSING);
|
||||
@ -987,7 +1370,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
|
||||
obj->m_fElasticity = 0.1f;
|
||||
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
|
||||
obj->ObjectCreatedBy = TEMP_OBJECT;
|
||||
obj->bIsStatic = true;
|
||||
obj->bIsStatic = false;
|
||||
obj->bIsPickup = false;
|
||||
obj->bUseVehicleColours = true;
|
||||
obj->m_colour1 = m_currentColour1;
|
||||
@ -1114,7 +1497,7 @@ CAutomobile::SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents
|
||||
return;
|
||||
}
|
||||
|
||||
if(door == DOOR_BOOT && status == DOOR_STATUS_SWINGING && m_handling->Flags & HANDLING_NOSWING_BOOT){
|
||||
if(door == DOOR_BOOT && status == DOOR_STATUS_SWINGING && pHandling->Flags & HANDLING_NOSWING_BOOT){
|
||||
Damage.SetDoorStatus(DOOR_BOOT, DOOR_STATUS_MISSING);
|
||||
status = DOOR_STATUS_MISSING;
|
||||
}
|
||||
|
@ -6,6 +6,12 @@
|
||||
|
||||
class CObject;
|
||||
|
||||
// Wheels are in order:
|
||||
// FRONT LEFT
|
||||
// REAR LEFT
|
||||
// FRONT RIGHT
|
||||
// REAR RIGHT
|
||||
|
||||
class CAutomobile : public CVehicle
|
||||
{
|
||||
public:
|
||||
@ -24,13 +30,15 @@ public:
|
||||
float m_aWheelPosition[4];
|
||||
float m_aWheelSpeed[4];
|
||||
uint8 field_4D8;
|
||||
uint8 m_auto_flagA7 : 1;
|
||||
uint8 m_bombType : 3;
|
||||
uint8 bTaxiLight : 1;
|
||||
uint8 m_auto_flagA10 : 1;
|
||||
uint8 bHadDriver : 1; // for bombs
|
||||
uint8 m_auto_flagA20 : 1;
|
||||
uint8 m_auto_flagA40 : 1;
|
||||
uint8 m_auto_flagA80 : 1;
|
||||
uint8 field_4DA[10];
|
||||
uint8 field_4DA[2];
|
||||
CEntity *field_4DC; // blow up entity
|
||||
uint8 field_4E0[4];
|
||||
uint32 m_nBusDoorTimerEnd;
|
||||
uint32 m_nBusDoorTimerStart;
|
||||
float m_aSuspensionSpringLength[4];
|
||||
@ -41,7 +49,7 @@ public:
|
||||
float field_530;
|
||||
CPhysical *m_aGroundPhysical[4]; // physicals touching wheels
|
||||
CVector m_aGroundOffset[4]; // from ground object to colpoint
|
||||
CEntity *m_pBlowUpEntity;
|
||||
CEntity *m_pSetOnFireEntity;
|
||||
float m_weaponThingA; // TODO
|
||||
float m_weaponThingB; // TODO
|
||||
float m_fCarGunLR;
|
||||
@ -87,6 +95,9 @@ public:
|
||||
float GetHeightAboveRoad(void);
|
||||
void PlayCarHorn(void);
|
||||
|
||||
void ProcessBuoyancy(void);
|
||||
void DoDriveByShootings(void);
|
||||
int32 RcbanditCheckHitWheels(void);
|
||||
void PlayHornIfNecessary(void);
|
||||
void ResetSuspension(void);
|
||||
void SetupSuspensionLines(void);
|
||||
|
@ -23,7 +23,8 @@ enum ePanelStatus
|
||||
enum eWheelStatus
|
||||
{
|
||||
WHEEL_STATUS_OK,
|
||||
WHEEL_STATUS_BURST
|
||||
WHEEL_STATUS_BURST,
|
||||
WHEEL_STATUS_MISSING
|
||||
};
|
||||
|
||||
enum tComponent
|
||||
|
@ -140,11 +140,11 @@ cHandlingDataMgr::LoadHandlingData(void)
|
||||
case 9: handling->fTractionMultiplier = strtod(word, nil); break;
|
||||
case 10: handling->fTractionLoss = strtod(word, nil); break;
|
||||
case 11: handling->fTractionBias = strtod(word, nil); break;
|
||||
case 12: handling->TransmissionData.nNumberOfGears = atoi(word); break;
|
||||
case 13: handling->TransmissionData.fMaxVelocity = strtod(word, nil); break;
|
||||
case 14: handling->TransmissionData.fEngineAcceleration = strtod(word, nil) * 0.4f; break;
|
||||
case 15: handling->TransmissionData.nDriveType = word[0]; break;
|
||||
case 16: handling->TransmissionData.nEngineType = word[0]; break;
|
||||
case 12: handling->Transmission.nNumberOfGears = atoi(word); break;
|
||||
case 13: handling->Transmission.fMaxVelocity = strtod(word, nil); break;
|
||||
case 14: handling->Transmission.fEngineAcceleration = strtod(word, nil) * 0.4f; break;
|
||||
case 15: handling->Transmission.nDriveType = word[0]; break;
|
||||
case 16: handling->Transmission.nEngineType = word[0]; break;
|
||||
case 17: handling->fBrakeDeceleration = strtod(word, nil); break;
|
||||
case 18: handling->fBrakeBias = strtod(word, nil); break;
|
||||
case 19: handling->bABS = !!atoi(word); break;
|
||||
@ -159,7 +159,7 @@ cHandlingDataMgr::LoadHandlingData(void)
|
||||
case 28: handling->fSuspensionBias = strtod(word, nil); break;
|
||||
case 29:
|
||||
sscanf(word, "%x", &handling->Flags);
|
||||
handling->TransmissionData.Flags = handling->Flags;
|
||||
handling->Transmission.Flags = handling->Flags;
|
||||
break;
|
||||
case 30: handling->FrontLights = atoi(word); break;
|
||||
case 31: handling->RearLights = atoi(word); break;
|
||||
@ -192,8 +192,8 @@ cHandlingDataMgr::ConvertDataToGameUnits(tHandlingData *handling)
|
||||
// TODO: figure out what exactly is being converted here
|
||||
float velocity, a, b, specificVolume;
|
||||
|
||||
handling->TransmissionData.fEngineAcceleration /= 2500.0f;
|
||||
handling->TransmissionData.fMaxVelocity /= 180.0f;
|
||||
handling->Transmission.fEngineAcceleration /= 2500.0f;
|
||||
handling->Transmission.fMaxVelocity /= 180.0f;
|
||||
handling->fBrakeDeceleration /= 2500.0f;
|
||||
handling->fTurnMass = (sq(handling->Dimension.x) + sq(handling->Dimension.y)) * handling->fMass / 12.0f;
|
||||
if(handling->fTurnMass < 10.0f)
|
||||
@ -205,27 +205,27 @@ cHandlingDataMgr::ConvertDataToGameUnits(tHandlingData *handling)
|
||||
specificVolume = handling->Dimension.x*handling->Dimension.z*0.5f / handling->fMass; // ?
|
||||
a = 0.0f;
|
||||
b = 100.0f;
|
||||
velocity = handling->TransmissionData.fMaxVelocity;
|
||||
velocity = handling->Transmission.fMaxVelocity;
|
||||
while(a < b && velocity > 0.0f){
|
||||
velocity -= 0.01;
|
||||
a = handling->TransmissionData.fEngineAcceleration/6.0f;
|
||||
a = handling->Transmission.fEngineAcceleration/6.0f;
|
||||
b = -velocity * (1.0f/(specificVolume * sq(velocity) + 1.0f) - 1.0f);
|
||||
}
|
||||
|
||||
if(handling->nIdentifier == HANDLING_RCBANDIT){
|
||||
handling->TransmissionData.fUnkMaxVelocity = handling->TransmissionData.fMaxVelocity;
|
||||
handling->Transmission.fUnkMaxVelocity = handling->Transmission.fMaxVelocity;
|
||||
}else{
|
||||
handling->TransmissionData.fUnkMaxVelocity = velocity;
|
||||
handling->TransmissionData.fMaxVelocity = velocity * 1.2f;
|
||||
handling->Transmission.fUnkMaxVelocity = velocity;
|
||||
handling->Transmission.fMaxVelocity = velocity * 1.2f;
|
||||
}
|
||||
handling->TransmissionData.fMaxReverseVelocity = -0.2f;
|
||||
handling->Transmission.fMaxReverseVelocity = -0.2f;
|
||||
|
||||
if(handling->TransmissionData.nDriveType == '4')
|
||||
handling->TransmissionData.fEngineAcceleration /= 4.0f;
|
||||
if(handling->Transmission.nDriveType == '4')
|
||||
handling->Transmission.fEngineAcceleration /= 4.0f;
|
||||
else
|
||||
handling->TransmissionData.fEngineAcceleration /= 2.0f;
|
||||
handling->Transmission.fEngineAcceleration /= 2.0f;
|
||||
|
||||
handling->TransmissionData.InitGearRatios();
|
||||
handling->Transmission.InitGearRatios();
|
||||
}
|
||||
|
||||
int32
|
||||
|
@ -94,7 +94,7 @@ struct tHandlingData
|
||||
int8 nPercentSubmerged;
|
||||
float fBuoyancy;
|
||||
float fTractionMultiplier;
|
||||
cTransmission TransmissionData;
|
||||
cTransmission Transmission;
|
||||
float fBrakeDeceleration;
|
||||
float fBrakeBias;
|
||||
int8 bABS;
|
||||
|
@ -35,3 +35,18 @@ cTransmission::InitGearRatios(void)
|
||||
|
||||
Gears[1].fShiftDownVelocity = -0.01f;
|
||||
}
|
||||
|
||||
void
|
||||
cTransmission::CalculateGearForSimpleCar(float speed, uint8 &gear)
|
||||
{
|
||||
static tGear *pGearRatio = &Gears[gear];
|
||||
fCurVelocity = speed;
|
||||
if(speed > pGearRatio->fShiftUpVelocity)
|
||||
gear++;
|
||||
else if(speed < pGearRatio->fShiftDownVelocity){
|
||||
if(gear - 1 < 0)
|
||||
gear = 0;
|
||||
else
|
||||
gear--;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,8 @@ public:
|
||||
float fMaxVelocity;
|
||||
float fUnkMaxVelocity;
|
||||
float fMaxReverseVelocity;
|
||||
float field_5C;
|
||||
float fCurVelocity;
|
||||
|
||||
void InitGearRatios(void);
|
||||
void CalculateGearForSimpleCar(float speed, uint8 &gear);
|
||||
};
|
||||
|
@ -56,16 +56,16 @@ CVehicle::CVehicle(uint8 CreatedBy)
|
||||
for(i = 0; i < m_nNumMaxPassengers; i++)
|
||||
pPassengers[i] = nil;
|
||||
m_nBombTimer = 0;
|
||||
m_pWhoSetMeOnFire = nil;
|
||||
m_pBlowUpEntity = nil;
|
||||
field_1FB = 0;
|
||||
bComedyControls = false;
|
||||
m_veh_flagB40 = false;
|
||||
m_veh_flagB80 = false;
|
||||
m_veh_flagC1 = false;
|
||||
bIsDamaged = false;
|
||||
m_veh_flagC8 = false;
|
||||
bFadeOut = false;
|
||||
m_veh_flagC10 = false;
|
||||
m_veh_flagC4 = false;
|
||||
bHasBeenOwnedByPlayer = false;
|
||||
m_veh_flagC20 = false;
|
||||
bCanBeDamaged = true;
|
||||
m_veh_flagC80 = false;
|
||||
@ -96,11 +96,11 @@ CVehicle::CVehicle(uint8 CreatedBy)
|
||||
m_comedyControlState = 0;
|
||||
m_aCollPolys[0].valid = false;
|
||||
m_aCollPolys[1].valid = false;
|
||||
m_autoPilot.m_nCarMission = MISSION_NONE;
|
||||
m_autoPilot.m_nAnimationId = TEMPACT_NONE;
|
||||
m_autoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
||||
m_autoPilot.m_flag4 = false;
|
||||
m_autoPilot.m_flag10 = false;
|
||||
AutoPilot.m_nCarMission = MISSION_NONE;
|
||||
AutoPilot.m_nAnimationId = TEMPACT_NONE;
|
||||
AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
||||
AutoPilot.m_flag4 = false;
|
||||
AutoPilot.m_flag10 = false;
|
||||
}
|
||||
|
||||
CVehicle::~CVehicle()
|
||||
@ -259,7 +259,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
|
||||
|
||||
adhesion *= CTimer::GetTimeStep();
|
||||
if(bAlreadySkidding)
|
||||
adhesion *= m_handling->fTractionLoss;
|
||||
adhesion *= pHandling->fTractionLoss;
|
||||
|
||||
// moving sideways
|
||||
if(contactSpeedRight != 0.0f){
|
||||
@ -318,7 +318,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
|
||||
}
|
||||
|
||||
float l = Sqrt(sq(right) + sq(fwd));
|
||||
float tractionLoss = bAlreadySkidding ? 1.0f : m_handling->fTractionLoss;
|
||||
float tractionLoss = bAlreadySkidding ? 1.0f : pHandling->fTractionLoss;
|
||||
right *= adhesion * tractionLoss / l;
|
||||
fwd *= adhesion * tractionLoss / l;
|
||||
}
|
||||
@ -374,20 +374,21 @@ CVehicle::ProcessDelayedExplosion(void)
|
||||
if(m_nBombTimer == 0)
|
||||
return;
|
||||
|
||||
if(m_nBombTimer == 0){
|
||||
int tick = CTimer::GetTimeStep()/60.0f*1000.0f;
|
||||
if(tick > m_nBombTimer)
|
||||
m_nBombTimer = 0;
|
||||
else
|
||||
m_nBombTimer -= tick;
|
||||
int tick = CTimer::GetTimeStep()/60.0f*1000.0f;
|
||||
if(tick > m_nBombTimer)
|
||||
m_nBombTimer = 0;
|
||||
else
|
||||
m_nBombTimer -= tick;
|
||||
|
||||
if(IsCar() && ((CAutomobile*)this)->m_auto_flagA7 == 4 && (m_nBombTimer & 0xFE00) != 0xFE00)
|
||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_BOMB_TICK, 0.0f);
|
||||
if(IsCar() && ((CAutomobile*)this)->m_bombType == 4 && (m_nBombTimer & 0xFE00) != 0xFE00)
|
||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_BOMB_TICK, 0.0f);
|
||||
|
||||
if(FindPlayerVehicle() != this && m_pWhoSetMeOnFire == FindPlayerPed())
|
||||
CWorld::Players[CWorld::PlayerInFocus].AwardMoneyForExplosion(this);
|
||||
BlowUpCar(m_pWhoSetMeOnFire);
|
||||
}
|
||||
if (m_nBombTimer != 0)
|
||||
return;
|
||||
|
||||
if(FindPlayerVehicle() != this && m_pBlowUpEntity == FindPlayerPed())
|
||||
CWorld::Players[CWorld::PlayerInFocus].AwardMoneyForExplosion(this);
|
||||
BlowUpCar(m_pBlowUpEntity);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -449,7 +450,7 @@ CVehicle::IsVehicleNormal(void)
|
||||
bool
|
||||
CVehicle::CarHasRoof(void)
|
||||
{
|
||||
if((m_handling->Flags & HANDLING_HAS_NO_ROOF) == 0)
|
||||
if((pHandling->Flags & HANDLING_HAS_NO_ROOF) == 0)
|
||||
return true;
|
||||
if(m_aExtras[0] && m_aExtras[1])
|
||||
return false;
|
||||
@ -519,7 +520,7 @@ bool
|
||||
CVehicle::CanPedOpenLocks(CPed *ped)
|
||||
{
|
||||
if(m_nDoorLock == CARLOCK_LOCKED ||
|
||||
m_nDoorLock == CARLOCK_COP_CAR ||
|
||||
m_nDoorLock == CARLOCK_LOCKED_INITIALLY ||
|
||||
m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE)
|
||||
return false;
|
||||
if(ped->IsPlayer() && m_nDoorLock == CARLOCK_LOCKOUT_PLAYER_ONLY)
|
||||
|
@ -20,7 +20,7 @@ enum eCarLock {
|
||||
CARLOCK_LOCKED,
|
||||
CARLOCK_LOCKOUT_PLAYER_ONLY,
|
||||
CARLOCK_LOCKED_PLAYER_INSIDE,
|
||||
CARLOCK_COP_CAR,
|
||||
CARLOCK_LOCKED_INITIALLY,
|
||||
CARLOCK_FORCE_SHUT_DOORS,
|
||||
CARLOCK_SKIP_SHUT_DOORS
|
||||
};
|
||||
@ -125,8 +125,8 @@ class CVehicle : public CPhysical
|
||||
{
|
||||
public:
|
||||
// 0x128
|
||||
tHandlingData *m_handling;
|
||||
CAutoPilot m_autoPilot;
|
||||
tHandlingData *pHandling;
|
||||
CAutoPilot AutoPilot;
|
||||
uint8 m_currentColour1;
|
||||
uint8 m_currentColour2;
|
||||
uint8 m_aExtras[2];
|
||||
@ -162,14 +162,14 @@ public:
|
||||
uint8 bIsBig: 1; // Is this vehicle a bus
|
||||
uint8 bLowVehicle: 1; // Need this for sporty type cars to use low getting-in/out anims
|
||||
uint8 bComedyControls : 1; // Will make the car hard to control (hopefully in a funny way)
|
||||
uint8 m_veh_flagB20 : 1;
|
||||
uint8 bWarnedPeds : 1; // Has scan and warn peds of danger been processed?
|
||||
uint8 m_veh_flagB40 : 1;
|
||||
uint8 m_veh_flagB80 : 1;
|
||||
|
||||
uint8 m_veh_flagC1 : 1;
|
||||
uint8 bIsDamaged : 1; // This vehicle has been damaged and is displaying all its components
|
||||
uint8 m_veh_flagC4 : 1;
|
||||
uint8 m_veh_flagC8 : 1;
|
||||
uint8 bHasBeenOwnedByPlayer : 1;// To work out whether stealing it is a crime
|
||||
uint8 bFadeOut : 1; // Fade vehicle out
|
||||
uint8 m_veh_flagC10 : 1;
|
||||
uint8 m_veh_flagC20 : 1;
|
||||
uint8 bCanBeDamaged : 1; // Set to FALSE during cut scenes to avoid explosions
|
||||
@ -196,7 +196,7 @@ public:
|
||||
uint32 m_nTimeOfDeath;
|
||||
int16 field_214;
|
||||
int16 m_nBombTimer; // goes down with each frame
|
||||
CPed *m_pWhoSetMeOnFire;
|
||||
CEntity *m_pBlowUpEntity;
|
||||
float field_21C;
|
||||
float field_220;
|
||||
eCarLock m_nDoorLock;
|
||||
|
Loading…
Reference in New Issue
Block a user