From a5f7597637c7ba23d1559e1ebcd0a98c2dc47d88 Mon Sep 17 00:00:00 2001 From: Ilya Shurumov Date: Mon, 24 May 2021 20:44:18 +0600 Subject: [PATCH] - fix annoying car storing bug (again!!!) --- src_rebuild/Game/C/mgeneric.c | 24 +++++++++++------------- src_rebuild/Game/C/mission.c | 2 -- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src_rebuild/Game/C/mgeneric.c b/src_rebuild/Game/C/mgeneric.c index 3c191c8f..b83b6d4c 100644 --- a/src_rebuild/Game/C/mgeneric.c +++ b/src_rebuild/Game/C/mgeneric.c @@ -15,7 +15,8 @@ void StorePlayerPosition(SAVED_PLAYER_POS *data) ushort type; int slot; - slot = player[0].playerCarId; + // store previous player car? + slot = Mission.PhantomCarId != -1 ? Mission.PhantomCarId : player[0].playerCarId; cp = &car_data[slot]; @@ -25,10 +26,10 @@ void StorePlayerPosition(SAVED_PLAYER_POS *data) type = 0; data->type = type; - data->direction = player[0].dir; - data->vx = player[0].pos[0]; - data->vy = player[0].pos[1]; - data->vz = player[0].pos[2]; + data->direction = cp->hd.direction; + data->vx = cp->hd.where.t[0]; + data->vy = cp->hd.where.t[1]; + data->vz = cp->hd.where.t[2]; if (slot < 0) data->felony = pedestrianFelony; @@ -100,17 +101,13 @@ void StoreCarPosition(MS_TARGET *target, SAVED_CAR_POS *data) int slot; CAR_DATA* cp; - // if target is a swapable, make sure it gonna be previous player car - if (target->s.car.flags & CARTARGET_FLAG_BACK_TO_PLAYERCAR) - slot = Mission.PhantomCarId; - else - slot = target->s.car.slot; + slot = target->s.car.slot; if (slot == -1) return; - if (slot == player[0].playerCarId) - return; + //if (slot == player[0].playerCarId) + // return; cp = &car_data[slot]; @@ -229,7 +226,8 @@ void StoreEndData(void) carpos = &MissionEndData.CarPos[numStored]; if (target->type == Target_Car && - (target->s.target_flags & TARGET_FLAG_CAR_SAVED)) + (target->s.target_flags & TARGET_FLAG_CAR_SAVED) && + (target->s.target_flags & TARGET_FLAG_CAR_PINGED_IN)) { StoreCarPosition(target, carpos); diff --git a/src_rebuild/Game/C/mission.c b/src_rebuild/Game/C/mission.c index 37276d5a..50640f59 100644 --- a/src_rebuild/Game/C/mission.c +++ b/src_rebuild/Game/C/mission.c @@ -3119,8 +3119,6 @@ void SetCarToBeStolen(MS_TARGET *target, int player) SetPlayerMessage(player, Mission.StealMessage, 2, 2); } - - // [D] [T] void HandleMission(void) {