summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio/AudioManager.h1
-rw-r--r--src/audio/DMAudio.cpp3
-rw-r--r--src/audio/DMAudio.h4
-rw-r--r--src/control/Pickups.cpp3
-rw-r--r--src/control/Pickups.h4
-rw-r--r--src/control/Restart.cpp7
-rw-r--r--src/control/Restart.h10
-rw-r--r--src/control/Script.cpp483
-rw-r--r--src/core/Camera.cpp10
-rw-r--r--src/core/Camera.h5
-rw-r--r--src/core/Radar.cpp16
-rw-r--r--src/core/Radar.h8
-rw-r--r--src/entities/Physical.cpp2
-rw-r--r--src/peds/Ped.cpp6
14 files changed, 534 insertions, 28 deletions
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 1ae50b2f..4a59721b 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -175,7 +175,6 @@ class CPed;
struct cAudioScriptObject {
int16 m_wSound;
- char gap_2[2];
CVector m_vecPos;
int m_nAudioEntityId;
diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp
index 2019c394..6c5ad6e3 100644
--- a/src/audio/DMAudio.cpp
+++ b/src/audio/DMAudio.cpp
@@ -35,3 +35,6 @@ WRAPPER void cDMAudio::SetRadioInCar(int32) { EAXJMP(0x57CE60); }
WRAPPER void cDMAudio::DestroyEntity(int32) { EAXJMP(0x57C7F0); }
WRAPPER void cDMAudio::ClearMissionAudio(void) { EAXJMP(0x57CE20); }
WRAPPER void cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos) { EAXJMP(0x57CAD0); }
+WRAPPER void cDMAudio::CreateOneShotScriptObject(cAudioScriptObject*) { EAXJMP(0x57CB60); }
+WRAPPER int32 cDMAudio::CreateLoopingScriptObject(cAudioScriptObject*) { EAXJMP(0x57CB00); }
+WRAPPER void cDMAudio::DestroyLoopingScriptObject(int32) { EAXJMP(0x57CB40); }
diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h
index 907755b9..09daea5c 100644
--- a/src/audio/DMAudio.h
+++ b/src/audio/DMAudio.h
@@ -174,6 +174,7 @@ enum eSound : int16
class CEntity;
enum eCrimeType;
+struct cAudioScriptObject;
class cDMAudio
{
@@ -206,5 +207,8 @@ public:
void DestroyEntity(int32);
void ClearMissionAudio(void);
void ReportCrime(eCrimeType crime, const CVector &pos);
+ void CreateOneShotScriptObject(cAudioScriptObject*);
+ int32 CreateLoopingScriptObject(cAudioScriptObject*);
+ void DestroyLoopingScriptObject(int32);
};
extern cDMAudio &DMAudio;
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 2770a948..81642a85 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -5,7 +5,8 @@
CPickup(&CPickups::aPickUps)[NUMPICKUPS] = *(CPickup(*)[NUMPICKUPS])*(uintptr*)0x878C98;
// 20 ?! Some Miami leftover? (Originally at 0x5ED8D4)
-uint16 CPickups::ms_maxAmmosForWeapons[20] = { 0, 1, 45, 125, 25, 150, 300, 25, 5, 250, 5, 5, 0, 500, 0, 100, 0, 0, 0, 0 };
+uint16 AmmoForWeapon[20] = { 0, 1, 45, 125, 25, 150, 300, 25, 5, 250, 5, 5, 0, 500, 0, 100, 0, 0, 0, 0 };
+uint16 AmmoForWeapon_OnStreet[20] = { 0, 1, 9, 25, 5, 30, 60, 5, 1, 50, 1, 1, 0, 200, 0, 100, 0, 0, 0, 0 };
WRAPPER void CPickups::RenderPickUpText(void) { EAXJMP(0x432440); }
WRAPPER void CPickups::DoCollectableEffects(CEntity *ent) { EAXJMP(0x431C30); }
diff --git a/src/control/Pickups.h b/src/control/Pickups.h
index 20a779a8..8c2014d6 100644
--- a/src/control/Pickups.h
+++ b/src/control/Pickups.h
@@ -47,9 +47,11 @@ public:
static int32 GenerateNewOne_WeaponType(CVector, eWeaponType, uint8, uint32);
static CPickup (&aPickUps)[NUMPICKUPS];
- static uint16 ms_maxAmmosForWeapons[20];
};
+extern uint16 AmmoForWeapon[20];
+extern uint16 AmmoForWeapon_OnStreet[20];
+
class CPacManPickups
{
public:
diff --git a/src/control/Restart.cpp b/src/control/Restart.cpp
new file mode 100644
index 00000000..c5c46b51
--- /dev/null
+++ b/src/control/Restart.cpp
@@ -0,0 +1,7 @@
+#include "common.h"
+#include "patcher.h"
+#include "Restart.h"
+
+WRAPPER void CRestart::AddHospitalRestartPoint(const CVector&, float) { EAXJMP(0x436100); }
+WRAPPER void CRestart::AddPoliceRestartPoint(const CVector&, float) { EAXJMP(0x436150); }
+WRAPPER void CRestart::OverrideNextRestart(const CVector&, float) { EAXJMP(0x4366C0); } \ No newline at end of file
diff --git a/src/control/Restart.h b/src/control/Restart.h
new file mode 100644
index 00000000..90da8e89
--- /dev/null
+++ b/src/control/Restart.h
@@ -0,0 +1,10 @@
+#pragma once
+#pragma once
+
+class CRestart
+{
+public:
+ static void AddPoliceRestartPoint(const CVector&, float);
+ static void AddHospitalRestartPoint(const CVector&, float);
+ static void OverrideNextRestart(const CVector&, float);
+};
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index b61a466b..423f36dd 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -27,7 +27,9 @@
#include "Pools.h"
#include "Population.h"
#include "Remote.h"
+#include "Restart.h"
#include "Replay.h"
+#include "Shadows.h"
#include "Streaming.h"
#include "Text.h"
#include "User.h"
@@ -1384,20 +1386,20 @@ void CRunningScript::UpdateCompareFlag(bool flag)
{
if (m_bNotFlag)
flag = !flag;
- if (m_nAndOrState == 0){
+ if (m_nAndOrState == ANDOR_NONE){
m_bCondResult = flag;
return;
}
- if (m_nAndOrState >= 1 && m_nAndOrState <= 8) { /* Maybe enums?*/
+ if (m_nAndOrState >= ANDS_1 && m_nAndOrState <= ANDS_8){
m_bCondResult &= flag;
- if (m_nAndOrState == 1){
- m_nAndOrState = 0;
+ if (m_nAndOrState == ANDS_1){
+ m_nAndOrState = ANDOR_NONE;
return;
}
- }else if (m_nAndOrState >= 21 && m_nAndOrState <= 28){
+ }else if (m_nAndOrState >= ORS_1 && m_nAndOrState <= ORS_8){
m_bCondResult |= flag;
- if (m_nAndOrState == 21) {
- m_nAndOrState = 0;
+ if (m_nAndOrState == ORS_1) {
+ m_nAndOrState = ANDOR_NONE;
return;
}
}else{
@@ -2803,7 +2805,7 @@ int8 CRunningScript::ProcessCommandsFrom200To299(int32 command)
return -1;
}
-#if 1
+#if 0
WRAPPER int8 CRunningScript::ProcessCommandsFrom300To399(int32 command) { EAXJMP(0x43ED30); }
#else
int8 CRunningScript::ProcessCommandsFrom300To399(int32 command)
@@ -2846,6 +2848,7 @@ int8 CRunningScript::ProcessCommandsFrom300To399(int32 command)
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle);
UpdateCompareFlag(pVehicle->GetModelIndex() == ScriptParams[1]);
+ return 0;
}
/* Not implemented.
case COMMAND_IS_CAR_REMAP:
@@ -3010,67 +3013,529 @@ int8 CRunningScript::ProcessCommandsFrom300To399(int32 command)
{
char label[12];
CTheScripts::ReadTextLabelFromScript(&m_nIp, label);
+ int16 zone = CTheZones::FindZoneByLabelAndReturnIndex(label);
m_nIp += 8;
-
+ CollectParameters(&m_nIp, 2);
+ if (zone < 0) {
+ debug("Couldn't find zone - %s\n", label);
+ return 0;
+ }
+ CTheZones::SetCarDensity(zone, ScriptParams[0], ScriptParams[1]);
+ return 0;
}
case COMMAND_SET_PED_DENSITY:
+ {
+ char label[12];
+ CTheScripts::ReadTextLabelFromScript(&m_nIp, label);
+ int16 zone = CTheZones::FindZoneByLabelAndReturnIndex(label);
+ m_nIp += 8;
+ CollectParameters(&m_nIp, 2);
+ if (zone < 0) {
+ debug("Couldn't find zone - %s\n", label);
+ return 0;
+ }
+ CTheZones::SetPedDensity(zone, ScriptParams[0], ScriptParams[1]);
+ return 0;
+ }
case COMMAND_POINT_CAMERA_AT_PLAYER:
+ {
+ CollectParameters(&m_nIp, 3);
+ // ScriptParams[0] is unused.
+ TheCamera.TakeControl(nil, ScriptParams[1], ScriptParams[2], 1);
+ return 0;
+ }
case COMMAND_POINT_CAMERA_AT_CAR:
+ {
+ CollectParameters(&m_nIp, 3);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ TheCamera.TakeControl(pVehicle, ScriptParams[1], ScriptParams[2], 1);
+ return 0;
+ }
case COMMAND_POINT_CAMERA_AT_CHAR:
+ {
+ CollectParameters(&m_nIp, 3);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ TheCamera.TakeControl(pPed, ScriptParams[1], ScriptParams[2], 1);
+ return 0;
+ }
case COMMAND_RESTORE_CAMERA:
+ TheCamera.Restore();
+ return 0;
case COMMAND_SHAKE_PAD:
+ CPad::GetPad(ScriptParams[0])->StartShake(ScriptParams[1], ScriptParams[2]);
+ return 0;
case COMMAND_SET_ZONE_PED_INFO:
+ {
+ char label[12];
+ CTheScripts::ReadTextLabelFromScript(&m_nIp, label);
+ m_nIp += 8;
+ CollectParameters(&m_nIp, 10);
+ int16 zone = CTheZones::FindZoneByLabelAndReturnIndex(label);
+ if (zone < 0) {
+ debug("Couldn't find zone - %s\n", label);
+ return 0;
+ }
+ CTheZones::SetZonePedInfo(zone, ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3],
+ ScriptParams[4], ScriptParams[5], ScriptParams[6], ScriptParams[7], ScriptParams[8], 0, 0, ScriptParams[9]);
+ return 0;
+ }
case COMMAND_SET_TIME_SCALE:
+ CollectParameters(&m_nIp, 1);
+ CTimer::SetTimeScale(*(float*)&ScriptParams[0]);
+ return 0;
case COMMAND_IS_CAR_IN_AIR:
+ {
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle && pVehicle->IsCar());
+ CAutomobile* pCar = (CAutomobile*)pVehicle;
+ UpdateCompareFlag(pCar->GetAllWheelsOffGround());
+ return 0;
+ }
case COMMAND_SET_FIXED_CAMERA_POSITION:
+ {
+ CollectParameters(&m_nIp, 6);
+ TheCamera.SetCamPositionForFixedMode(
+ CVector(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1], *(float*)&ScriptParams[2]),
+ CVector(*(float*)&ScriptParams[3], *(float*)&ScriptParams[4], *(float*)&ScriptParams[5]));
+ return 0;
+ }
case COMMAND_POINT_CAMERA_AT_POINT:
+ {
+ CollectParameters(&m_nIp, 4);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ TheCamera.TakeControlNoEntity(pos, ScriptParams[3], 1);
+ return 0;
+ }
case COMMAND_ADD_BLIP_FOR_CAR_OLD:
+ {
+ CollectParameters(&m_nIp, 3);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ // Useless call.
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ ScriptParams[0] = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_ADD_BLIP_FOR_CHAR_OLD:
+ {
+ CollectParameters(&m_nIp, 3);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ // Useless call.
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ ScriptParams[0] = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_ADD_BLIP_FOR_OBJECT_OLD:
+ {
+ CollectParameters(&m_nIp, 3);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ assert(pObject);
+ // Useless call.
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ ScriptParams[0] = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_REMOVE_BLIP:
+ CollectParameters(&m_nIp, 1);
+ CRadar::ClearBlip(ScriptParams[0]);
+ return 0;
case COMMAND_CHANGE_BLIP_COLOUR:
+ CollectParameters(&m_nIp, 2);
+ CRadar::ChangeBlipColour(ScriptParams[0], ScriptParams[1]);
+ return 0;
case COMMAND_DIM_BLIP:
+ CollectParameters(&m_nIp, 2);
+ CRadar::ChangeBlipBrightness(ScriptParams[0], ScriptParams[1]);
+ return 0;
case COMMAND_ADD_BLIP_FOR_COORD_OLD:
+ {
+ CollectParameters(&m_nIp, 5);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ // Useless call
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ ScriptParams[0] = CRadar::SetCoordBlip(BLIP_COORD, pos, ScriptParams[3], (eBlipDisplay)ScriptParams[4]);
+ return 0;
+ }
case COMMAND_CHANGE_BLIP_SCALE:
+ CollectParameters(&m_nIp, 2);
+ CRadar::ChangeBlipScale(ScriptParams[0], ScriptParams[1]);
+ return 0;
case COMMAND_SET_FADING_COLOUR:
+ CollectParameters(&m_nIp, 3);
+ TheCamera.SetFadeColour(ScriptParams[0], ScriptParams[1], ScriptParams[2]);
+ return 0;
case COMMAND_DO_FADE:
+ CollectParameters(&m_nIp, 2);
+ TheCamera.Fade(ScriptParams[0] / 1000.0f, ScriptParams[1]);
+ return 0;
case COMMAND_GET_FADING_STATUS:
+ UpdateCompareFlag(TheCamera.GetFading());
+ return 0;
case COMMAND_ADD_HOSPITAL_RESTART:
+ {
+ CollectParameters(&m_nIp, 4);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ float angle = *(float*)&ScriptParams[3];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ CRestart::AddHospitalRestartPoint(pos, angle);
+ return 0;
+ }
case COMMAND_ADD_POLICE_RESTART:
+ {
+ CollectParameters(&m_nIp, 4);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ float angle = *(float*)&ScriptParams[3];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ CRestart::AddPoliceRestartPoint(pos, angle);
+ return 0;
+ }
case COMMAND_OVERRIDE_NEXT_RESTART:
+ {
+ CollectParameters(&m_nIp, 4);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ float angle = *(float*)&ScriptParams[3];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ CRestart::OverrideNextRestart(pos, angle);
+ return 0;
+ }
case COMMAND_DRAW_SHADOW:
+ {
+ CollectParameters(&m_nIp, 10);
+ CVector pos = *(CVector*)&ScriptParams[1];
+ float angle = *(float*)&ScriptParams[4];
+ float length = *(float*)&ScriptParams[5];
+ float x, y;
+ if (angle != 0.0f){
+ y = cos(angle) * length;
+ x = sin(angle) * length;
+ }else{
+ y = length;
+ x = 0.0f;
+ }
+ float frontX = -x;
+ float frontY = y;
+ float sideX = y;
+ float sideY = x;
+ /* Not very nicely named intermediate variables. */
+ CShadows::StoreShadowToBeRendered(ScriptParams[0], &pos, frontX, frontY, sideX, sideY,
+ ScriptParams[6], ScriptParams[7], ScriptParams[8], ScriptParams[9]);
+ return 0;
+ }
case COMMAND_GET_PLAYER_HEADING:
+ {
+ CollectParameters(&m_nIp, 1);
+ CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ float angle = pPed->bInVehicle ?
+ Atan2(-pPed->m_pMyVehicle->GetForward().x, pPed->m_pMyVehicle->GetForward().y) :
+ Atan2(-pPed->GetForward().x, pPed->GetForward().y);
+ *(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle));
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_SET_PLAYER_HEADING:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ if (pPed->bInVehicle){
+ // Is assertion required?
+ return 0;
+ }
+ pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]);
+ pPed->SetHeading(DEGTORAD(*(float*)&ScriptParams[1]));
+ return 0;
+ }
case COMMAND_GET_CHAR_HEADING:
+ {
+ CollectParameters(&m_nIp, 1);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ float angle = pPed->bInVehicle ?
+ Atan2(-pPed->m_pMyVehicle->GetForward().x, pPed->m_pMyVehicle->GetForward().y) :
+ Atan2(-pPed->GetForward().x, pPed->GetForward().y);
+ *(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle));
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_SET_CHAR_HEADING:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ if (pPed->bInVehicle) {
+ // Is assertion required?
+ return 0;
+ }
+ pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]);
+ pPed->SetHeading(DEGTORAD(*(float*)&ScriptParams[1]));
+ return 0;
+ }
case COMMAND_GET_CAR_HEADING:
+ {
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ float angle = Atan2(-pVehicle->GetForward().x, pVehicle->GetForward().y);
+ *(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle));
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_SET_CAR_HEADING:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ pVehicle->SetHeading(DEGTORAD(*(float*)&ScriptParams[1]));
+ return 0;
+ }
case COMMAND_GET_OBJECT_HEADING:
+ {
+ CollectParameters(&m_nIp, 1);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ assert(pObject);
+ float angle = Atan2(-pObject->GetForward().x, pObject->GetForward().y);
+ *(float*)&ScriptParams[0] = CGeneral::LimitAngle(RADTODEG(angle));
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_SET_OBJECT_HEADING:
+ {
+ CollectParameters(&m_nIp, 2);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ assert(pObject);
+ CWorld::Remove(pObject);
+ pObject->SetHeading(DEGTORAD(*(float*)&ScriptParams[1]));
+ pObject->GetMatrix().UpdateRW();
+ pObject->UpdateRwFrame();
+ CWorld::Add(pObject);
+ return 0;
+ }
case COMMAND_IS_PLAYER_TOUCHING_OBJECT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
+ assert(pObject);
+ CPhysical* pEntityToTest = pPed->bInVehicle ? (CPhysical*)pPed->m_pMyVehicle : pPed;
+ UpdateCompareFlag(pEntityToTest->GetHasCollidedWith(pObject));
+ return 0;
+ }
case COMMAND_IS_CHAR_TOUCHING_OBJECT:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]);
+ assert(pObject);
+ CPhysical* pEntityToTest = pPed->bInVehicle ? (CPhysical*)pPed->m_pMyVehicle : pPed;
+ UpdateCompareFlag(pEntityToTest->GetHasCollidedWith(pObject));
+ return 0;
+ }
case COMMAND_SET_PLAYER_AMMO:
+ {
+ CollectParameters(&m_nIp, 3);
+ CWorld::Players[0].m_pPed->SetAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]);
+ return 0;
+ }
case COMMAND_SET_CHAR_AMMO:
+ {
+ CollectParameters(&m_nIp, 3);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ pPed->SetAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]);
+ return 0;
+ }
+ /* Not implemented.
case COMMAND_SET_CAR_AMMO:
case COMMAND_LOAD_CAMERA_SPLINE:
case COMMAND_MOVE_CAMERA_ALONG_SPLINE:
case COMMAND_GET_CAMERA_POSITION_ALONG_SPLINE:
+ */
case COMMAND_DECLARE_MISSION_FLAG:
+ CTheScripts::OnAMissionFlag = CTheScripts::Read2BytesFromScript(&++m_nIp);
+ return 0;
case COMMAND_DECLARE_MISSION_FLAG_FOR_CONTACT:
+ CollectParameters(&m_nIp, 1);
+ CTheScripts::OnAMissionForContactFlag[ScriptParams[0]] = CTheScripts::Read2BytesFromScript(&++m_nIp);
+ return 0;
case COMMAND_DECLARE_BASE_BRIEF_ID_FOR_CONTACT:
+ CollectParameters(&m_nIp, 2);
+ CTheScripts::BaseBriefIdForContact[ScriptParams[0]] = ScriptParams[1];
+ return 0;
case COMMAND_IS_PLAYER_HEALTH_GREATER:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
+ UpdateCompareFlag(pPed->m_fHealth > ScriptParams[1]);
+ return 0;
+ }
case COMMAND_IS_CHAR_HEALTH_GREATER:
+ {
+ CollectParameters(&m_nIp, 2);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ UpdateCompareFlag(pPed->m_fHealth > ScriptParams[1]);
+ return 0;
+ }
case COMMAND_IS_CAR_HEALTH_GREATER:
+ {
+ CollectParameters(&m_nIp, 2);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ UpdateCompareFlag(pVehicle->m_fHealth > ScriptParams[1]);
+ return 0;
+ }
case COMMAND_ADD_BLIP_FOR_CAR:
+ {
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ // Useless call.
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ int handle = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH);
+ CRadar::ChangeBlipScale(handle, 3);
+ ScriptParams[0] = handle;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_ADD_BLIP_FOR_CHAR:
+ {
+ CollectParameters(&m_nIp, 1);
+ CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
+ assert(pPed);
+ // Useless call.
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ int handle = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH);
+ CRadar::ChangeBlipScale(handle, 3);
+ ScriptParams[0] = handle;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_ADD_BLIP_FOR_OBJECT:
+ {
+ CollectParameters(&m_nIp, 1);
+ CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ assert(pObject);
+ // Useless call.
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ int handle = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 0, BLIP_DISPLAY_BOTH);
+ CRadar::ChangeBlipScale(handle, 3);
+ ScriptParams[0] = handle;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_ADD_BLIP_FOR_CONTACT_POINT:
+ {
+ CollectParameters(&m_nIp, 3);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ // Useless call
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ int handle = CRadar::SetCoordBlip(BLIP_COORD, pos, 2, BLIP_DISPLAY_BOTH);
+ CRadar::ChangeBlipScale(handle, 3);
+ ScriptParams[0] = handle;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_ADD_BLIP_FOR_COORD:
+ {
+ CollectParameters(&m_nIp, 3);
+ CVector pos = *(CVector*)&ScriptParams[0];
+ if (pos.z <= -100.0f)
+ pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
+ // Useless call
+ CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
+ int handle = CRadar::SetCoordBlip(BLIP_COORD, pos, 5, BLIP_DISPLAY_BOTH);
+ CRadar::ChangeBlipScale(handle, 3);
+ ScriptParams[0] = handle;
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_CHANGE_BLIP_DISPLAY:
+ CollectParameters(&m_nIp, 2);
+ CRadar::ChangeBlipDisplay(ScriptParams[0], (eBlipDisplay)ScriptParams[1]);
+ return 0;
case COMMAND_ADD_ONE_OFF_SOUND:
+ {
+ CollectParameters(&m_nIp, 4);
+ switch (ScriptParams[3]) {
+ case SCRIPT_SOUND_EVIDENCE_PICKUP:
+ DMAudio.PlayFrontEndSound(SOUND_EVIDENCE_PICKUP, 0);
+ return 0;
+ case SCRIPT_SOUND_UNLOAD_GOLD:
+ DMAudio.PlayFrontEndSound(SOUND_UNLOAD_GOLD, 0);
+ return 0;
+ case SCRIPT_SOUND_PART_MISSION_COMPLETE:
+ DMAudio.PlayFrontEndSound(SOUND_PART_MISSION_COMPLETE, 0);
+ return 0;
+ case SCRIPT_SOUND_RACE_START_3:
+ DMAudio.PlayFrontEndSound(SOUND_RACE_START_3, 0);
+ return 0;
+ case SCRIPT_SOUND_RACE_START_2:
+ DMAudio.PlayFrontEndSound(SOUND_RACE_START_2, 0);
+ return 0;
+ case SCRIPT_SOUND_RACE_START_1:
+ DMAudio.PlayFrontEndSound(SOUND_RACE_START_1, 0);
+ return 0;
+ case SCRIPT_SOUND_RACE_START_GO:
+ DMAudio.PlayFrontEndSound(SOUND_RACE_START_GO, 0);
+ return 0;
+ default:
+ break;
+ }
+ cAudioScriptObject* obj = new cAudioScriptObject();
+ obj->m_vecPos = *(CVector*)&ScriptParams[0];
+ obj->m_wSound = ScriptParams[3];
+ obj->m_nAudioEntityId = -5;
+ /* BUG: if audio is not initialized, this object will not be freed. */
+ /* Issue needs to be addressed in CreateOneShotScriptObject. */
+ DMAudio.CreateOneShotScriptObject(obj);
+ return 0;
+ }
case COMMAND_ADD_CONTINUOUS_SOUND:
+ {
+ CollectParameters(&m_nIp, 4);
+ cAudioScriptObject* obj = new cAudioScriptObject();
+ obj->m_vecPos = *(CVector*)&ScriptParams[0];
+ obj->m_wSound = ScriptParams[3];
+ obj->m_nAudioEntityId = DMAudio.CreateLoopingScriptObject(obj);
+ ScriptParams[0] = CPools::GetAudioScriptObjectPool()->GetIndex(obj);
+ StoreParameters(&m_nIp, 1);
+ return 0;
+ }
case COMMAND_REMOVE_SOUND:
+ {
+ CollectParameters(&m_nIp, 1);
+ cAudioScriptObject* obj = CPools::GetAudioScriptObjectPool()->GetAt(ScriptParams[0]);
+ if (!obj){
+ debug("REMOVE_SOUND - Sound doesn't exist\n");
+ return 0;
+ }
+ DMAudio.DestroyLoopingScriptObject(obj->m_nAudioEntityId);
+ delete obj;
+ return 0;
+ }
case COMMAND_IS_CAR_STUCK_ON_ROOF:
+ {
+ CollectParameters(&m_nIp, 1);
+ CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
+ assert(pVehicle);
+ UpdateCompareFlag(CTheScripts::UpsideDownCars.HasCarBeenUpsideDownForAWhile(ScriptParams[0]));
+ return 0;
+ }
default:
assert(0);
}
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index b5ba76db..f3582c67 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -24,6 +24,16 @@ WRAPPER void CCamera::CalculateDerivedValues(void) { EAXJMP(0x46EEA0); }
WRAPPER void CCamera::Restore(void) { EAXJMP(0x46F990); }
WRAPPER void CCamera::SetWidescreenOff(void) { EAXJMP(0x46FF10); }
WRAPPER void CamShakeNoPos(CCamera*, float) { EAXJMP(0x46B100); }
+WRAPPER void CCamera::TakeControl(CEntity*, int16, int16, int32) { EAXJMP(0x471500); }
+WRAPPER void CCamera::TakeControlNoEntity(const CVector&, int16, int32) { EAXJMP(0x4715B0); }
+WRAPPER void CCamera::SetCamPositionForFixedMode(const CVector&, const CVector&) { EAXJMP(0x46FCC0); }
+
+
+bool
+CCamera::GetFading()
+{
+ return m_bFading;
+}
bool
CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat)
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 3ce0d9a6..97ed79f4 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -471,6 +471,11 @@ int m_iModeObbeCamIsInForCar;
float Find3rdPersonQuickAimPitch(void);
+ void TakeControl(CEntity*, int16, int16, int32);
+ void TakeControlNoEntity(const CVector&, int16, int32);
+ void SetCamPositionForFixedMode(const CVector&, const CVector&);
+ bool GetFading();
+
void dtor(void) { this->CCamera::~CCamera(); }
};
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index ea7a7ffa..f04e14d1 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -100,9 +100,9 @@ void CRadar::ChangeBlipBrightness(int32 i, int32 bright)
#endif
#if 1
-WRAPPER void CRadar::ChangeBlipColour(int32) { EAXJMP(0x4A5770); }
+WRAPPER void CRadar::ChangeBlipColour(int32, int32) { EAXJMP(0x4A5770); }
#else
-void CRadar::ChangeBlipColour(int32 i)
+void CRadar::ChangeBlipColour(int32 i, int32)
{
}
@@ -571,9 +571,9 @@ void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float
#endif
#if 1
-WRAPPER int32 CRadar::GetActualBlipArray(int32) { EAXJMP(0x4A41C0); }
+WRAPPER int32 CRadar::GetActualBlipArrayIndex(int32) { EAXJMP(0x4A41C0); }
#else
-int32 CRadar::GetActualBlipArray(int32 i)
+int32 CRadar::GetActualBlipArrayIndex(int32 i)
{
return int32();
}
@@ -737,18 +737,18 @@ void CRadar::SetBlipSprite(int32 i, int32 icon)
#endif
#if 1
-WRAPPER int CRadar::SetCoordBlip(int32, CVector, int32) { EAXJMP(0x4A5590); }
+WRAPPER int32 CRadar::SetCoordBlip(eBlipType, CVector, int32, eBlipDisplay) { EAXJMP(0x4A5590); }
#else
-int CRadar::SetCoordBlip(int32 type, CVector pos, int32 flag)
+int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 flag, eBlipDisplay)
{
return 0;
}
#endif
#if 1
-WRAPPER int CRadar::SetEntityBlip(int32 type, CVector pos, int32 color, int32 flag) { EAXJMP(0x4A5640); }
+WRAPPER int CRadar::SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay) { EAXJMP(0x4A5640); }
#else
-int CRadar::SetEntityBlip(int32 type, CVector pos, int32 color, int32 flag)
+int CRadar::SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay)
{
return 0;
}
diff --git a/src/core/Radar.h b/src/core/Radar.h
index e5396a50..1ec28070 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -98,7 +98,7 @@ public:
public:
static int CalculateBlipAlpha(float dist);
static void ChangeBlipBrightness(int32 i, int32 bright);
- static void ChangeBlipColour(int32 i);
+ static void ChangeBlipColour(int32 i, int32);
static void ChangeBlipDisplay(int32 i, int16 flag);
static void ChangeBlipScale(int32 i, int16 scale);
static void ClearBlip(int32 i);
@@ -113,7 +113,7 @@ public:
static void DrawRadarSection(int32 x, int32 y);
static void DrawRadarSprite(int32 sprite, float x, float y, int32 alpha);
static void DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha);
- static int32 GetActualBlipArray(int32 i);
+ static int32 GetActualBlipArrayIndex(int32 i);
static int32 GetNewUniqueBlipIndex(int32 i);
static int32 GetRadarTraceColour(int32 color, bool bright);
static void Initialise();
@@ -125,8 +125,8 @@ public:
static void RequestMapSection(int32 x, int32 y);
static void SaveAllRadarBlips(int32);
static void SetBlipSprite(int32 i, int32 icon);
- static int SetCoordBlip(int32 type, CVector pos, int32 flag);
- static int SetEntityBlip(int32 type, CVector pos, int32 color, int32 flag);
+ static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay flag);
+ static int32 SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay);
static void SetRadarMarkerState(int32 i, int32 flag);
static void ShowRadarMarker(CVector pos, int16 color, float radius);
static void ShowRadarTrace(float x, float y, uint32 size, uint32 red, uint32 green, uint32 blue, uint32 alpha);
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index 55ed5380..391f1e33 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -62,7 +62,7 @@ CPhysical::CPhysical(void)
m_phy_flagA10 = false;
m_phy_flagA20 = false;
- m_nSurfaceTouched = SURFACE_DEFAULT;
+ m_nZoneLevel = 0;
}
CPhysical::~CPhysical(void)
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index d05568f6..8b988772 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -5349,12 +5349,12 @@ CPed::CreateDeadPedWeaponPickups(void)
// otherwise try another position (but disregard second check apparently)
angleToPed += 3.14f;
pickupPos = GetPosition();
- pickupPos.x = 1.5f * Sin(angleToPed);
- pickupPos.y = 1.5f * Cos(angleToPed);
+ pickupPos.x += 1.5f * Sin(angleToPed);
+ pickupPos.y += 1.5f * Cos(angleToPed);
pickupPos.z = CWorld::FindGroundZFor3DCoord(pickupPos.x, pickupPos.y, pickupPos.z, &found) + 0.5f;
}
if (found)
- CPickups::GenerateNewOne_WeaponType(pickupPos, weapon, PICKUP_ONCE_TIMEOUT, min(weaponAmmo, CPickups::ms_maxAmmosForWeapons[weapon]));
+ CPickups::GenerateNewOne_WeaponType(pickupPos, weapon, PICKUP_ONCE_TIMEOUT, min(weaponAmmo, AmmoForWeapon_OnStreet[weapon]));
}
ClearWeapons();
}