Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev
2020-05-20 20:40:36 +03:00
35 changed files with 1046 additions and 729 deletions

View File

@ -1162,45 +1162,6 @@ CPacManPickups::Update()
void
CPacManPickups::GeneratePMPickUps(CVector pos, float scrambleMult, int16 count, uint8 type)
{
int i = 0;
while (count > 0) {
while (aPMPickUps[i].m_eType != PACMAN_NONE)
i++;
bool bPickupCreated = false;
while (!bPickupCreated) {
CVector newPos = pos;
CColPoint colPoint;
CEntity *pRoad;
uint16 nRand = CGeneral::GetRandomNumber();
newPos.x += ((nRand & 0xFF) - 128) * scrambleMult / 128.0f;
newPos.y += (((nRand >> 8) & 0xFF) - 128) * scrambleMult / 128.0f;
newPos.z = 1000.0f;
if (CWorld::ProcessVerticalLine(newPos, -1000.0f, colPoint, pRoad, true, false, false, false, true, false, nil) && pRoad->IsBuilding() && ((CBuilding*)pRoad)->GetIsATreadable()) {
newPos.z = 0.7f + colPoint.point.z;
aPMPickUps[i].m_eType = type;
aPMPickUps[i].m_vecPosn = newPos;
CObject *obj = new CObject(MI_BULLION, true);
if (obj != nil) {
obj->ObjectCreatedBy = MISSION_OBJECT;
obj->SetPosition(aPMPickUps[i].m_vecPosn);
obj->SetOrientation(0.0f, 0.0f, -HALFPI);
obj->GetMatrix().UpdateRW();
obj->UpdateRwFrame();
obj->bAffectedByGravity = false;
obj->bExplosionProof = true;
obj->bUsesCollision = false;
obj->bIsPickup = false;
CWorld::Add(obj);
}
aPMPickUps[i].m_pObject = obj;
bPickupCreated = true;
}
}
count--;
}
bPMActive = true;
}
// diablo porn mission pickups
@ -1317,40 +1278,6 @@ static const CVector aRacePoints1[] = {
void
CPacManPickups::GeneratePMPickUpsForRace(int32 race)
{
const CVector *pPos = nil;
int i = 0;
if (race == 0) pPos = aRacePoints1; // there's only one available
assert(pPos != nil);
while (!pPos->IsZero()) {
while (aPMPickUps[i].m_eType != PACMAN_NONE)
i++;
aPMPickUps[i].m_eType = PACMAN_RACE;
aPMPickUps[i].m_vecPosn = *(pPos++);
if (race == 0) {
CObject* obj = new CObject(MI_DONKEYMAG, true);
if (obj != nil) {
obj->ObjectCreatedBy = MISSION_OBJECT;
obj->SetPosition(aPMPickUps[i].m_vecPosn);
obj->SetOrientation(0.0f, 0.0f, -HALFPI);
obj->GetMatrix().UpdateRW();
obj->UpdateRwFrame();
obj->bAffectedByGravity = false;
obj->bExplosionProof = true;
obj->bUsesCollision = false;
obj->bIsPickup = false;
CWorld::Add(obj);
}
aPMPickUps[i].m_pObject = obj;
} else
aPMPickUps[i].m_pObject = nil;
}
bPMActive = true;
}
void

View File

@ -7000,7 +7000,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
float heading = LimitAngleOnCircle(
RADTODEG(Atan2(-pObject->GetForward().x, pObject->GetForward().y)));
float headingTarget = *(float*)&ScriptParams[1];
#ifdef FIX_BUGS
float rotateBy = *(float*)&ScriptParams[2] * CTimer::GetTimeStepFix();
#else
float rotateBy = *(float*)&ScriptParams[2];
#endif
if (headingTarget == heading) { // using direct comparasion here is fine
UpdateCompareFlag(true);
return 0;
@ -7049,7 +7053,11 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
assert(pObject);
CVector pos = pObject->GetPosition();
CVector posTarget = *(CVector*)&ScriptParams[1];
#ifdef FIX_BUGS
CVector slideBy = *(CVector*)&ScriptParams[4] * CTimer::GetTimeStepFix();
#else
CVector slideBy = *(CVector*)&ScriptParams[4];
#endif
if (posTarget == pos) { // using direct comparasion here is fine
UpdateCompareFlag(true);
return 0;
@ -7221,12 +7229,13 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
}
case COMMAND_CREATE_FLOATING_PACKAGE:
{
CollectParameters(&m_nIp, 3);
CVector pos = *(CVector*)&ScriptParams[0];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET;
ScriptParams[0] = CPickups::GenerateNewOne(pos, MI_FLOATPACKAGE1, PICKUP_FLOATINGPACKAGE, 0);
StoreParameters(&m_nIp, 1);
// removed in MIAMI
// CollectParameters(&m_nIp, 3);
// CVector pos = *(CVector*)&ScriptParams[0];
// if (pos.z <= MAP_Z_LOW_LIMIT)
// pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET;
// ScriptParams[0] = CPickups::GenerateNewOne(pos, MI_FLOATPACKAGE1, PICKUP_FLOATINGPACKAGE, 0);
// StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_PLACE_OBJECT_RELATIVE_TO_CAR:
@ -8681,8 +8690,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
return 0;
}
case COMMAND_GET_BODY_CAST_HEALTH:
ScriptParams[0] = CObject::nBodyCastHealth;
StoreParameters(&m_nIp, 1);
// ScriptParams[0] = CObject::nBodyCastHealth;
// StoreParameters(&m_nIp, 1);
return 0;
case COMMAND_SET_CHARS_CHATTING:
{

View File

@ -145,7 +145,10 @@ CTrafficLights::ScanForLightsOnMap(void)
CPtrList &list = CWorld::GetSector(x, y)->m_lists[ENTITYLIST_DUMMIES];
for(node = list.first; node; node = node->next){
CEntity *light = (CEntity*)node->item;
if(light->GetModelIndex() != MI_TRAFFICLIGHTS)
if(light->GetModelIndex() != MI_TRAFFICLIGHTS &&
light->GetModelIndex() != MI_TRAFFICLIGHTS_VERTICAL &&
light->GetModelIndex() != MI_TRAFFICLIGHTS_MIAMI &&
light->GetModelIndex() != MI_TRAFFICLIGHTS_TWOVERTICAL)
continue;
// Check cars