fix a few issues with object selection and track manage

This commit is contained in:
IntelOrca 2015-02-11 21:03:23 +00:00
parent 74e1c0923f
commit fadeff9dda
4 changed files with 22 additions and 12 deletions

View File

@ -1049,7 +1049,7 @@ rct_track_design *track_get_info(int index, uint8** preview)
*/ */
int track_rename(const char *text) int track_rename(const char *text)
{ {
return (RCT2_CALLPROC_X(0x006D3664, 0, 0, 0, (int)text, 0, 0, 0) & 0x100) != 0; return (RCT2_CALLPROC_X(0x006D3664, 0, 0, 0, 0, 0, (int)text, 0) & 0x100) == 0;
} }
/** /**
@ -1058,5 +1058,5 @@ int track_rename(const char *text)
*/ */
int track_delete() int track_delete()
{ {
return (RCT2_CALLPROC_X(0x006D3761, 0, 0, 0, 0, 0, 0, 0) & 0x100) != 0; return (RCT2_CALLPROC_X(0x006D3761, 0, 0, 0, 0, 0, 0, 0) & 0x100) == 0;
} }

View File

@ -309,7 +309,8 @@ static void window_editor_object_selection_scroll_mousedown()
sound_play_panned(SOUND_CLICK_1, RCT2_GLOBAL(0x142406C,uint32), 0, 0, 0); sound_play_panned(SOUND_CLICK_1, RCT2_GLOBAL(0x142406C,uint32), 0, 0, 0);
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) { if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) {
if (RCT2_CALLPROC_X(0x6AB54F, 0, 1, 0, 0, 0, 0, (int)installed_entry) & 0x100)return; if (RCT2_CALLPROC_X(0x6AB54F, 0, 1, 0, 0, 0, 0, (int)installed_entry) & 0x100)
return;
window_close(w); window_close(w);
@ -324,8 +325,7 @@ static void window_editor_object_selection_scroll_mousedown()
ebx = 7; ebx = 7;
RCT2_GLOBAL(0xF43411, uint8) = 0; RCT2_GLOBAL(0xF43411, uint8) = 0;
if (0x100 & RCT2_CALLPROC_X(0x6AB54F, 0, ebx, 0, 0, 0, 0, (int)installed_entry)){ if (0x100 & RCT2_CALLPROC_X(0x6AB54F, 0, ebx, 0, 0, 0, 0, (int)installed_entry)) {
rct_string_id error_title; rct_string_id error_title;
if (ebx & 1) if (ebx & 1)
error_title = 3176; error_title = 3176;
@ -336,7 +336,8 @@ static void window_editor_object_selection_scroll_mousedown()
return; return;
} }
if (!RCT2_GLOBAL(0xF43411, uint8) & 1)return; if (!RCT2_GLOBAL(0xF43411, uint8) & 1)
return;
window_error_open(3374, 3375); window_error_open(3374, 3375);
} }
@ -645,6 +646,12 @@ static void window_editor_object_selection_scrollpaint()
char *buffer = (char*)0x0141ED68; char *buffer = (char*)0x0141ED68;
*buffer = colour; *buffer = colour;
strcpy(buffer + 1, object_get_name(entry)); strcpy(buffer + 1, object_get_name(entry));
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) {
while (*buffer != 0 && *buffer != 9)
buffer++;
*buffer = 0;
}
if (*itemFlags & 0x20) { if (*itemFlags & 0x20) {
colour = w->colours[1] & 0x7F; colour = w->colours[1] & 0x7F;

View File

@ -136,7 +136,7 @@ void window_text_input_open(rct_window* call_w, int call_widget, rct_string_id t
height, height,
(uint32*)window_text_input_events, (uint32*)window_text_input_events,
WC_TEXTINPUT, WC_TEXTINPUT,
0 WF_STICK_TO_FRONT
); );
w->widgets = window_text_input_widgets; w->widgets = window_text_input_widgets;

View File

@ -146,15 +146,13 @@ static void window_track_delete_prompt_open();
*/ */
void window_track_manage_open() void window_track_manage_open()
{ {
// RCT2_CALLPROC_EBPSAFE(0x006D348F);
rct_window *w, *trackDesignListWindow; rct_window *w, *trackDesignListWindow;
window_close_by_class(WC_MANAGE_TRACK_DESIGN); window_close_by_class(WC_MANAGE_TRACK_DESIGN);
w = window_create( w = window_create(
max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 250) / 2), max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 250) / 2),
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 44) / 2, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 44) / 2,
250, 250,
44, 44,
(uint32*)window_track_manage_events, (uint32*)window_track_manage_events,
@ -199,6 +197,7 @@ static void window_track_manage_mouseup()
uint8 *trackDesignList = (uint8*)0x00F441EC; uint8 *trackDesignList = (uint8*)0x00F441EC;
rct_window *w, *trackDesignListWindow; rct_window *w, *trackDesignListWindow;
short widgetIndex; short widgetIndex;
char *dst, *src;
window_widget_get_registers(w, widgetIndex); window_widget_get_registers(w, widgetIndex);
@ -209,8 +208,12 @@ static void window_track_manage_mouseup()
case WIDX_RENAME: case WIDX_RENAME:
trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST); trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST);
if (trackDesignListWindow != NULL) { if (trackDesignListWindow != NULL) {
strcpy((char*)0x009BC677, (char*)trackDesignList[trackDesignListWindow->track_list.var_482 * 128]); src = &trackDesignList[trackDesignListWindow->track_list.var_482 * 128];
window_show_textinput(w, widgetIndex, 3350, 3351, 3165); dst = (char*)0x009BC677;
while (*src != 0 && *src != '.')
*dst++ = *src++;
*dst = 0;
window_text_input_open(w, widgetIndex, 3350, 3351, 3165, 0, 127);
} }
break; break;
case WIDX_DELETE: case WIDX_DELETE: