Merge pull request #332 from duncanspumpkin/update_viewport_left

Update viewport left and fix #318
This commit is contained in:
Ted John 2014-08-19 21:30:32 +01:00
commit c7edafc627
3 changed files with 19 additions and 23 deletions

View File

@ -918,20 +918,18 @@ static void game_handle_input_mouse(int x, int y, int state)
}
}
else if ((ebx & 0xFF) == 3){
//Don't think it is a map element.
rct_map_element_properties* map_element = (rct_map_element_properties*)spr;
uint32 edx = (uint32)spr;
if (!((map_element->track.type & 0x3C) == 16)){
eax = RCT2_ADDRESS(0x0099BA64, uint8)[16 * (*(uint8*)(edx + 4))];
if (!(eax & 0x10)){
eax = *((uint8*)(edx + 7));
RCT2_CALLPROC_X(0x6ACC28, eax, ebx, ecx, edx, esi, edi, ebp);
rct_map_element* map_element = (rct_map_element*)spr;
if (!((map_element->type & MAP_ELEMENT_TYPE_MASK) == MAP_ELEMENT_TYPE_ENTRANCE)){
eax = RCT2_ADDRESS(0x0099BA64, uint8)[16 * map_element->properties.track.type];
if (!(eax & 0x10)){//If not station track
//Open ride window in overview mode.
RCT2_CALLPROC_X(0x6ACC28, map_element->properties.track.ride_index, ebx, ecx, (int)map_element, esi, edi, ebp);
break;
}
}
//Open ride window
RCT2_CALLPROC_X(0x6ACCCE, *(uint8*)(edx + 7), ((*(uint8*)(edx + 5)) & 0x70) >> 4, ecx, edx, esi, edi, ebp);
//Open ride window in station view
RCT2_CALLPROC_X(0x6ACCCE, map_element->properties.track.ride_index, (map_element->properties.track.sequence & 0x70) >> 4, ecx, (int)map_element, esi, edi, ebp);
}
else if ((ebx & 0xFF) == 8){
window_park_entrance_open();

View File

@ -260,27 +260,25 @@ void ride_entrance_exit_connected(rct_ride* ride, int ride_idx)
void ride_shop_connected(rct_ride* ride, int ride_idx)
{
rct_ride* ride_back = ride;
uint16 coordinate = ride->station_starts[0];
if (coordinate == 0xFFFF)
return;
int x = ((coordinate >> 8) & 0xFF) << 5, // cx
y = (coordinate & 0xFF) << 5; // ax
uint16 entrance_directions = 0;
int tile_idx = ((x << 8) | y) >> 5, count = 0;
rct_map_element* tile = RCT2_ADDRESS(RCT2_ADDRESS_TILE_MAP_ELEMENT_POINTERS, rct_map_element*)[tile_idx];
while (1) {
rct_map_element* tile = RCT2_ADDRESS(RCT2_ADDRESS_TILE_MAP_ELEMENT_POINTERS, rct_map_element*)[coordinate];
for (; ; tile++){
uint8 element_type = tile->type & MAP_ELEMENT_TYPE_MASK;
if(element_type == MAP_ELEMENT_TYPE_TRACK && tile->properties.track.ride_index == ride_idx)
break;
if(tile->flags & MAP_ELEMENT_FLAG_LAST_TILE)
return;
tile++;
}
uint16 entrance_directions = 0;
uint8 track_type = tile->properties.track.type;
ride = &g_ride_list[tile->properties.track.ride_index];
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x80000) {
@ -306,9 +304,9 @@ void ride_shop_connected(rct_ride* ride, int ride_idx)
entrance_directions >>= 1;
uint8 face_direction = count ^ 2; // flip direction north<->south, east<->west
y -= RCT2_ADDRESS(0x00993CCC, sint16)[face_direction * 2];
x -= RCT2_ADDRESS(0x00993CCE, sint16)[face_direction * 2];
tile_idx = ((x << 8) | y) >> 5;
int y2 = y - RCT2_ADDRESS(0x00993CCC, sint16)[face_direction * 2];
int x2 = x - RCT2_ADDRESS(0x00993CCE, sint16)[face_direction * 2];
int tile_idx = ((x2 << 8) | y2) >> 5;
if (map_coord_is_connected(tile_idx, tile->base_height, face_direction))
return;

View File

@ -121,6 +121,6 @@ void window_new_ride_open()
w->var_482 = RCT2_GLOBAL(0x00F43523, sint16);
w->width = 1;
RCT2_CALLPROC_EBPSAFE(0x006B3DF1); // initialise window size and widgets
RCT2_CALLPROC_EBPSAFE(0x006B7220);
RCT2_CALLPROC_X(0x006B3DF1, 0, 0, 0, 0, (int)w, 0, 0); // initialise window size and widgets
RCT2_CALLPROC_X(0x006B7220, 0, 0, 0, 0, (int)w, 0, 0);
}