From e5c83561e54ddd8d12a71a1affcb4c9ec4d64d4f Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sat, 28 Nov 2015 17:49:51 +0000 Subject: [PATCH] implement more sub_6DAB4C --- src/ride/vehicle.c | 66 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c index ec650a0b9b..d9e9398ed1 100644 --- a/src/ride/vehicle.c +++ b/src/ride/vehicle.c @@ -40,7 +40,9 @@ typedef struct { uint16 x; // 0x00 uint16 y; // 0x02 uint16 z; // 0x04 - uint8 pad_06[3]; // 0x06 + uint8 direction; // 0x06 + uint8 var_07; + uint8 var_08; } rct_vehicle_info; static void vehicle_update(rct_vehicle *vehicle); @@ -994,6 +996,17 @@ static void sub_6DB807(rct_vehicle *vehicle) sprite_move(x, y, z, (rct_sprite*)vehicle); } +/** + * + * rct2: 0x006DD078 + * @param vehicle (esi) + * @param otherVehicleIndex (bp) + */ +static bool sub_6DD078(rct_vehicle *vehicle, uint16 otherVehicleIndex) +{ + return RCT2_CALLPROC_X(0x006DD078, 0, 0, 0, 0, (int)vehicle, 0, otherVehicleIndex) & 0x100; +} + /** * * rct2: 0x006DB7D6 @@ -1354,24 +1367,61 @@ loc_6DB706:; } loc_6DB8A5: - regs.ax = x; - regs.cx = y; - regs.dx = z; - regs.esi = vehicle; - regs.edi = moveInfo; - RCT2_CALLFUNC_Y(0x006DB8A5, ®s); - goto end; + regs.ebx = RCT2_ADDRESS(0x009A2930, uint32)[regs.ebx]; + vehicle->var_24 -= regs.ebx; + unk_F64E20->x = x; + unk_F64E20->y = y; + unk_F64E20->z = z; + vehicle->sprite_direction = moveInfo->direction; + vehicle->var_20 = moveInfo->var_08; + vehicle->var_1F = moveInfo->var_07; + + regs.ebx = moveInfo->var_07; + + if ((vehicleEntry->var_14 & 0x200) && moveInfo->var_07 != 0) { + vehicle->var_4A = 0; + vehicle->var_4C = 0; + vehicle->var_4E = 0; + } + + if (vehicle == RCT2_GLOBAL(0x00F64E00, rct_vehicle*)) { + if (RCT2_GLOBAL(0x00F64E08, uint32) >= 0) { + regs.bp = vehicle->prev_vehicle_on_ride; + if (sub_6DD078(vehicle, vehicle->prev_vehicle_on_ride)) { + goto loc_6DB967; + } + } + } + + if (vehicle->var_24 < 0x368A) { + goto loc_6DBF20; + } + + regs.ebx = RCT2_ADDRESS(0x009A2970, uint32)[regs.ebx]; + vehicle->var_2C += regs.ebx; + RCT2_GLOBAL(0x00F64E10, uint32)++; + goto loc_6DAEB9; loc_6DB94A: regs.esi = vehicle; RCT2_CALLFUNC_Y(0x006DB94A, ®s); goto end; +loc_6DB967: + regs.esi = vehicle; + // regs.bp = regs.bp + RCT2_CALLFUNC_Y(0x006DB94A, ®s); + goto end; + loc_6DBA13: regs.esi = vehicle; RCT2_CALLFUNC_Y(0x006DBA13, ®s); goto end; +loc_6DBF20: + sprite_move(unk_F64E20->x, unk_F64E20->y, unk_F64E20->z, (rct_sprite*)vehicle); + invalidate_sprite_2((rct_sprite*)vehicle); + loc_6DBF3E: regs.esi = vehicle; RCT2_CALLFUNC_Y(0x006DBF3E, ®s);