Fix another viewport issue by removing new function call it can be fixed at a later date. Change viewport address name to make it more obvious how to use it.

This commit is contained in:
Duncan Frost 2014-11-09 08:50:02 +00:00
parent 6aa0241c23
commit 8f2b180603
4 changed files with 20 additions and 17 deletions

View File

@ -382,8 +382,11 @@
#define RCT2_ADDRESS_WINDOW_LIST 0x01420078
#define RCT2_ADDRESS_NEW_WINDOW_PTR 0x014234B8
#define RCT2_ADDRESS_VIEWPORT_LIST 0x014234BC
#define RCT2_ADDRESS_NEW_VIEWPORT_PTR 0x01423570
// Null Terminated list of active viewport pointers.
// This is also the end of RCT2_ADDRESS_VIEWPORT_LIST.
#define RCT2_ADDRESS_ACTIVE_VIEWPORT_PTR_ARRAY 0x01423570
#define RCT2_ADDRESS_HCURSOR_START 0x01423598
#define RCT2_ADDRESS_HCURSOR_ARROW 0x01423598

View File

@ -191,8 +191,8 @@ void gfx_invalidate_scrollingtext(int x, int y, int base_height, int clearance_h
bottom = ((-y + x) / 2) + 32 - base_height;
break;
}
rct_viewport** viewport_p = RCT2_ADDRESS(RCT2_ADDRESS_NEW_VIEWPORT_PTR, rct_viewport*);
while (*viewport_p) {
for (rct_viewport** viewport_p = RCT2_ADDRESS(RCT2_ADDRESS_ACTIVE_VIEWPORT_PTR_ARRAY, rct_viewport*); *viewport_p; ++viewport_p)
{
rct_viewport* viewport = *viewport_p;
if (viewport->zoom < 1) {
if (right > viewport->view_x && bottom > viewport->view_y && left < viewport->view_x + viewport->view_width) {
@ -217,7 +217,6 @@ void gfx_invalidate_scrollingtext(int x, int y, int base_height, int clearance_h
}
}
}
viewport_p++;
}
}

View File

@ -30,8 +30,8 @@
#include "window.h"
#define RCT2_FIRST_VIEWPORT (RCT2_ADDRESS(RCT2_ADDRESS_VIEWPORT_LIST, rct_viewport))
#define RCT2_LAST_VIEWPORT (RCT2_GLOBAL(RCT2_ADDRESS_NEW_VIEWPORT_PTR, rct_viewport*) - 1)
#define RCT2_NEW_VIEWPORT (RCT2_GLOBAL(RCT2_ADDRESS_NEW_VIEWPORT_PTR, rct_viewport*))
#define RCT2_LAST_VIEWPORT (RCT2_ADDRESS(RCT2_ADDRESS_ACTIVE_VIEWPORT_PTR_ARRAY, rct_viewport) - 1)
#define RCT2_NEW_VIEWPORT (RCT2_GLOBAL(RCT2_ADDRESS_ACTIVE_VIEWPORT_PTR_ARRAY, rct_viewport*))
//#define DEBUG_SHOW_DIRTY_BOX
@ -156,7 +156,7 @@ void viewport_create(rct_window *w, int x, int y, int width, int height, int zoo
{
rct_viewport* viewport;
for (viewport = g_viewport_list; viewport->width != 0; viewport++){
if (viewport >= RCT2_ADDRESS(RCT2_ADDRESS_NEW_VIEWPORT_PTR, rct_viewport)){
if (viewport > RCT2_LAST_VIEWPORT){
error_string_quit(0xFF000001, -1);
}
}
@ -212,11 +212,10 @@ void viewport_create(rct_window *w, int x, int y, int width, int height, int zoo
void viewport_update_pointers()
{
rct_viewport *viewport;
rct_viewport **vp = RCT2_ADDRESS(RCT2_ADDRESS_NEW_VIEWPORT_PTR, rct_viewport*);
rct_viewport **vp = RCT2_ADDRESS(RCT2_ADDRESS_ACTIVE_VIEWPORT_PTR_ARRAY, rct_viewport*);
// The last possible viewport entry is 1 before what is the new_viewport_ptr
// This is why it is rct_viewport and not rct_viewport*.
for (viewport = g_viewport_list; viewport < RCT2_ADDRESS(RCT2_ADDRESS_NEW_VIEWPORT_PTR, rct_viewport); viewport++)
// The last possible viewport entry is 1 before what is the active viewport_ptr_array
for (viewport = g_viewport_list; viewport <= RCT2_LAST_VIEWPORT; viewport++)
if (viewport->width != 0)
*vp++ = viewport;
@ -336,6 +335,7 @@ void sub_6E7F34(rct_window* w, rct_viewport* viewport){
RCT2_CALLPROC_X(0x6E7FF3, 0, 0, 0, right, (int)viewport, (int)w, bottom);
}
/* There is a bug in this. */
void sub_6E7DE1(sint16 x, sint16 y, rct_window* w, rct_viewport* viewport){
//RCT2_CALLPROC_X(0x6E7DE1, x, y, 0, 0, w, viewport, 0);
//return;
@ -401,7 +401,7 @@ void sub_6E7DE1(sint16 x, sint16 y, rct_window* w, rct_viewport* viewport){
return;
}
sub_6E7F34(w, viewport);
//sub_6E7F34(w, viewport);
//RCT2_CALLPROC_X(0x6E7F34, 0, 0, 0, 0, (int)viewport, (int)w, 0);
memcpy(viewport, &view_copy, sizeof(rct_viewport));
@ -431,8 +431,8 @@ void viewport_update_position(rct_window *window)
int center_x, center_y;
center_2d_coordinates(sprite->unknown.x, sprite->unknown.y, sprite->unknown.z, &center_x, &center_y, window->viewport);
sub_6E7DE1(center_x, center_y, window, viewport);
//RCT2_CALLPROC_X(0x6E7DE1, center_x, center_y, 0, 0, (int)window, (int)viewport, 0);
//sub_6E7DE1(center_x, center_y, window, viewport);
RCT2_CALLPROC_X(0x6E7DE1, center_x, center_y, 0, 0, (int)window, (int)viewport, 0);
return;
}
@ -524,8 +524,8 @@ void viewport_update_position(rct_window *window)
y += viewport->view_y;
}
sub_6E7DE1(x, y, window, viewport);
//RCT2_CALLPROC_X(0x6E7DE1, x, y, 0, 0, (int)window, (int)viewport, 0);
//sub_6E7DE1(x, y, window, viewport);
RCT2_CALLPROC_X(0x6E7DE1, x, y, 0, 0, (int)window, (int)viewport, 0);
}
void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, int top, int right, int bottom);

View File

@ -112,7 +112,8 @@ void invalidate_sprite(rct_peep* peep){
if (peep->var_16 == (sint16)0x8000) return;
// Note this function is different to original perhaps change back (part of viewport testing)
for (rct_viewport* viewport = RCT2_ADDRESS(RCT2_ADDRESS_VIEWPORT_LIST, rct_viewport); viewport < RCT2_ADDRESS(RCT2_ADDRESS_NEW_VIEWPORT_PTR, rct_viewport) && viewport->width; viewport++){
for (rct_viewport** viewport_p = RCT2_ADDRESS(RCT2_ADDRESS_ACTIVE_VIEWPORT_PTR_ARRAY, rct_viewport*); *viewport_p!= NULL; viewport_p++){
rct_viewport* viewport = *viewport_p;
int left, right, top, bottom;
left = peep->var_16;
right = peep->var_1A;