Merge pull request #4314 from marijnvdwerf/clean/data-vehicle-misc-1

Clean/data vehicle misc 1
This commit is contained in:
Ted John 2016-08-20 21:33:43 +01:00 committed by GitHub
commit 77adbc5145
4 changed files with 136 additions and 13 deletions

View File

@ -19,6 +19,7 @@
#include "ride.h"
#include "track.h"
#include "ride_data.h"
#include "vehicle_data.h"
static void cable_lift_update_moving_to_end_of_station(rct_vehicle *vehicle);
static void cable_lift_update_waiting_to_depart(rct_vehicle *vehicle);
@ -287,7 +288,7 @@ static bool sub_6DF01A_loop(rct_vehicle* vehicle) {
if (unk.z != unk_F64E20->z)
bx |= (1 << 2);
vehicle->remaining_distance -= RCT2_ADDRESS(0x009A2930, sint32)[bx];
vehicle->remaining_distance -= dword_9A2930[bx];
unk_F64E20->x = unk.x;
unk_F64E20->y = unk.y;
unk_F64E20->z = unk.z;
@ -297,7 +298,7 @@ static bool sub_6DF01A_loop(rct_vehicle* vehicle) {
vehicle->vehicle_sprite_type = moveInfo->vehicle_sprite_type;
if (vehicle->remaining_distance >= 13962) {
vehicle->acceleration += RCT2_ADDRESS(0x009A2970, sint32)[vehicle->vehicle_sprite_type];
vehicle->acceleration += dword_9A2970[vehicle->vehicle_sprite_type];
}
}
return true;
@ -373,7 +374,7 @@ static bool sub_6DF21B_loop(rct_vehicle* vehicle) {
if (unk.z != unk_F64E20->z)
bx |= (1 << 2);
vehicle->remaining_distance += RCT2_ADDRESS(0x009A2930, sint32)[bx];
vehicle->remaining_distance += dword_9A2930[bx];
unk_F64E20->x = unk.x;
unk_F64E20->y = unk.y;
unk_F64E20->z = unk.z;
@ -383,7 +384,7 @@ static bool sub_6DF21B_loop(rct_vehicle* vehicle) {
vehicle->vehicle_sprite_type = moveInfo->vehicle_sprite_type;
if (vehicle->remaining_distance < 0) {
vehicle->acceleration += RCT2_ADDRESS(0x009A2970, sint32)[vehicle->vehicle_sprite_type];
vehicle->acceleration += dword_9A2970[vehicle->vehicle_sprite_type];
}
}
return true;
@ -412,7 +413,7 @@ int cable_lift_update_track_motion(rct_vehicle *cableLift)
RCT2_GLOBAL(0x00F64E00, rct_vehicle*) = frontVehicle;
for (rct_vehicle* vehicle = frontVehicle;;) {
vehicle->acceleration = RCT2_ADDRESS(0x009A2970, sint32)[vehicle->vehicle_sprite_type];
vehicle->acceleration = dword_9A2970[vehicle->vehicle_sprite_type];
RCT2_GLOBAL(0x00F64E10, uint32) = 1;
vehicle->remaining_distance += RCT2_GLOBAL(0x00F64E0C, sint32);
@ -432,7 +433,7 @@ int cable_lift_update_track_motion(rct_vehicle *cableLift)
RCT2_GLOBAL(0x00F64E18, uint32) |= (1 << 5);
RCT2_GLOBAL(0x00F64E0C, uint32) -= vehicle->remaining_distance - 13962;
vehicle->remaining_distance = 13962;
vehicle->acceleration += RCT2_ADDRESS(0x009A2970, uint32)[vehicle->vehicle_sprite_type];
vehicle->acceleration += dword_9A2970[vehicle->vehicle_sprite_type];
RCT2_GLOBAL(0x00F64E10, uint32)++;
continue;
}
@ -445,7 +446,7 @@ int cable_lift_update_track_motion(rct_vehicle *cableLift)
RCT2_GLOBAL(0x00F64E18, uint32) |= (1 << 5);
RCT2_GLOBAL(0x00F64E0C, uint32) -= vehicle->remaining_distance + 1;
vehicle->remaining_distance = -1;
vehicle->acceleration += RCT2_ADDRESS(0x009A2970, uint32)[vehicle->vehicle_sprite_type];
vehicle->acceleration += dword_9A2970[vehicle->vehicle_sprite_type];
RCT2_GLOBAL(0x00F64E10, uint32)++;
}
}

View File

@ -4632,7 +4632,7 @@ static void vehicle_update_sound(rct_vehicle *vehicle)
vehicle->sound2_volume = (soundIdVolume >> 8) & 0xFF;
{
int ebx = RCT2_ADDRESS(0x009A3684, sint16)[vehicle->sprite_direction];
int ebx = word_9A3684[vehicle->sprite_direction];
int eax = ((vehicle->velocity >> 14) * ebx) >> 14;
eax = clamp(-127, eax, 127);
@ -5538,9 +5538,6 @@ bool vehicle_update_bumper_car_collision(rct_vehicle *vehicle, sint16 x, sint16
return false;
}
// rct2: 0x009A2970
const sint32 *dword_9A2970 = RCT2_ADDRESS(0x009A2970, sint32);
/**
*
* rct2: 0x006DAB90
@ -7315,7 +7312,7 @@ loc_6DAEB9:
}
// loc_6DB8A5
regs.ebx = RCT2_ADDRESS(0x009A2930, sint32)[regs.ebx];
regs.ebx = dword_9A2930[regs.ebx];
vehicle->remaining_distance -= regs.ebx;
unk_F64E20->x = x;
unk_F64E20->y = y;
@ -7591,7 +7588,7 @@ loc_6DBA33:;
if (x != unk_F64E20->x) { regs.ebx |= 1; }
if (y != unk_F64E20->y) { regs.ebx |= 2; }
if (z != unk_F64E20->z) { regs.ebx |= 4; }
vehicle->remaining_distance += RCT2_ADDRESS(0x009A2930, sint32)[regs.ebx];
vehicle->remaining_distance += dword_9A2930[regs.ebx];
unk_F64E20->x = x;
unk_F64E20->y = y;

View File

@ -798,3 +798,123 @@ const uint8 MotionSimulatorTimeToSpriteMap[] = {
};
const int MotionSimulatorTimeToSpriteMapCount = countof(MotionSimulatorTimeToSpriteMap);
/** rct2: 0x009A2930 */
const sint32 dword_9A2930[] = {
0, // 0000
8716, // 0001
8716, // 0010
12327, // 0011
6554, // 0100
10905, // 0101
10905, // 0110
13961, // 0111
0, // 1000
21790, // 1001
21790, // 1010
30817, // 1011
16385, // 1100
27262, // 1101
27262, // 1110
34902, // 1111
};
/** rct2: 0x009A2970 */
const sint32 dword_9A2970[] = {
0, // 0
-124548, // 1
-243318, // 2
-416016, // 3
-546342, // 4
124548, // 5
243318, // 6
416016, // 7
546342, // 8
-617604, // 9
-642000, // 10
-620172, // 11
-555972, // 12
-453894, // 13
-321000, // 14
-166278, // 15
0, // 16
617604, // 17
642000, // 18
620172, // 19
555972, // 20
453894, // 21
321000, // 22
166278, // 23
-321000, // 24
-555972, // 25
-642000, // 26
-555972, // 27
-321000, // 28
321000, // 29
555972, // 30
642000, // 31
555972, // 32
321000, // 33
-321000, // 34
-555972, // 35
-642000, // 36
-555972, // 37
-321000, // 38
321000, // 39
555972, // 40
642000, // 41
555972, // 42
321000, // 43
-33384, // 44
-55854, // 45
33384, // 46
55854, // 47
-66768, // 48
66768, // 49
-90522, // 50
-179760, // 51
-484068, // 52
90522, // 53
179760, // 54
484068, // 55
243318, // 56
416016, // 57
546342, // 58
-110424, // 59
};
/** rct2: 0x009A3684 */
const sint32 word_9A3684[] = {
-0x4000, // 0
-0x3000, // 1
-0x2000, // 2
-0x1000, // 3
0, // 4
0x1000, // 5
0x2000, // 6
0x3000, // 7
0x4000, // 8
0x4800, // 9
0x4800, // 10
0x4800, // 11
0x4800, // 12
0x4800, // 13
0x4800, // 14
0x4800, // 15
0x4000, // 16
0x3000, // 17
0x2000, // 18
0x1000, // 19
0, // 20
-0x1000, // 21
-0x2000, // 22
-0x3000, // 23
-0x4000, // 24
-0x4800, // 25
-0x4800, // 26
-0x4800, // 27
-0x4800, // 28
-0x4800, // 29
-0x4800, // 30
-0x4800, // 31
};

View File

@ -33,4 +33,9 @@ extern const top_spin_time_to_sprite_map * TopSpinTimeToSpriteMaps[];
extern const uint8 MotionSimulatorTimeToSpriteMap[];
extern const int MotionSimulatorTimeToSpriteMapCount;
extern const sint32 dword_9A2930[];
extern const sint32 dword_9A2970[];
extern const sint32 word_9A3684[];
#endif