more script commands

This commit is contained in:
Nikolay Korolev 2020-06-07 15:49:25 +03:00
parent 0b156f1d26
commit d0213e466c
5 changed files with 46 additions and 29 deletions

View file

@ -10772,13 +10772,22 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_SET_HELI_ORIENTATION: case COMMAND_SET_HELI_ORIENTATION:
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
debug("SET_HELI_ORIENTATION is not implemented\n"); // TODO(MIAMI); CAutomobile* pHeli = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli());
float fAngle = DEGTORAD(*(float*)&ScriptParams[1] - 90.0f);
while (fAngle < 0.0f)
fAngle += TWOPI;
while (fAngle > TWOPI)
fAngle -= TWOPI;
pHeli->SetHeliOrientation(fAngle);
return 0; return 0;
} }
case COMMAND_CLEAR_HELI_ORIENTATION: case COMMAND_CLEAR_HELI_ORIENTATION:
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
debug("SET_HELI_ORIENTATION is not implemented\n"); // TODO(MIAMI); CAutomobile* pHeli = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli());
pHeli->ClearHeliOrientation();
return 0; return 0;
} }
case COMMAND_PLANE_GOTO_COORDS: case COMMAND_PLANE_GOTO_COORDS:
@ -10879,9 +10888,10 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_POP_CAR_BOOT: case COMMAND_POP_CAR_BOOT:
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); CollectParameters(&m_nIp, 1);
assert(pVehicle); CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
debug("POP_CAR_BOOT is not implemented\n"); // TODO(MIAMI) assert(pCar&& pCar->IsCar());
pCar->PopBoot();
return 0; return 0;
} }
case COMMAND_SHUT_PLAYER_UP: case COMMAND_SHUT_PLAYER_UP:
@ -11143,7 +11153,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_CREATE_SWAT_ROPE: case COMMAND_CREATE_SWAT_ROPE:
{ {
CollectParameters(&m_nIp, 3); CollectParameters(&m_nIp, 3);
debug("SET_CHAR_OBJ_SPRINT_TO_COORD is not implemented\n"); debug("CREATE_SWAT_ROPE is not implemented\n");
return 0; return 0;
} }
//case COMMAND_SET_FIRST_PERSON_CONTROL_CAMERA: //case COMMAND_SET_FIRST_PERSON_CONTROL_CAMERA:
@ -11163,7 +11173,9 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_CLOSE_ALL_CAR_DOORS: case COMMAND_CLOSE_ALL_CAR_DOORS:
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
debug("CLOSE_ALL_CAR_DOORS is not implemented\n"); // TODO(MIAMI) CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pCar&& pCar->IsCar());
pCar->CloseAllDoors();
return 0; return 0;
} }
case COMMAND_GET_DISTANCE_BETWEEN_COORDS_2D: case COMMAND_GET_DISTANCE_BETWEEN_COORDS_2D:
@ -11183,7 +11195,9 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_POP_CAR_BOOT_USING_PHYSICS: case COMMAND_POP_CAR_BOOT_USING_PHYSICS:
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
debug("POP_CAR_BOOT_USING_PHYSICS is not implemented\n"); // TODO(MIAMI) CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pCar && pCar->IsCar());
pCar->PopBootUsingPhysics();
return 0; return 0;
} }
//case COMMAND_SET_FIRST_PERSON_WEAPON_CAMERA: //case COMMAND_SET_FIRST_PERSON_WEAPON_CAMERA:
@ -11727,7 +11741,9 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
case COMMAND_MAKE_HELI_COME_CRASHING_DOWN: case COMMAND_MAKE_HELI_COME_CRASHING_DOWN:
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
debug("MAKE_HELI_COME_CRASHING_DOWN is not implemented\n"); CAutomobile* pHeli = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pHeli && pHeli->IsCar() && pHeli->IsRealHeli());
pHeli->bHeliDestroyed = true;
return 0; return 0;
} }
case COMMAND_ADD_EXPLOSION_NO_SOUND: case COMMAND_ADD_EXPLOSION_NO_SOUND:
@ -11775,18 +11791,18 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
debug("SET_CHAR_CROUCH_WHEN_THREATENED not implemented, skipping\n"); assert(pPed);
pPed->bCrouchWhenScared = true;
return 0; return 0;
} }
case COMMAND_IS_CHAR_IN_ANY_POLICE_VEHICLE: case COMMAND_IS_CHAR_IN_ANY_POLICE_VEHICLE:
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
static bool bShowed = false; CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
if (!bShowed) { assert(pPed);
debug("IS_CHAR_IN_ANY_POLICE_VEHICLE not implemented, default to FALSE\n"); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle &&
bShowed = true; pPed->m_pMyVehicle->IsLawEnforcementVehicle() &&
} pPed->m_pMyVehicle->GetModelIndex() != MI_PREDATOR);
UpdateCompareFlag(false);
return 0; return 0;
} }
case COMMAND_DOES_CHAR_EXIST: case COMMAND_DOES_CHAR_EXIST:
@ -11817,7 +11833,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
case COMMAND_SET_ALL_TAXIS_HAVE_NITRO: case COMMAND_SET_ALL_TAXIS_HAVE_NITRO:
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
debug("SET_ALL_TAXIS_HAVE_NITRO is not implemented\n"); // TODO(MIAMI) CVehicle::bAllTaxisHaveNitro = ScriptParams[0] != 0;
return 0; return 0;
} }
case COMMAND_SET_CHAR_STOP_SHOOT_DONT_SEEK_ENTITY: case COMMAND_SET_CHAR_STOP_SHOOT_DONT_SEEK_ENTITY:
@ -11914,7 +11930,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
case COMMAND_PLAY_ANNOUNCEMENT: case COMMAND_PLAY_ANNOUNCEMENT:
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
debug("PLAY_ANNOUNCEMENT not implemented, skipping\n"); DMAudio.PlayRadioAnnouncement(ScriptParams[0] + STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED);
return 0; return 0;
} }
case COMMAND_SET_PLAYER_IS_IN_STADIUM: case COMMAND_SET_PLAYER_IS_IN_STADIUM:

View file

@ -1610,7 +1610,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
A->bSkipLineCol = true; A->bSkipLineCol = true;
}else if(A->IsPed() && Aped->m_pCollidingEntity == B){ }else if(A->IsPed() && Aped->m_pCollidingEntity == B){
skipCollision = true; skipCollision = true;
if(!Aped->bKnockedUpIntoAir || Aped->b158_4) if(!Aped->bKnockedUpIntoAir || Aped->bKnockedOffBike)
A->bSkipLineCol = true; A->bSkipLineCol = true;
}else if(B->IsPed() && Bped->m_pCollidingEntity == A){ }else if(B->IsPed() && Bped->m_pCollidingEntity == A){
skipCollision = true; skipCollision = true;

View file

@ -3770,7 +3770,8 @@ CPed::ClearAll(void)
bIsPointingGunAt = false; bIsPointingGunAt = false;
bRenderPedInCar = true; bRenderPedInCar = true;
bKnockedUpIntoAir = false; bKnockedUpIntoAir = false;
b158_4 = false; bCrouchWhenScared = false;
bKnockedOffBike = false;
m_pCollidingEntity = nil; m_pCollidingEntity = nil;
} }
@ -7054,7 +7055,7 @@ CPed::Fall(void)
CAnimBlendAssociation *firstPartialAssoc; CAnimBlendAssociation *firstPartialAssoc;
CAnimBlendAssociation *fallAssoc; CAnimBlendAssociation *fallAssoc;
if (IsPlayer() && (bKnockedUpIntoAir || b158_4) && !bIsStanding) { if (IsPlayer() && (bKnockedUpIntoAir || bKnockedOffBike) && !bIsStanding) {
firstPartialAssoc = RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_PARTIAL); firstPartialAssoc = RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_PARTIAL);
// What??? // What???
@ -7082,7 +7083,7 @@ CPed::Fall(void)
} else { } else {
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FALL_BACK, 8.0f); CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_FALL_BACK, 8.0f);
} }
} else if ((bKnockedUpIntoAir || b158_4) && bIsStanding && !bWasStanding) { } else if ((bKnockedUpIntoAir || bKnockedOffBike) && bIsStanding && !bWasStanding) {
fallAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_BACK); fallAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_BACK);
if (!fallAssoc) if (!fallAssoc)
@ -7090,7 +7091,7 @@ CPed::Fall(void)
if (fallAssoc) { if (fallAssoc) {
bKnockedUpIntoAir = false; bKnockedUpIntoAir = false;
b158_4 = false; bKnockedOffBike = false;
fallAssoc->speed = 3.0f; fallAssoc->speed = 3.0f;
if (IsPlayer()) if (IsPlayer())
Say(SOUND_PED_LAND); Say(SOUND_PED_LAND);
@ -7099,7 +7100,7 @@ CPed::Fall(void)
firstPartialAssoc = RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_PARTIAL); firstPartialAssoc = RpAnimBlendClumpGetFirstAssociation(GetClump(), ASSOC_PARTIAL);
if (firstPartialAssoc && !firstPartialAssoc->IsRunning()) { if (firstPartialAssoc && !firstPartialAssoc->IsRunning()) {
bKnockedUpIntoAir = false; bKnockedUpIntoAir = false;
b158_4 = false; bKnockedOffBike = false;
} }
} }
} }

View file

@ -473,8 +473,8 @@ public:
uint32 bIgnoreThreatsBehindObjects : 1; uint32 bIgnoreThreatsBehindObjects : 1;
uint32 bNeverEverTargetThisPed : 1; uint32 bNeverEverTargetThisPed : 1;
//uint32 b158_2 uint32 bCrouchWhenScared : 1;
uint32 b158_4 : 1; uint32 bKnockedOffBike : 1;
//uint32 b158_8 //uint32 b158_8
//uint32 b158_10 //uint32 b158_10
uint32 bBoughtIceCream : 1; uint32 bBoughtIceCream : 1;

View file

@ -2685,7 +2685,7 @@ CBike::KnockOffRider(eWeaponType weapon, uint8 direction, CPed *ped, bool bGetBa
case 3: anim = ANIM_KD_LEFT; break; case 3: anim = ANIM_KD_LEFT; break;
} }
if(m_nWheelsOnGround == 0) if(m_nWheelsOnGround == 0)
ped->b158_4 = true; ped->bKnockedOffBike = true;
break; break;
} }
@ -2703,7 +2703,7 @@ CBike::KnockOffRider(eWeaponType weapon, uint8 direction, CPed *ped, bool bGetBa
case 2: anim = ANIM_KO_SKID_FRONT; break; case 2: anim = ANIM_KO_SKID_FRONT; break;
case 3: anim = ANIM_KD_LEFT; break; case 3: anim = ANIM_KD_LEFT; break;
} }
ped->b158_4 = true; ped->bKnockedOffBike = true;
if(ped->IsPlayer()) if(ped->IsPlayer())
ped->Say(SOUND_PED_DAMAGE); ped->Say(SOUND_PED_DAMAGE);
break; break;
@ -2745,7 +2745,7 @@ CBike::KnockOffRider(eWeaponType weapon, uint8 direction, CPed *ped, bool bGetBa
}else }else
ped->GetMatrix().Translate(CVector(0.0f, 0.0f, -2.0f)); ped->GetMatrix().Translate(CVector(0.0f, 0.0f, -2.0f));
ped->m_pCollidingEntity = ped->m_pMyVehicle; ped->m_pCollidingEntity = ped->m_pMyVehicle;
ped->b158_4 = true; ped->bKnockedOffBike = true;
ped->bHeadStuckInCollision = true; ped->bHeadStuckInCollision = true;
}else if(weapon == WEAPONTYPE_RAMMEDBYCAR){ }else if(weapon == WEAPONTYPE_RAMMEDBYCAR){
if(CWorld::TestSphereAgainstWorld(ped->GetPosition()+CVector(0.0f, 0.0, 1.3f), 0.6f, nil, true, false, false, false, false, false) == nil) if(CWorld::TestSphereAgainstWorld(ped->GetPosition()+CVector(0.0f, 0.0, 1.3f), 0.6f, nil, true, false, false, false, false, false) == nil)