finally fix #1619: Can't place any path

RCT2_ADDRESS_TOOL_WIDGETINDEX was being read as an int32 sometimes
This commit is contained in:
IntelOrca committed 2015-12-21 22:28:34 +00:00
1 parent 13ce4b6a23
commit db18fa8f14
12 files changed
+25 -25

No files matched your search

+5 -5
View File
@@ -368,7 +368,7 @@ static void game_handle_input_mouse(int x, int y, int state)
if (w == NULL)
break;
window_event_tool_drag_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint32), x, y);
window_event_tool_drag_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), x, y);
}
else if (state == 2){
@@ -1016,7 +1016,7 @@ static void input_widget_left(int x, int y, rct_window *w, int widgetIndex)
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)
);
if (w != NULL) {
window_event_tool_down_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint32), x, y);
window_event_tool_down_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), x, y);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_4;
}
}
@@ -1157,14 +1157,14 @@ void process_mouse_tool(int x, int y)
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)
{
rct_window* w = window_find_by_number(
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8),
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, uint16)
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass),
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)
);
if (!w)
tool_cancel();
else
window_event_tool_update_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint32), x, y);
window_event_tool_update_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), x, y);
}
}
+1 -1
View File
@@ -101,7 +101,7 @@ void viewport_init_all()
RCT2_GLOBAL(RCT2_ADDRESS_ACTIVE_VIEWPORT_PTR_ARRAY, rct_viewport*) = NULL;
// ?
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, sint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, sint8) = INPUT_STATE_RESET;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass) = -1;
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, sint32) = -1;
+1 -1
View File
@@ -1014,7 +1014,7 @@ int widget_is_active_tool(rct_window *w, int widgetIndex)
return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber) != w->number)
return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, sint32) != widgetIndex)
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) != widgetIndex)
return 0;
return 1;
+1 -1
View File
@@ -1778,7 +1778,7 @@ void tool_cancel()
// Reset map selection
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) = 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, sint16) >= 0) {
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) >= 0) {
// Invalidate tool widget
widget_invalidate_by_number(
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass),
+2 -2
View File
@@ -1603,7 +1603,7 @@ static int ride_modify_entrance_or_exit(rct_map_element *mapElement, int x, int
sub_6C9627();
if (
_rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT ||
!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint8) & INPUT_FLAG_TOOL_ACTIVE) ||
!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) ||
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) != WC_RIDE_CONSTRUCTION
) {
// Replace entrance / exit
@@ -1611,7 +1611,7 @@ static int ride_modify_entrance_or_exit(rct_map_element *mapElement, int x, int
RCT2_GLOBAL(0x00F44191, uint8) = entranceType;
RCT2_GLOBAL(0x00F44192, uint8) = rideIndex;
RCT2_GLOBAL(0x00F44193, uint8) = bl;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint8) |= INPUT_FLAG_6;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT) {
RCT2_GLOBAL(0x00F440CC, uint8) = _rideConstructionState;
_rideConstructionState = RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT;
+3 -3
View File
@@ -741,8 +741,8 @@ static void window_map_invalidate(rct_window *w)
// scenario editor: build park entrance selected, show rotate button
if (
(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == WC_MAP &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint8) == WIDX_BUILD_PARK_ENTRANCE
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) == WC_MAP &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == WIDX_BUILD_PARK_ENTRANCE
) {
w->widgets[WIDX_ROTATE_90].type = WWT_FLATBTN;
}
@@ -756,7 +756,7 @@ static void window_map_invalidate(rct_window *w)
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == WC_MAP
) {
// if not in set land rights mode: show the default scenario editor buttons
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint8) != WIDX_SET_LAND_RIGHTS) {
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) != WIDX_SET_LAND_RIGHTS) {
window_map_show_default_scenario_editor_buttons(w);
} else { // if in set land rights mode: show land tool buttons + modes
w->widgets[WIDX_LAND_TOOL].type = WWT_IMGBTN;
+1 -1
View File
@@ -81,7 +81,7 @@ void window_map_tooltip_update_visibility()
cursorX = RCT2_GLOBAL(0x0142406C, sint32);
cursorY = RCT2_GLOBAL(0x01424070, sint32);
inputFlags = RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint8);
inputFlags = RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32);
// Check for cursor movement
_cursorHoldDuration++;
+2 -2
View File
@@ -311,7 +311,7 @@ static void window_maze_construction_update(rct_window *w)
case RIDE_CONSTRUCTION_STATE_BACK:
case RIDE_CONSTRUCTION_STATE_SELECTED:
if (
(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint8) & INPUT_FLAG_TOOL_ACTIVE) &&
(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) == WC_RIDE_CONSTRUCTION
) {
tool_cancel();
@@ -386,7 +386,7 @@ static void window_maze_construction_entrance_tooldown(int x, int y, rct_window*
else{
RCT2_GLOBAL(0x00F44191, uint8) = is_exit ^ 1;
window_invalidate_by_class(WC_RIDE_CONSTRUCTION);
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint8) = is_exit ? WIDX_MAZE_ENTRANCE : WIDX_MAZE_EXIT;
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) = is_exit ? WIDX_MAZE_ENTRANCE : WIDX_MAZE_EXIT;
}
}
+2 -2
View File
@@ -1266,7 +1266,7 @@ rct_window *window_ride_open_station(int rideIndex, int stationIndex)
}
if (
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint8) & INPUT_FLAG_TOOL_ACTIVE &&
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) == w->classification &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber) == w->number
) {
@@ -1345,7 +1345,7 @@ rct_window *window_ride_open_vehicle(rct_vehicle *vehicle)
window_invalidate(w);
if (
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint8) & INPUT_FLAG_TOOL_ACTIVE &&
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) == w->classification &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber) == w->number
) {
+2 -2
View File
@@ -1862,7 +1862,7 @@ static void window_ride_construction_entrance_click(rct_window *w)
RCT2_GLOBAL(0x00F44191, uint8) = 0;
RCT2_GLOBAL(0x00F44192, uint8) = w->number & 0xFF;
RCT2_GLOBAL(0x00F44193, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint8) |= INPUT_FLAG_6;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
sub_6C9627();
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT) {
RCT2_GLOBAL(0x00F440CC, uint8) = _rideConstructionState;
@@ -1886,7 +1886,7 @@ static void window_ride_construction_exit_click(rct_window *w)
RCT2_GLOBAL(0x00F44191, uint8) = 1;
RCT2_GLOBAL(0x00F44192, uint8) = w->number & 0xFF;
RCT2_GLOBAL(0x00F44193, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint8) |= INPUT_FLAG_6;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_6;
sub_6C9627();
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT) {
RCT2_GLOBAL(0x00F440CC, uint8) = _rideConstructionState;
+1 -1
View File
@@ -488,7 +488,7 @@ void window_scenery_open()
*/
bool window_scenery_is_scenery_tool_active() {
int toolWindowClassification = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass);
int toolWidgetIndex = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, rct_windownumber);
int toolWidgetIndex = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16);
if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)
if (toolWindowClassification == WC_TOP_TOOLBAR && toolWidgetIndex == 9) // 9 is WIDX_SCENERY
+4 -4
View File
@@ -3117,7 +3117,7 @@ void toggle_footpath_window()
*/
void toggle_land_window(rct_window *topToolbar, int widgetIndex)
{
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 7) {
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 7) {
tool_cancel();
} else {
show_gridlines();
@@ -3134,7 +3134,7 @@ void toggle_land_window(rct_window *topToolbar, int widgetIndex)
*/
void toggle_clear_scenery_window(rct_window *topToolbar, int widgetIndex)
{
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 16) {
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 16) {
tool_cancel();
} else {
show_gridlines();
@@ -3151,7 +3151,7 @@ void toggle_clear_scenery_window(rct_window *topToolbar, int widgetIndex)
*/
void toggle_water_window(rct_window *topToolbar, int widgetIndex)
{
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 8) {
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 8) {
tool_cancel();
} else {
show_gridlines();
@@ -3172,7 +3172,7 @@ bool land_tool_is_active()
return false;
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) != WC_TOP_TOOLBAR)
return false;
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, sint16) != WIDX_LAND)
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) != WIDX_LAND)
return false;
return true;
}