1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Added C code instead of address call

- Temporary address call in window_map.c:window_map_mouseup event is now
replaced by reversed code

Delete Output-Build.txt

Replaced assembly code with macro

Edit a bunch of GCC assembly macros

Remove scope from case

Added C code instead of address call

- Temporary address call in window_map.c:window_map_mouseup event is now
replaced by reversed code
This commit is contained in:
King_Hual
2014-09-12 22:35:27 +03:00
parent 11c0849ffc
commit 9648715dbb
2 changed files with 141 additions and 34 deletions

View File

@@ -508,31 +508,31 @@ void RCT2_CALLPROC_WE_MOUSE_DOWN(int address, int widgetIndex, rct_window*w, rct
__asm mov dpi, edi
#else
#define window_get_register(w) \
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
__asm__ ( "mov %["#w"], esi " : [w] "+m" (w) );
#define window_widget_get_registers(w, widgetIndex) \
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) ); \
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
__asm__ ( "mov %["#widgetIndex"], dx " : [widgetIndex] "+m" (widgetIndex) ); \
__asm__ ( "mov %["#w"], esi " : [w] "+m" (w) );
#define window_dropdown_get_registers(w, widgetIndex, dropdownIndex) \
__asm__ ( "mov %[dropdownIndex], ax " : [dropdownIndex] "+m" (dropdownIndex) ); \
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) ); \
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
__asm__ ( "mov %["#dropdownIndex"], ax " : [dropdownIndex] "+m" (dropdownIndex) ); \
__asm__ ( "mov %["#widgetIndex"], dx " : [widgetIndex] "+m" (widgetIndex) ); \
__asm__ ( "mov %["#w"], esi " : [w] "+m" (w) );
#define window_scrollmouse_get_registers(w, x, y) \
__asm__ ( "mov %[x], cx " : [x] "+m" (x) ); \
__asm__ ( "mov %[y], dx " : [y] "+m" (y) ); \
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
__asm__ ( "mov %["#x"], cx " : [x] "+m" (x) ); \
__asm__ ( "mov %["#y"], dx " : [y] "+m" (y) ); \
__asm__ ( "mov %["#w"], esi " : [w] "+m" (w) );
#define window_tool_get_registers(w, widgetIndex, x, y) \
__asm__ ( "mov %[x], ax " : [x] "+m" (x) ); \
__asm__ ( "mov %[y], bx " : [y] "+m" (y) ); \
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) ); \
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
__asm__ ( "mov %["#x"], ax " : [x] "+m" (x) ); \
__asm__ ( "mov %["#y"], bx " : [y] "+m" (y) ); \
__asm__ ( "mov %["#widgetIndex"], dx " : [widgetIndex] "+m" (widgetIndex) ); \
__asm__ ( "mov %["#w"], esi " : [w] "+m" (w) );
#define window_paint_get_registers(w, dpi) \
__asm__ ( "mov %[w], esi " : [w] "+m" (w) ); \
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
__asm__ ( "mov %["#w"], esi " : [w] "+m" (w) ); \
__asm__ ( "mov %["#dpi"], edi " : [dpi] "+m" (dpi) );
#endif
#endif

View File

@@ -24,6 +24,8 @@
#include "string_ids.h"
#include "widget.h"
#include "window.h"
#include "window_scenery.h"
#include "viewport.h"
enum WINDOW_MAP_WIDGET_IDX {
WIDX_BACKGROUND,
@@ -201,28 +203,133 @@ static void window_map_close()
*/
static void window_map_mouseup()
{
RCT2_CALLPROC_EBPSAFE(0x0068CFC1);
/*short widgetIndex;
rct_window *w;
//RCT2_CALLPROC_EBPSAFE(0x0068CFC1);
sint16 var_idx;
rct_window* var_w;
#ifdef _MSC_VER
__asm mov widgetIndex, dx
#else
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
#endif
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (widgetIndex) {
window_widget_get_registers(var_w, var_idx);
switch (var_idx)
{
case WIDX_CLOSE:
window_close(w);
window_close(var_w);
break;
}*/
case WIDX_SET_LAND_RIGHTS:
window_invalidate(var_w);
if (!tool_set(var_w, var_idx, 2)) // jb nullsub_52
break;
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1;
RCT2_GLOBAL(0xF1AD61, sint8) = 2;
show_gridlines();
show_land_rights();
show_construction_rights();
break;
case WIDX_LAND_OWNED_CHECKBOX:
RCT2_GLOBAL(0xF1AD61, sint8) ^= 2;
if (RCT2_GLOBAL(0xF1AD61, sint8) & 2)
RCT2_GLOBAL(0xF1AD61, sint8) &= 0xF2;
window_invalidate(var_w);
break;
case WIDX_LAND_SALE_CHECKBOX:
RCT2_GLOBAL(0xF1AD61, sint8) ^= 8;
if (RCT2_GLOBAL(0xF1AD61, sint8) & 8)
RCT2_GLOBAL(0xF1AD61, sint8) &= 0xF8;
window_invalidate(var_w);
break;
case WIDX_CONSTRUCTION_RIGHTS_OWNED_CHECKBOX:
RCT2_GLOBAL(0xF1AD61, sint8) ^= 1;
if (RCT2_GLOBAL(0xF1AD61, sint8) & 1)
RCT2_GLOBAL(0xF1AD61, sint8) &= 0xF1;
window_invalidate(var_w);
break;
case WIDX_CONSTRUCTION_RIGHTS_SALE_CHECKBOX:
RCT2_GLOBAL(0xF1AD61, sint8) ^= 4;
if (RCT2_GLOBAL(0xF1AD61, sint8) & 4)
RCT2_GLOBAL(0xF1AD61, sint8) &= 0xF4;
window_invalidate(var_w);
break;
case WIDX_LAND_TOOL_SMALLER:
--RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16);
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) < 1)
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1;
window_invalidate(var_w);
break;
case WIDX_LAND_TOOL_LARGER:
++RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16);
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7)
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 7;
window_invalidate(var_w);
break;
case WIDX_BUILD_PARK_ENTRANCE:
window_invalidate(var_w);
if (!tool_set(var_w, var_idx, 2)) // jb nullsub_52
break;
RCT2_GLOBAL(0x9E32D2, sint8) = 0;
if (!(RCT2_GLOBAL(0x9DE518, sint32) & (1 << 6))) // Remove?
RCT2_GLOBAL(0x9DE518, sint32) |= (1 << 6);
show_gridlines();
show_land_rights();
show_construction_rights();
break;
case WIDX_ROTATE_90:
++window_scenery_rotation;
window_scenery_rotation &= 3;
break;
case WIDX_PEOPLE_STARTING_POSITION:
if (!tool_set(var_w, var_idx, 2)) // jb nullsub_52
break;
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_PEEP_SPAWNS, sint16) != -1 && RCT2_GLOBAL(0x13573F8, sint16) != -1)
RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1;
show_gridlines();
show_land_rights();
show_construction_rights();
break;
default:
if (var_idx >= WIDX_PEOPLE_TAB && var_idx <= WIDX_RIDES_TAB)
{
var_idx -= WIDX_PEOPLE_TAB;
if (var_idx == var_w->selected_tab)
break;
var_w->selected_tab = var_idx;
var_w->list_information_type = 0;
}
break;
}
return;
}
/**