Merge pull request #4282 from marijnvdwerf/clean/data-15-maze

[Cleanup] Integrate peep maze data
This commit is contained in:
Ted John 2016-08-14 14:27:19 +01:00 committed by GitHub
commit 78b788e660
1 changed files with 33 additions and 7 deletions

View File

@ -2386,6 +2386,14 @@ static void peep_update_ride_sub_state_0(rct_peep* peep){
peep_go_to_ride_entrance(peep, ride);
}
/** rct2: 0x00981FD4, 0x00981FD6 */
static const rct_xy16 _981FD4[] = {
{ 8, 8 },
{ 8, 24 },
{ 24, 24 },
{ 24, 8 },
};
/**
*
* rct2: 0x006921D3
@ -2456,11 +2464,12 @@ static void peep_update_ride_sub_state_1(rct_peep* peep){
}
direction &= 0xF;
// Direction is 11, 15, 3, or 7
peep->var_37 = direction;
peep->maze_last_edge &= 3;
x += RCT2_GLOBAL(0x981FD1 + direction, sint16);
y += RCT2_GLOBAL(0x981FD3 + direction, sint16);
x += _981FD4[direction / 4].x;
y += _981FD4[direction / 4].y;
peep->destination_x = x;
peep->destination_y = y;
@ -3590,6 +3599,22 @@ static void peep_update_ride_sub_state_16(rct_peep* peep){
peep->destination_y = y;
}
/** rct2: 0x00981FE4 */
static const uint8 _981FE4[][4] = {
{ 15, 7, 15, 7 },
{ 11, 3, 11, 3 },
{ 7, 15, 7, 15 },
{ 3, 11, 3, 11 },
};
/** rct2: 0x00981FF4 */
static const uint8 _981FF4[][4] = {
{ 1, 2, 14, 0 },
{ 4, 5, 6, 2 },
{ 6, 8, 9, 10 },
{ 14, 10, 12, 13 },
};
/**
*
* rct2: 0x00692A83
@ -3637,20 +3662,21 @@ static void peep_update_ride_sub_state_17(rct_peep* peep){
uint16 maze_entry = mapElement->properties.track.maze_entry;
uint16 open_hedges = 0;
uint8 var_37 = peep->var_37;
// var_37 is 3, 7, 11 or 15
if (maze_entry & (1 << RCT2_ADDRESS(0x981FF4, uint8)[var_37])){
if (maze_entry & (1 << _981FF4[var_37 / 4][3])) {
open_hedges = 1;
}
open_hedges <<= 1;
if (maze_entry & (1 << RCT2_ADDRESS(0x981FF3, uint8)[var_37])){
if (maze_entry & (1 << _981FF4[var_37 / 4][2])) {
open_hedges |= 1;
}
open_hedges <<= 1;
if (maze_entry & (1 << RCT2_ADDRESS(0x981FF2, uint8)[var_37])){
if (maze_entry & (1 << _981FF4[var_37 / 4][1])) {
open_hedges |= 1;
}
open_hedges <<= 1;
if (maze_entry & (1 << RCT2_ADDRESS(0x981FF1, uint8)[var_37])){
if (maze_entry & (1 << _981FF4[var_37 / 4][0])) {
open_hedges |= 1;
}
@ -3702,7 +3728,7 @@ static void peep_update_ride_sub_state_17(rct_peep* peep){
peep->destination_x = x;
peep->destination_y = y;
peep->var_37 = RCT2_ADDRESS(0x981FE1, uint8)[peep->var_37 + chosen_edge];
peep->var_37 = _981FE4[peep->var_37 / 4][chosen_edge];
peep->maze_last_edge = chosen_edge;
break;
case 2: