- fix bug with constantly appearing message in "Escape Brazillians"

This commit is contained in:
Ilya Shurumov 2021-03-04 20:31:13 +06:00
parent d82db5bd2d
commit 94a666959b
3 changed files with 28 additions and 20 deletions

View File

@ -933,7 +933,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop,
}
else
{
if (gNight && (model->flags2 & 0x1000))
if (gNight && (model->flags2 & MODEL_FLAG_LAMP))
{
if (damage_lamp(cop))
{

View File

@ -982,7 +982,7 @@ void StepSim(void)
{
switch (cp->controlType)
{
case 1:
case CONTROL_TYPE_PLAYER:
t0 = Pads[*cp->ai.padid].mapped; // [A] padid might be wrong
t1 = Pads[*cp->ai.padid].mapanalog[2];
t2 = Pads[*cp->ai.padid].type & 4;
@ -1016,13 +1016,13 @@ void StepSim(void)
ProcessCarPad(cp, t0, t1, t2);
break;
case 2:
case CONTROL_TYPE_CIV_AI:
CivControl(cp);
break;
case 3:
case CONTROL_TYPE_PURSUER_AI:
CopControl(cp);
break;
case 4:
case CONTROL_TYPE_LEAD_AI:
t2 = 0;
t1 = 0;
t0 = 0;
@ -1040,7 +1040,7 @@ void StepSim(void)
}
break;
case 7:
case CONTROL_TYPE_CUTSCENE:
#ifdef CUTSCENE_RECORDER
extern int gCutsceneAsReplay;
extern int gCutsceneAsReplay_PlayerId;

View File

@ -10,13 +10,16 @@
#include "STRINGS.H"
// [D] [T]
void StorePlayerPosition(SAVED_PLAYER_POS *data)
// [D] [T] [A] returns player car slot
int StorePlayerPosition(SAVED_PLAYER_POS *data)
{
ushort type;
int slot;
slot = player[0].playerCarId;
if (player[0].playerType == 1)
type = ((MissionHeader->residentModels[car_data[player[0].playerCarId].ap.model] & 0xfff) << 4) | 1 | car_data[player[0].playerCarId].ap.palette << 8;
type = ((MissionHeader->residentModels[car_data[slot].ap.model] & 0xfff) << 4) | 1 | car_data[slot].ap.palette << 8;
else
type = 0;
@ -26,21 +29,21 @@ void StorePlayerPosition(SAVED_PLAYER_POS *data)
data->vy = player[0].pos[1];
data->vz = player[0].pos[2];
if (player[0].playerCarId < 0)
if (slot < 0)
data->felony = pedestrianFelony;
else
data->felony = car_data[player[0].playerCarId].felonyRating;
data->felony = car_data[slot].felonyRating;
if (player[0].playerType == 1)
{
data->totaldamage = car_data[player[0].playerCarId].totalDamage;
data->totaldamage = car_data[slot].totalDamage;
data->damage[0] = car_data[player[0].playerCarId].ap.damage[0];
data->damage[1] = car_data[player[0].playerCarId].ap.damage[1];
data->damage[2] = car_data[player[0].playerCarId].ap.damage[2];
data->damage[3] = car_data[player[0].playerCarId].ap.damage[3];
data->damage[4] = car_data[player[0].playerCarId].ap.damage[4];
data->damage[5] = car_data[player[0].playerCarId].ap.damage[5];
data->damage[0] = car_data[slot].ap.damage[0];
data->damage[1] = car_data[slot].ap.damage[1];
data->damage[2] = car_data[slot].ap.damage[2];
data->damage[3] = car_data[slot].ap.damage[3];
data->damage[4] = car_data[slot].ap.damage[4];
data->damage[5] = car_data[slot].ap.damage[5];
}
else
{
@ -53,6 +56,8 @@ void StorePlayerPosition(SAVED_PLAYER_POS *data)
data->damage[4] = 0;
data->damage[5] = 0;
}
return slot;
}
@ -148,6 +153,7 @@ void RestoreCarPosition(SAVED_CAR_POS *data)
memcpy((u_char*)PlayerStartInfo[numPlayersToCreate], (u_char*)PlayerStartInfo[0], sizeof(STREAM_SOURCE));
PlayerStartInfo[numPlayersToCreate]->type = 3;
PlayerStartInfo[numPlayersToCreate]->controlType = CONTROL_TYPE_CIV_AI;
PlayerStartInfo[0]->type = 1;
PlayerStartInfo[0]->model = data->model;
@ -187,6 +193,7 @@ void RestoreCarPosition(SAVED_CAR_POS *data)
// [D] [T]
void StoreEndData(void)
{
int playerCarId;
int numStored;
MS_TARGET* target;
int i;
@ -198,14 +205,15 @@ void StoreEndData(void)
return;
numStored = 0;
StorePlayerPosition(&MissionEndData.PlayerPos);
playerCarId = StorePlayerPosition(&MissionEndData.PlayerPos);
for(i = 0; i < 16 && numStored < 6; i++)
{
target = &MissionTargets[i];
carpos = &MissionEndData.CarPos[numStored];
if (target->type == Target_Car &&
if (target->type == Target_Car &&
playerCarId != target->car.slot &&
(target->target_flags & TARGET_FLAG_CAR_SAVED))
{
StoreCarPosition(target, carpos);