summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-06-25 09:15:19 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2021-06-25 09:15:19 +0200
commit8a5afd0db2fa2616556ed953c5c464c6930d6f47 (patch)
tree0747c8742ffb38488e7d3569d92ff5ba1c3a5e39 /src/control
parentMerge remote-tracking branch 'upstream/lcs' into lcs (diff)
parentMerge remote-tracking branch 'origin/miami' into lcs (diff)
downloadre3-8a5afd0db2fa2616556ed953c5c464c6930d6f47.tar
re3-8a5afd0db2fa2616556ed953c5c464c6930d6f47.tar.gz
re3-8a5afd0db2fa2616556ed953c5c464c6930d6f47.tar.bz2
re3-8a5afd0db2fa2616556ed953c5c464c6930d6f47.tar.lz
re3-8a5afd0db2fa2616556ed953c5c464c6930d6f47.tar.xz
re3-8a5afd0db2fa2616556ed953c5c464c6930d6f47.tar.zst
re3-8a5afd0db2fa2616556ed953c5c464c6930d6f47.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/CarCtrl.cpp8
-rw-r--r--src/control/Garages.cpp10
-rw-r--r--src/control/PathFind.cpp10
-rw-r--r--src/control/PathFind.h8
-rw-r--r--src/control/Phones.cpp10
-rw-r--r--src/control/Pickups.cpp25
-rw-r--r--src/control/Replay.cpp24
-rw-r--r--src/control/RoadBlocks.cpp6
-rw-r--r--src/control/Script.cpp4
-rw-r--r--src/control/Script10.cpp2
-rw-r--r--src/control/Script2.cpp4
-rw-r--r--src/control/Script4.cpp12
-rw-r--r--src/control/Script5.cpp16
-rw-r--r--src/control/Script7.cpp6
-rw-r--r--src/control/Script8.cpp6
-rw-r--r--src/control/Script9.cpp8
-rw-r--r--src/control/SetPieces.cpp4
17 files changed, 91 insertions, 72 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index e92f26c9..44e7ae40 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -1603,8 +1603,8 @@ void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float
forward.Normalise();
float forwardAngle = GetATanOfXY(forward.x, forward.y);
float angleDiff = angleBetweenVehicles - forwardAngle;
- float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * sin(angleDiff));
- float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * cos(angleDiff));
+ float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * Sin(angleDiff));
+ float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * Cos(angleDiff));
float lengthToEvade = (2 * (lenProjection + widthProjection) + WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x) / distance;
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicles - *pAngleToWeaveLeft);
diffToLeftAngle = ABS(diffToLeftAngle);
@@ -2790,7 +2790,7 @@ void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane)
up.Normalise();
CVector forward(Cos(pPlane->m_fOrientation), Sin(pPlane->m_fOrientation), fForwardZ);
forward.Normalise();
- CVector right = CrossProduct(forward, up);
+ CVector right = CrossProduct(up, forward);
right.z -= 5.0f * pPlane->m_fPlaneSteer;
right.Normalise();
up = CrossProduct(forward, right);
@@ -3273,7 +3273,7 @@ bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos)
attempts += 1;
}
if (attempts >= 5)
- return nil;
+ return false;
CAutomobile* pVehicle = new CAutomobile(mi, RANDOM_VEHICLE);
pVehicle->AutoPilot.m_vecDestinationCoors = vecPos;
pVehicle->SetPosition(spawnPos);
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index a3e91f85..0b65dde7 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -163,7 +163,7 @@ void CGarages::Init(void)
}
hGarages = DMAudio.CreateEntity(AUDIOTYPE_GARAGE, (void*)1);
if (hGarages >= 0)
- DMAudio.SetEntityStatus(hGarages, true);
+ DMAudio.SetEntityStatus(hGarages, TRUE);
}
void CGarages::Shutdown(void)
@@ -2357,7 +2357,11 @@ float CGarages::FindDoorHeightForMI(int32 mi)
void CGarage::TidyUpGarage()
{
uint32 i = CPools::GetVehiclePool()->GetSize();
+#ifdef FIX_BUGS
while (i--) {
+#else
+ while (--i) {
+#endif
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
if (pVehicle && (pVehicle->IsCar() || pVehicle->IsBike())) {
if (IsPointInsideGarage(pVehicle->GetPosition())) {
@@ -2373,7 +2377,11 @@ void CGarage::TidyUpGarage()
void CGarage::TidyUpGarageClose()
{
uint32 i = CPools::GetVehiclePool()->GetSize();
+#ifdef FIX_BUGS
while (i--) {
+#else
+ while (--i) {
+#endif
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
if (!pVehicle)
continue;
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index bc9af2e9..f9d58687 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -200,8 +200,8 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
const float fBoundMaxY = boundingBox.max.y + 0.3f;
const float fBoundMinY = boundingBox.min.y - 0.3f;
const float fBoundMaxX = boundingBox.max.x + 0.3f;
- const float fDistanceX = pPosition->x - pEntity->m_matrix.GetPosition().x;
- const float fDistanceY = pPosition->y - pEntity->m_matrix.GetPosition().y;
+ const float fDistanceX = pPosition->x - pEntity->GetMatrix().GetPosition().x;
+ const float fDistanceY = pPosition->y - pEntity->GetMatrix().GetPosition().y;
const float fBoundRadius = pEntity->GetBoundRadius();
CVector vecBoundCentre;
pEntity->GetBoundCentre(vecBoundCentre);
@@ -215,8 +215,8 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
if (!pathNodes[x][y].bBlockade) {
const float pointY = y * 0.7f + fDistanceY;
CVector2D point(pointX, pointY);
- if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->m_matrix.GetRight()))) {
- float fDotProduct = DotProduct2D(point, pEntity->m_matrix.GetForward());
+ if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->GetMatrix().GetRight()))) {
+ float fDotProduct = DotProduct2D(point, pEntity->GetMatrix().GetForward());
if (fBoundMaxY > fDotProduct && fBoundMinY < fDotProduct)
pathNodes[x][y].bBlockade = true;
}
@@ -859,7 +859,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
mag = Sqrt(dx*dx + dy*dy);
dx /= mag;
dy /= mag;
- int width = Max(m_pathNodes[i].width, m_pathNodes[j].width);
+ uint8 width = Max(m_pathNodes[i].width, m_pathNodes[j].width);
if(i < j){
dx = -dx;
dy = -dy;
diff --git a/src/control/PathFind.h b/src/control/PathFind.h
index acf9929a..99759590 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -120,7 +120,7 @@ struct CCarPathLink
uint8 trafficLightDirection : 1;
uint8 trafficLightType : 2;
uint8 bBridgeLights : 1; // at least in LCS...
- int8 width;
+ uint8 width;
CVector2D GetPosition(void) { return CVector2D(x/8.0f, y/8.0f); }
CVector2D GetDirection(void) { return CVector2D(dirX/100.0f, dirY/100.0f); }
@@ -151,7 +151,7 @@ struct CPathInfoForObject
int8 numLeftLanes;
int8 numRightLanes;
int8 speedLimit;
- int8 width;
+ uint8 width;
uint8 crossing : 1;
uint8 onlySmallBoats : 1;
@@ -177,7 +177,7 @@ struct CTempNode
int16 link2;
int8 numLeftLanes;
int8 numRightLanes;
- int8 width;
+ uint8 width;
bool isCross;
int8 linkState;
};
@@ -188,7 +188,7 @@ struct CTempNodeExternal // made up name
int16 next;
int8 numLeftLanes;
int8 numRightLanes;
- int8 width;
+ uint8 width;
bool isCross;
};
diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp
index 411dc8c3..9b50a7ec 100644
--- a/src/control/Phones.cpp
+++ b/src/control/Phones.cpp
@@ -48,9 +48,9 @@ CPhoneInfo::Update(void)
TheCamera.SetWideScreenOff();
pPhoneDisplayingMessages = nil;
bDisplayingPhoneMessage = false;
- CAnimBlendAssociation *talkAssoc = RpAnimBlendClumpGetAssociation(player->GetClump(), ANIM_PHONE_TALK);
+ CAnimBlendAssociation *talkAssoc = RpAnimBlendClumpGetAssociation(player->GetClump(), ANIM_STD_PHONE_TALK);
if (talkAssoc && talkAssoc->blendAmount > 0.5f) {
- CAnimBlendAssociation *endAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_OUT, 8.0f);
+ CAnimBlendAssociation *endAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_STD_PHONE_OUT, 8.0f);
endAssoc->flags &= ~ASSOC_DELETEFADEDOUT;
endAssoc->SetFinishCallback(PhonePutDownCB, player);
} else {
@@ -107,7 +107,7 @@ CPhoneInfo::Update(void)
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PHONE);
TheCamera.SetWideScreenOn();
playerInfo->MakePlayerSafe(true);
- CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_IN, 4.0f);
+ CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_STD_PHONE_IN, 4.0f);
phonePickAssoc->SetFinishCallback(PhonePickUpCB, &m_aPhones[phoneId]);
bPickingUpPhone = true;
pCallBackPed = player;
@@ -363,10 +363,10 @@ PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg)
CPed *ped = CPhoneInfo::pCallBackPed;
ped->m_nMoveState = PEDMOVE_STILL;
- CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_IDLE_STANCE, 8.0f);
+ CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_STD_IDLE, 8.0f);
if (assoc->blendAmount > 0.5f && ped)
- CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_PHONE_TALK, 8.0f);
+ CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_STD_PHONE_TALK, 8.0f);
CPhoneInfo::pCallBackPed = nil;
}
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 9dff91dd..6d0aa415 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -274,10 +274,11 @@ CPickup::CanBePickedUp(CPlayerPed *player, int playerId)
{
assert(m_pObject != nil);
bool cannotBePickedUp =
- (m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > CWorld::Players[playerId].m_nMaxArmour - 0.5f)
- || (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > CWorld::Players[playerId].m_nMaxHealth - 0.5f)
+ (m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > CWorld::Players[playerId].m_nMaxArmour - 0.2f)
+ || (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > CWorld::Players[playerId].m_nMaxHealth - 0.2f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_BRIBE && player->m_pWanted->GetWantedLevel() == 0)
- || (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame));
+ || (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame))
+ || (m_eType == PICKUP_ASSET_REVENUE && m_fRevenue < 10.0f);
return !cannotBePickedUp;
}
@@ -1007,8 +1008,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
if (!entity->bDoNotRender) {
- float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800));
- float modifiedSin = 0.3f * (s + 1.0f);
+ float modifiedSin = 0.3f * (Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800)) + 1.0f);
#ifdef FIX_BUGS
int16 colorId = 0;
@@ -1148,7 +1148,20 @@ CPickups::DoPickUpEffects(CEntity *entity)
if (model == MI_MINIGUN || model == MI_MINIGUN2)
scale = 1.2f;
- entity->GetMatrix().SetRotateZOnlyScaled((float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800), scale);
+ float angle = (float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800);
+ float c = Cos(angle) * scale;
+ float s = Sin(angle) * scale;
+
+ // we know from SA they were setting each field manually like this
+ entity->GetMatrix().rx = c;
+ entity->GetMatrix().ry = s;
+ entity->GetMatrix().rz = 0.0f;
+ entity->GetMatrix().fx = -s;
+ entity->GetMatrix().fy = c;
+ entity->GetMatrix().fz = 0.0f;
+ entity->GetMatrix().ux = 0.0f;
+ entity->GetMatrix().uy = 0.0f;
+ entity->GetMatrix().uz = scale;
if (entity->GetModelIndex() == MI_MINIGUN2) {
CMatrix matrix1;
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 5f481234..22347b92 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -521,7 +521,7 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
state->aFunctionCallbackID[i] = 0;
}
}else{
- state->aAnimId[i] = NUM_STD_ANIMS;
+ state->aAnimId[i] = ANIM_STD_NUM;
state->aCurTime[i] = 0;
state->aSpeed[i] = 85;
state->aFunctionCallbackID[i] = 0;
@@ -548,7 +548,7 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
}
}
else {
- state->aAnimId2[i] = NUM_STD_ANIMS;
+ state->aAnimId2[i] = ANIM_STD_NUM;
state->aCurTime2[i] = 0;
state->aSpeed2[i] = 85;
state->aFunctionCallbackID2[i] = 0;
@@ -611,13 +611,13 @@ bool HasAnimGroupLoaded(uint8 group)
void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
{
CAnimBlendAssociation* anim1;
- if (state->animId <= 3)
+ if (state->animId <= ANIM_STD_IDLE)
anim1 = CAnimManager::BlendAnimation(
(RpClump*)ped->m_rwObject, ped->m_animGroup, (AnimationId)state->animId, 100.0f);
else if (HasAnimGroupLoaded(state->groupId))
anim1 = CAnimManager::BlendAnimation((RpClump*)ped->m_rwObject, (AssocGroupId)state->groupId, (AnimationId)state->animId, 100.0f);
else
- anim1 = CAnimManager::BlendAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_WALK, 100.0f);
+ anim1 = CAnimManager::BlendAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_STD_WALK, 100.0f);
anim1->SetCurrentTime(state->time * 4.0f / 255.0f);
anim1->speed = state->speed * 3.0f / 255.0f;
@@ -629,7 +629,7 @@ void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
float blend = state->blendAmount * 2.0f / 255.0f;
CAnimBlendAssociation* anim2 = CAnimManager::BlendAnimation(
(RpClump*)ped->m_rwObject,
- (state->secAnimId > 3) ? (AssocGroupId)state->secGroupId : ped->m_animGroup,
+ (state->secAnimId > ANIM_STD_IDLE) ? (AssocGroupId)state->secGroupId : ped->m_animGroup,
(AnimationId)state->secAnimId, 100.0f);
anim2->SetCurrentTime(time);
anim2->speed = speed;
@@ -641,7 +641,7 @@ void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
float time = state->partAnimTime * 4.0f / 255.0f;
float speed = state->partAnimSpeed * 3.0f / 255.0f;
float blend = state->partBlendAmount * 2.0f / 255.0f;
- if (blend > 0.0f && state->partAnimId != ANIM_IDLE_STANCE && HasAnimGroupLoaded(state->partGroupId)){
+ if (blend > 0.0f && state->partAnimId != ANIM_STD_IDLE && HasAnimGroupLoaded(state->partGroupId)){
CAnimBlendAssociation* anim3 = CAnimManager::BlendAnimation(
(RpClump*)ped->m_rwObject, (AssocGroupId)state->partGroupId, (AnimationId)state->partAnimId, 1000.0f);
anim3->SetCurrentTime(time);
@@ -659,10 +659,10 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt
for (int i = 0; ((assoc = RpAnimBlendClumpGetMainPartialAssociation_N(ped->GetClump(), i))); i++)
assoc->SetBlend(0.0f, -1.0f);
for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++) {
- if (state->aAnimId[i] == NUM_STD_ANIMS)
+ if (state->aAnimId[i] == ANIM_STD_NUM)
continue;
CAnimBlendAssociation* anim = CAnimManager::AddAnimation(ped->GetClump(),
- state->aAnimId[i] > 3 ? (AssocGroupId)state->aGroupId[i] : ped->m_animGroup,
+ state->aAnimId[i] > ANIM_STD_IDLE ? (AssocGroupId)state->aGroupId[i] : ped->m_animGroup,
(AnimationId)state->aAnimId[i]);
anim->SetCurrentTime(state->aCurTime[i] * 4.0f / 255.0f);
anim->speed = state->aSpeed[i] * 3.0f / 255.0f;
@@ -677,10 +677,10 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt
anim->SetDeleteCallback(FindCBFunction(callback & 0x7F), ped);
}
for (int i = 0; i < NUM_PARTIAL_ANIMS_IN_REPLAY; i++) {
- if (state->aAnimId2[i] == NUM_STD_ANIMS)
+ if (state->aAnimId2[i] == ANIM_STD_NUM)
continue;
CAnimBlendAssociation* anim = CAnimManager::AddAnimation(ped->GetClump(),
- state->aAnimId2[i] > 3 ? (AssocGroupId)state->aGroupId2[i] : ped->m_animGroup,
+ state->aAnimId2[i] > ANIM_STD_IDLE ? (AssocGroupId)state->aGroupId2[i] : ped->m_animGroup,
(AnimationId)state->aAnimId2[i]);
anim->SetCurrentTime(state->aCurTime2[i] * 4.0f / 255.0f);
anim->speed = state->aSpeed2[i] * 3.0f / 255.0f;
@@ -1463,7 +1463,7 @@ void CReplay::RestoreStuffFromMem(void)
ped->SetModelIndex(mi);
ped->m_pVehicleAnim = nil;
ped->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, ped);
- DMAudio.SetEntityStatus(ped->m_audioEntityId, true);
+ DMAudio.SetEntityStatus(ped->m_audioEntityId, TRUE);
CPopulation::UpdatePedCount((ePedType)ped->m_nPedType, false);
for (int j = 0; j < TOTAL_WEAPON_SLOTS; j++) {
int mi1 = CWeaponInfo::GetWeaponInfo(ped->m_weapons[j].m_eWeaponType)->m_nModelId;
@@ -1529,7 +1529,7 @@ void CReplay::RestoreStuffFromMem(void)
car->SetDoorDamage(CAR_DOOR_RR, DOOR_REAR_RIGHT, true);
}
vehicle->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, vehicle);
- DMAudio.SetEntityStatus(vehicle->m_audioEntityId, true);
+ DMAudio.SetEntityStatus(vehicle->m_audioEntityId, TRUE);
CCarCtrl::UpdateCarCount(vehicle, false);
if ((mi == MI_AIRTRAIN || mi == MI_DEADDODO) && vehicle->m_rwObject){
CVehicleModelInfo* info = (CVehicleModelInfo*)CModelInfo::GetModelInfo(mi);
diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp
index 4f714e80..46eee71f 100644
--- a/src/control/RoadBlocks.cpp
+++ b/src/control/RoadBlocks.cpp
@@ -64,7 +64,7 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius;
for (int32 i = 0; i < 2; i++) {
const int32 roadBlockIndex = i + 2 * roadBlockType;
- CVector posForZ = pVehicle->m_matrix * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
+ CVector posForZ = pVehicle->GetMatrix() * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
int32 modelInfoId = MI_COP;
eCopType copType = COP_STREET;
switch (pVehicle->GetModelIndex())
@@ -239,10 +239,10 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
pVehicle->SetStatus(STATUS_ABANDONED);
// pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
tmp.GetPosition().z += fModelRadius - 0.6f;
- pVehicle->m_matrix = tmp;
+ pVehicle->SetMatrix(tmp);
pVehicle->PlaceOnRoadProperly();
pVehicle->SetIsStatic(false);
- pVehicle->m_matrix.UpdateRW();
+ pVehicle->GetMatrix().UpdateRW();
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
pVehicle->bIsLocked = false;
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 609827ca..89877452 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -2104,7 +2104,7 @@ void CMissionCleanup::Process()
CWorld::Players[0].m_bDriveByAllowed = true;
CPad::GetPad(0)->unk_B4 = 1.0f;
CPad::GetPad(0)->unk_B8 = 0.5f;
- DMAudio.ShutUpPlayerTalking(0);
+ DMAudio.ShutUpPlayerTalking(FALSE);
CVehicle::bDisableRemoteDetonation = false;
CVehicle::bDisableRemoteDetonationOnContact = false;
CTheScripts::RiotIntensity = 0;
@@ -5165,7 +5165,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
pPlayer->m_pPed->m_pVehicleAnim->blendDelta = -1000.0f;
pPlayer->m_pPed->m_pVehicleAnim = nil;
pPlayer->m_pPed->SetMoveState(PEDMOVE_NONE);
- CAnimManager::BlendAnimation(pPlayer->m_pPed->GetClump(), pPlayer->m_pPed->m_animGroup, ANIM_IDLE_STANCE, 1000.0f);
+ CAnimManager::BlendAnimation(pPlayer->m_pPed->GetClump(), pPlayer->m_pPed->m_animGroup, ANIM_STD_IDLE, 1000.0f);
pPlayer->m_pPed->RestartNonPartialAnims();
AudioManager.PlayerJustLeftCar();
pos.z += pPlayer->m_pPed->GetDistanceFromCentreOfMassToBaseOfModel();
diff --git a/src/control/Script10.cpp b/src/control/Script10.cpp
index ac3961a7..c619a9dd 100644
--- a/src/control/Script10.cpp
+++ b/src/control/Script10.cpp
@@ -278,7 +278,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
if (pPed)
- pPed->SetWaitState((eWaitState)GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1) >= 0 ? (void*)GET_INTEGER_PARAM(0) : nil); // + true
+ pPed->SetWaitState((eWaitState)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2) >= 0 ? (void*)GET_INTEGER_PARAM(2) : nil, true);
return 0;
}
case COMMAND_REGISTER_BEST_TIME_GOGO_FAGGIO:
diff --git a/src/control/Script2.cpp b/src/control/Script2.cpp
index e4c71403..6f6e89cc 100644
--- a/src/control/Script2.cpp
+++ b/src/control/Script2.cpp
@@ -467,8 +467,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
float length = GET_FLOAT_PARAM(5);
float x, y;
if (angle != 0.0f){
- y = cos(angle) * length;
- x = sin(angle) * length;
+ y = Cos(angle) * length;
+ x = Sin(angle) * length;
}else{
y = length;
x = 0.0f;
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index d1dba350..33042bac 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -817,7 +817,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
}
}
pPed->m_pMyVehicle->m_nGettingOutFlags &= ~flags;
- pPed->m_pMyVehicle->ProcessOpenDoor(pPed->m_vehDoor, NUM_STD_ANIMS, 0.0f);
+ pPed->m_pMyVehicle->ProcessOpenDoor(pPed->m_vehDoor, ANIM_STD_NUM, 0.0f);
}
}
}
@@ -834,7 +834,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
pPed->m_pVehicleAnim = nil;
pPed->RestartNonPartialAnims();
pPed->SetMoveState(PEDMOVE_NONE);
- CAnimManager::BlendAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_IDLE_STANCE, 1000.0f);
+ CAnimManager::BlendAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_STD_IDLE, 1000.0f);
pos.z += pPed->GetDistanceFromCentreOfMassToBaseOfModel();
pPed->Teleport(pos);
CTheScripts::ClearSpaceForMissionEntity(pos, pPed);
@@ -1396,7 +1396,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{
CollectParameters(&m_nIp, 1);
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
- DMAudio.PlayFrontEndTrack(GET_INTEGER_PARAM(0) + STREAMED_SOUND_MISSION_COMPLETED - 1, 0);
+ DMAudio.PlayFrontEndTrack(GET_INTEGER_PARAM(0) + STREAMED_SOUND_MISSION_COMPLETED - 1, FALSE);
//DMAudio.SaveAnnouncementsWhenMissionPassedPlayed(); // TODO!
return 0;
}
@@ -2012,8 +2012,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case COMMAND_HAS_MISSION_AUDIO_LOADED:
{
CollectParameters(&m_nIp, 1);
- //UpdateCompareFlag(DMAudio.GetMissionAudioLoadingStatus(GET_INTEGER_PARAM(0) - 1) == 1);
- UpdateCompareFlag(true); // TODO
+ UpdateCompareFlag(DMAudio.GetMissionAudioLoadingStatus(GET_INTEGER_PARAM(0) - 1) == 1);
return 0;
}
case COMMAND_PLAY_MISSION_AUDIO:
@@ -2023,8 +2022,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
case COMMAND_HAS_MISSION_AUDIO_FINISHED:
{
CollectParameters(&m_nIp, 1);
- //UpdateCompareFlag(DMAudio.IsMissionAudioSampleFinished(GET_INTEGER_PARAM(0) - 1)); // TODO
- UpdateCompareFlag(true);
+ UpdateCompareFlag(DMAudio.IsMissionAudioSampleFinished(GET_INTEGER_PARAM(0) - 1));
return 0;
}
case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING:
diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp
index 502bc005..d9991388 100644
--- a/src/control/Script5.cpp
+++ b/src/control/Script5.cpp
@@ -1002,10 +1002,10 @@ void CRunningScript::PlayerInAngledAreaCheckCommand(int32 command, uint32* pIp)
initAngle -= TWOPI;
// it looks like the idea is to use a rectangle using the diagonal of the rectangle as
// the side of new rectangle, with "length" being the length of second side
- float rotatedSupX = supX + side2length * sin(initAngle);
- float rotatedSupY = supY - side2length * cos(initAngle);
- float rotatedInfX = infX + side2length * sin(initAngle);
- float rotatedInfY = infY - side2length * cos(initAngle);
+ float rotatedSupX = supX + side2length * Sin(initAngle);
+ float rotatedSupY = supY - side2length * Cos(initAngle);
+ float rotatedInfX = infX + side2length * Sin(initAngle);
+ float rotatedInfY = infY - side2length * Cos(initAngle);
float side1X = supX - infX;
float side1Y = supY - infY;
float side1Length = CVector2D(side1X, side1Y).Magnitude();
@@ -2674,10 +2674,10 @@ bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
CPed* pPed = pPlayer->m_pPed;
if (pPed->InVehicle())
return IsVehicleStopped(pPed->m_pMyVehicle);
- if (RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_RUN_STOP) ||
- RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_RUN_STOP_R) ||
- RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) ||
- RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE))
+ if (RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_RUNSTOP1) ||
+ RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_RUNSTOP2) ||
+ RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_JUMP_LAUNCH) ||
+ RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_JUMP_GLIDE))
return false;
return (pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL) &&
!pPed->bIsInTheAir && !pPed->bIsLanding && pPed->bIsStanding && pPed->m_vecAnimMoveDelta.x == 0.0f && pPed->m_vecAnimMoveDelta.y == 0.0f;
diff --git a/src/control/Script7.cpp b/src/control/Script7.cpp
index 6dd6e281..de389a13 100644
--- a/src/control/Script7.cpp
+++ b/src/control/Script7.cpp
@@ -452,12 +452,12 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
if (GET_INTEGER_PARAM(1)) {
- pPed->bIsDucking = true;
+ pPed->bCrouchWhenShooting = true;
pPed->SetDuck(GET_INTEGER_PARAM(2), true);
}
else {
pPed->ClearDuck(true);
- pPed->bIsDucking = false;
+ pPed->bCrouchWhenShooting = false;
}
return 0;
}
@@ -771,7 +771,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
CHud::SetHelpMessage(text, false, true); // + true
if (text != CHud::gLastPrintForeverString) {
CHud::gLastPrintForeverString = text;
- DMAudio.PlayFrontEndSound(SOUND_HUD_SOUND, 0);
+ DMAudio.PlayFrontEndSound(SOUND_HUD, 0);
}
return 0;
}
diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp
index 8a1612fb..38c28069 100644
--- a/src/control/Script8.cpp
+++ b/src/control/Script8.cpp
@@ -53,7 +53,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
((CPlayerPed*)pPed)->m_fMoveSpeed = 0.0f;
else
pPed->m_nStoredMoveState = PEDMOVE_STILL;
- CAnimManager::AddAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_IDLE_STANCE);
+ CAnimManager::AddAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_STD_IDLE);
pPed->bIsPedDieAnimPlaying = false;
}
return 0;
@@ -346,7 +346,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- UpdateCompareFlag(RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_DUCK_DOWN) != nil);
+ UpdateCompareFlag(RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_DUCK_DOWN) != nil);
return 0;
}
case COMMAND_CREATE_DUST_EFFECT_FOR_CUTSCENE_HELI:
@@ -386,7 +386,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
}
case COMMAND_IS_JAPANESE_GAME:
#ifdef MORE_LANGUAGES
- UpdateCompareFlag(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_JAPANESE);
+ UpdateCompareFlag(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_JAPANESE);
#elif (defined GTAVC_JP_PATCH)
UpdateCompareFlag(true);
#else
diff --git a/src/control/Script9.cpp b/src/control/Script9.cpp
index b55a1df5..579626f3 100644
--- a/src/control/Script9.cpp
+++ b/src/control/Script9.cpp
@@ -453,8 +453,8 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
assert(pVehicle);
- pVehicle->ProcessOpenDoor(CAR_DOOR_RR, ANIM_VAN_OPEN, 1.0f);
- pVehicle->ProcessOpenDoor(CAR_DOOR_LR, ANIM_VAN_OPEN_L, 1.0f);
+ pVehicle->ProcessOpenDoor(CAR_DOOR_RR, ANIM_STD_VAN_OPEN_DOOR_REAR_RHS, 1.0f);
+ pVehicle->ProcessOpenDoor(CAR_DOOR_LR, ANIM_STD_VAN_OPEN_DOOR_REAR_LHS, 1.0f);
return 0;
}
case COMMAND_GET_CHAR_THREAT_CHAR:
@@ -568,11 +568,11 @@ int8 CRunningScript::ProcessCommands1500To1599(int32 command)
}
case COMMAND_LOAD_NON_STANDARD_PED_ANIM:
CollectParameters(&m_nIp, 1);
- // CPed::LoadNonStandardPedAnim(GET_INTEGER_PARAM(0));
+ CPed::LoadNonStandardPedAnim((eWaitState)GET_INTEGER_PARAM(0));
return 0;
case COMMAND_UNLOAD_NON_STANDARD_PED_ANIM:
CollectParameters(&m_nIp, 1);
- // CPed::UnloadNonStandardPedAnim(SET_INTEGER_PARAM(0));
+ CPed::UnloadNonStandardPedAnim((eWaitState)GET_INTEGER_PARAM(0));
return 0;
case COMMAND_1566:
CollectParameters(&m_nIp, 1);
diff --git a/src/control/SetPieces.cpp b/src/control/SetPieces.cpp
index 143115b8..0409a8bf 100644
--- a/src/control/SetPieces.cpp
+++ b/src/control/SetPieces.cpp
@@ -260,8 +260,8 @@ void CSetPiece::Update(void)
CCarAI::AddPoliceCarOccupants(pVehicle1);
CVehicle* pVehicle2 = TryToGenerateCopCar(m_vSpawn2, m_vTarget2);
if (!pVehicle2) {
- CWorld::Remove(pVehicle2);
- delete pVehicle2;
+ CWorld::Remove(pVehicle1);
+ delete pVehicle1;
return;
}
pVehicle2->SetStatus(STATUS_PHYSICS);