1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 07:14:31 +01:00

remove asm for set scroll size and add gCurrentAwards

This commit is contained in:
IntelOrca
2015-05-26 19:28:37 +01:00
parent 1fe3bacf43
commit 6426adb45d
17 changed files with 81 additions and 159 deletions

View File

@@ -214,31 +214,20 @@ static void window_game_bottom_toolbar_mouseup()
static void window_game_bottom_toolbar_tooltip()
{
int month, day;
short tool_tip_index;
short widgetIndex, result;
rct_window *w;
#ifdef _MSC_VER
__asm mov tool_tip_index, ax
#else
__asm__ ( "mov %[tool_tip_index], ax " : [tool_tip_index] "+m" (tool_tip_index) );
#endif
window_tooltip_get_registers(w, widgetIndex);
#ifdef _MSC_VER
__asm mov w, esi
#else
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
#endif
switch (tool_tip_index) {
switch (widgetIndex) {
case WIDX_MONEY:
RCT2_GLOBAL(0x013CE952, int) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, sint32);
RCT2_GLOBAL(0x013CE956, int) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, sint32);
tool_tip_index = 0;
result = 0;
break;
case WIDX_PARK_RATING:
RCT2_GLOBAL(0x013CE952, short) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16);
tool_tip_index = 0;
result = 0;
break;
case WIDX_DATE:
month = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7;
@@ -246,15 +235,11 @@ static void window_game_bottom_toolbar_tooltip()
RCT2_GLOBAL(0x013CE952, short) = STR_DATE_DAY_1 + day;
RCT2_GLOBAL(0x013CE954, short) = STR_MONTH_MARCH + month;
tool_tip_index = 0;
result = 0;
break;
}
#ifdef _MSC_VER
__asm mov ax, tool_tip_index
#else
__asm__("mov ax, %[tool_tip_index] " :[tool_tip_index] "+m" (tool_tip_index));
#endif
window_tooltip_set_registers(result);
}
/**

View File

@@ -1593,12 +1593,15 @@ void window_guest_rides_tooltip(){
}
/* rct2: 0x69784E */
void window_guest_rides_scroll_get_size(){
void window_guest_rides_scroll_get_size()
{
rct_window *w;
int width, height;
window_get_register(w);
int height = w->no_list_items * 10;
width = 0;
height = w->no_list_items * 10;
if (w->selected_list_item != -1){
w->selected_list_item = -1;
@@ -1617,17 +1620,7 @@ void window_guest_rides_scroll_get_size(){
window_invalidate(w);
}
#ifdef _MSC_VER
__asm mov ecx, 0
#else
__asm__("mov ecx, 0 ");
#endif
#ifdef _MSC_VER
__asm mov edx, height
#else
__asm__("mov edx, %[height] " : [height] "+m" (height));
#endif
window_scrollsize_set_registers(width, height);
}
/* rct2: 0x006978CC */

View File

@@ -418,7 +418,7 @@ static void window_guest_list_update(rct_window *w)
*/
static void window_guest_list_scrollgetsize()
{
int i, y, numGuests, spriteIndex;
int i, y, numGuests, spriteIndex, width, height;
rct_window *w;
rct_peep *peep;
@@ -469,18 +469,10 @@ static void window_guest_list_scrollgetsize()
window_invalidate(w);
}
#ifdef _MSC_VER
__asm mov ecx, 447
#else
__asm__ ( "mov ecx, 447 " );
#endif
#ifdef _MSC_VER
__asm mov edx, y
#else
__asm__ ( "mov edx, %[y] " : [y] "+m" (y) );
#endif
width = 447;
height = y;
window_scrollsize_set_registers(width, height);
}
/**

View File

@@ -465,15 +465,13 @@ static void window_map_update(rct_window *w)
*/
static void window_map_scrollgetsize()
{
int width, height;
window_map_invalidate();
#ifdef _MSC_VER
__asm mov ecx, 512
__asm mov edx, 512
#else
__asm__ ( "mov ecx, 512 " );
__asm__ ( "mov edx, 512 " );
#endif
width = 512;
height = 512;
window_scrollsize_set_registers(width, height);
}
/**

View File

@@ -130,13 +130,11 @@ static void window_music_credits_mouseup()
*/
static void window_music_credits_scrollgetsize()
{
int y = 560;
int width, height;
#ifdef _MSC_VER
__asm mov edx, y
#else
__asm__("mov edx, %[y] " : [y] "+m" (y));
#endif
width = 0;
height = 560;
window_scrollsize_set_registers(width, height);
}
/**

View File

@@ -634,27 +634,17 @@ static void window_new_ride_update(rct_window *w)
static void window_new_ride_scrollgetsize()
{
ride_list_item *listItem = (ride_list_item*)0x00F43523;
int scrollWidth, scrollHeight;
int width, height;
int count = 0;
while (listItem->type != 255 || listItem->entry_index != 255) {
count++;
listItem++;
}
scrollWidth = 0;
scrollHeight = ((count + 4) / 5) * 116;
width = 0;
height = ((count + 4) / 5) * 116;
#ifdef _MSC_VER
__asm mov ecx, scrollWidth
#else
__asm__ ( "mov ecx, %[scrollWidth] " : [scrollWidth] "+m" (scrollWidth) );
#endif
#ifdef _MSC_VER
__asm mov edx, scrollHeight
#else
__asm__ ( "mov edx, %[scrollHeight] " : [scrollHeight] "+m" (scrollHeight) );
#endif
window_scrollsize_set_registers(width, height);
}
/**

View File

@@ -184,9 +184,10 @@ static void window_news_update(rct_window *w)
*/
static void window_news_scrollgetsize()
{
int i, height;
int i, width, height;
rct_news_item *newsItems = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
width = 0;
height = 0;
for (i = 11; i < 61; i++) {
if (newsItems[i].type == NEWS_ITEM_NULL)
@@ -195,12 +196,7 @@ static void window_news_scrollgetsize()
height += 42;
}
#ifdef _MSC_VER
__asm mov edx, height
#else
__asm__ ( "mov edx, %[height] " : [height] "+m" (height) );
#endif
window_scrollsize_set_registers(width, height);
}
/**

View File

@@ -1979,7 +1979,7 @@ static void window_park_awards_paint()
count = 0;
for (i = 0; i < MAX_AWARDS; i++) {
award = &RCT2_ADDRESS(RCT2_ADDRESS_AWARD_LIST, rct_award)[i];
award = &gCurrentAwards[i];
if (award->time == 0)
continue;

View File

@@ -130,13 +130,11 @@ static void window_publisher_credits_mouseup()
*/
static void window_publisher_credits_scrollgetsize()
{
int y = 820;
int width, height;
#ifdef _MSC_VER
__asm mov edx, y
#else
__asm__("mov edx, %[y] " : [y] "+m" (y));
#endif
width = 0;
height = 820;
window_scrollsize_set_registers(width, height);
}
/**

View File

@@ -5081,18 +5081,7 @@ static void window_ride_graphs_scrollgetheight()
if (measurement != NULL)
width = max(width, measurement->num_items);
// Return size
#ifdef _MSC_VER
__asm mov ecx, width
#else
__asm__ ( "mov ecx, 0 " );
#endif
#ifdef _MSC_VER
__asm mov edx, height
#else
__asm__ ( "mov edx, %[height] " : [height] "+m" (height) );
#endif
window_scrollsize_set_registers(width, height);
}
/**
@@ -5115,12 +5104,12 @@ static void window_ride_graphs_15()
static void window_ride_graphs_tooltip()
{
rct_window *w;
short unused, widgetIndex, result;
short widgetIndex, result;
rct_ride *ride;
rct_ride_measurement *measurement;
rct_string_id stringId;
window_dropdown_get_registers(w, unused, widgetIndex);
window_tooltip_get_registers(w, widgetIndex);
result = -1;
if (widgetIndex == WIDX_GRAPH) {
@@ -5136,11 +5125,7 @@ static void window_ride_graphs_tooltip()
}
}
#ifdef _MSC_VER
__asm mov ax, result
#else
__asm__ ( "mov ax, %[result] " : [result] "+m" (result) );
#endif
window_tooltip_set_registers(result);
}
/**

View File

@@ -307,7 +307,7 @@ static void window_ride_list_update(rct_window *w)
*/
static void window_ride_list_scrollgetsize()
{
int top, height;
int top, width, height;
rct_window *w;
window_get_register(w);
@@ -326,18 +326,8 @@ static void window_ride_list_scrollgetsize()
window_invalidate(w);
}
#ifdef _MSC_VER
__asm mov ecx, 0
#else
__asm__ ( "mov ecx, 0 " );
#endif
#ifdef _MSC_VER
__asm mov edx, height
#else
__asm__ ( "mov edx, %[height] " : [height] "+m" (height) );
#endif
width = 0;
window_scrollsize_set_registers(width, height);
}
/**

View File

@@ -348,8 +348,9 @@ void window_staff_list_toolabort() {
*
* rct2: 0x006BDBE6
*/
void window_staff_list_scrollgetsize() {
int spriteIndex;
void window_staff_list_scrollgetsize()
{
int i, width, height, spriteIndex;
rct_peep *peep;
rct_window *w;
@@ -368,8 +369,8 @@ void window_staff_list_scrollgetsize() {
window_invalidate(w);
}
int scrollHeight = staffCount * 10;
int i = scrollHeight - window_staff_list_widgets[WIDX_STAFF_LIST_LIST].bottom + window_staff_list_widgets[WIDX_STAFF_LIST_LIST].top + 21;
height = staffCount * 10;
i = height - window_staff_list_widgets[WIDX_STAFF_LIST_LIST].bottom + window_staff_list_widgets[WIDX_STAFF_LIST_LIST].top + 21;
if (i < 0)
i = 0;
if (i < w->scrolls[0].v_top) {
@@ -377,17 +378,8 @@ void window_staff_list_scrollgetsize() {
window_invalidate(w);
}
#ifdef _MSC_VER
__asm mov ecx, 420
#else
__asm__("mov ecx, 420 ");
#endif
#ifdef _MSC_VER
__asm mov edx, scrollHeight
#else
__asm__("mov edx, %[scrollHeight] " : [scrollHeight] "+m" (scrollHeight));
#endif
width = 420;
window_scrollsize_set_registers(width, height);
}
/**

View File

@@ -192,12 +192,13 @@ static void window_scenarioselect_mousedown(int widgetIndex, rct_window*w, rct_w
static void window_scenarioselect_scrollgetsize()
{
int i, height;
int i, width, height;
rct_window *w;
rct_scenario_basic *scenario;
window_get_register(w);
width = 0;
height = 0;
for (i = 0; i < gScenarioListCount; i++) {
scenario = &gScenarioList[i];
@@ -207,18 +208,7 @@ static void window_scenarioselect_scrollgetsize()
height += 24;
}
#ifdef _MSC_VER
__asm mov ecx, 0
#else
__asm__ ( "mov ecx, 0 " );
#endif
#ifdef _MSC_VER
__asm mov edx, height
#else
__asm__ ( "mov edx, %[height] " : [height] "+m" (height) );
#endif
window_scrollsize_set_registers(width, height);
}
/* rct2: 0x6780FE */