1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

integrate pickup peep variables

This commit is contained in:
Ted John
2016-04-24 10:28:08 +01:00
parent e7f62bf014
commit 0a80e7a737
6 changed files with 33 additions and 31 deletions

View File

@@ -152,10 +152,6 @@
#define RCT2_ADDRESS_TICKS_SINCE_DRAG_START 0x009DE540
#define RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE 0x009DE550
#define RCT2_ADDRESS_PICKEDUP_PEEP_X 0x009DE554
#define RCT2_ADDRESS_PICKEDUP_PEEP_Y 0x009DE556
#define RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS 0x009DE55C
#define RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER 0x009DE55E
#define RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX 0x009DE560
@@ -580,6 +576,10 @@
#define RCT2_ADDRESS_CURRENT_TOOL 0x009DE545
#define RCT2_ADDRESS_TOOL_WIDGETINDEX 0x009DE546
#define RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE 0x009DE550
#define RCT2_ADDRESS_PICKEDUP_PEEP_X 0x009DE554
#define RCT2_ADDRESS_PICKEDUP_PEEP_Y 0x009DE556
#define RCT2_ADDRESS_PALETTE_EFFECT_FRAME_NO 0x009DE584
#define RCT2_ADDRESS_SCREEN_AGE 0x009DEA66

View File

@@ -50,6 +50,10 @@ static uint32 _numRainPixels;
uint8 gGamePalette[256 * 4];
uint32 gPaletteEffectFrame;
uint32 gPickupPeepImage;
sint32 gPickupPeepX;
sint32 gPickupPeepY;
//Originally 0x9ABE0C, 12 elements from 0xF3 are the peep top colour, 12 elements from 0xCA are peep trouser colour
const uint8 peep_palette[0x100] = {
@@ -509,15 +513,15 @@ void redraw_rain()
void gfx_invalidate_pickedup_peep()
{
int sprite = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, sint32);
if (sprite != -1) {
uint32 sprite = gPickupPeepImage;
if (sprite != UINT32_MAX) {
sprite = sprite & 0x7FFFF;
rct_g1_element *g1_elements = &g1Elements[sprite];
int left = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_X, sint16) + g1_elements->x_offset;
int top = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_Y, sint16) + g1_elements->y_offset;
int right = left + g1_elements->width;
int bottom = top + g1_elements->height;
sint32 left = gPickupPeepX + g1_elements->x_offset;
sint32 top = gPickupPeepY + g1_elements->y_offset;
sint32 right = left + g1_elements->width;
sint32 bottom = top + g1_elements->height;
gfx_set_dirty_blocks(left, top, right, bottom);
}
@@ -525,14 +529,8 @@ void gfx_invalidate_pickedup_peep()
void gfx_draw_pickedup_peep()
{
// Draw picked-up peep
if (RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, uint32) != 0xFFFFFFFF) {
gfx_draw_sprite(
&gScreenDPI,
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, uint32),
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_X, sint16),
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_Y, sint16), 0
);
if (gPickupPeepImage != UINT32_MAX) {
gfx_draw_sprite(&gScreenDPI, gPickupPeepImage, gPickupPeepX, gPickupPeepY, 0);
}
}

View File

@@ -92,6 +92,10 @@ extern uint8 text_palette[];
extern int gLastDrawStringX;
extern int gLastDrawStringY;
extern uint32 gPickupPeepImage;
extern sint32 gPickupPeepX;
extern sint32 gPickupPeepY;
extern rct_g1_element *g1Elements;
extern rct_gx g2;

View File

@@ -103,7 +103,7 @@ void viewport_init_all()
gInputFlags = 0;
gInputState = INPUT_STATE_RESET;
gPressedWidget.window_classification = 255;
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, sint32) = -1;
gPickupPeepImage = UINT32_MAX;
gTooltipNotShownTicks = -1;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, sint16) = 0;
RCT2_GLOBAL(0x009DEA50, sint16) = -1;

View File

@@ -1189,7 +1189,7 @@ void window_guest_overview_tool_update(rct_window* w, int widgetIndex, int x, in
map_invalidate_selection_rect();
}
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, sint32) = -1;
gPickupPeepImage = UINT32_MAX;
int interactionType;
get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_NONE, NULL, NULL, &interactionType, NULL, NULL);
@@ -1198,8 +1198,8 @@ void window_guest_overview_tool_update(rct_window* w, int widgetIndex, int x, in
x--;
y += 16;
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_X, uint16) = x;
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_Y, uint16) = y;
gPickupPeepX = x;
gPickupPeepY = y;
w->picked_peep_frame++;
if (w->picked_peep_frame >= 48) {
w->picked_peep_frame = 0;
@@ -1212,7 +1212,7 @@ void window_guest_overview_tool_update(rct_window* w, int widgetIndex, int x, in
imageId += w->picked_peep_frame >> 2;
imageId |= (peep->tshirt_colour << 19) | (peep->trousers_colour << 24) | 0xA0000000;
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, uint32) = imageId;
gPickupPeepImage = imageId;
}
/**
@@ -1270,7 +1270,7 @@ void window_guest_overview_tool_down(rct_window* w, int widgetIndex, int x, int
sub_693B58(peep);
tool_cancel();
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, sint32) = -1;
gPickupPeepImage = UINT32_MAX;
}
/**
@@ -1300,7 +1300,7 @@ void window_guest_overview_tool_abort(rct_window *w, int widgetIndex)
peep->var_C4 = 0;
}
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, sint32) = -1;
gPickupPeepImage = UINT32_MAX;
}
/**

View File

@@ -1112,7 +1112,7 @@ void window_staff_overview_tool_update(rct_window* w, int widgetIndex, int x, in
map_invalidate_selection_rect();
}
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, sint32) = -1;
gPickupPeepImage = UINT32_MAX;
int interactionType;
get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_NONE, NULL, NULL, &interactionType, NULL, NULL);
@@ -1121,8 +1121,8 @@ void window_staff_overview_tool_update(rct_window* w, int widgetIndex, int x, in
x--;
y += 16;
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_X, uint16) = x;
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_Y, uint16) = y;
gPickupPeepX = x;
gPickupPeepY = y;
w->picked_peep_frame++;
if (w->picked_peep_frame >= 48) {
w->picked_peep_frame = 0;
@@ -1135,7 +1135,7 @@ void window_staff_overview_tool_update(rct_window* w, int widgetIndex, int x, in
imageId += w->picked_peep_frame >> 2;
imageId |= (peep->tshirt_colour << 19) | (peep->trousers_colour << 24) | 0xA0000000;
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, uint32) = imageId;
gPickupPeepImage = imageId;
}
/**
@@ -1188,7 +1188,7 @@ void window_staff_overview_tool_down(rct_window* w, int widgetIndex, int x, int
peep->var_C4 = 0;
tool_cancel();
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, sint32) = -1;
gPickupPeepImage = UINT32_MAX;
}
else if (widgetIndex == WIDX_PATROL){
int dest_x, dest_y;
@@ -1224,7 +1224,7 @@ void window_staff_overview_tool_abort(rct_window *w, int widgetIndex)
peep->var_C4 = 0;
}
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_IMAGE, sint32) = -1;
gPickupPeepImage = UINT32_MAX;
}
else if (widgetIndex == WIDX_PATROL){
hide_gridlines();