1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

add window_new_ride_paint_ride_information

This commit is contained in:
IntelOrca
2014-08-21 21:48:23 +01:00
parent 8644ed5b57
commit b4e72cf960

View File

@@ -25,6 +25,7 @@
#include "news_item.h"
#include "ride.h"
#include "string_ids.h"
#include "track.h"
#include "widget.h"
#include "window.h"
@@ -250,6 +251,9 @@ static ride_list_item window_new_ride_scroll_get_ride_list_item_at(rct_window *w
static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixelinfo *dpi, ride_list_item item, int x, int y, int width, int unk);
static void window_new_ride_select(rct_window *w);
static ride_list_item _lastTrackDesignCountRideType;
static int _lastTrackDesignCount;
/**
*
* rct2: 0x006ACA58
@@ -429,7 +433,8 @@ void window_new_ride_open()
w->colours[2] = 26;
w->var_480 = -1;
w->var_482 = -1;
RCT2_GLOBAL(0x00F43866, sint16) = -1;
_lastTrackDesignCountRideType.type = 255;
_lastTrackDesignCountRideType.entry_index = 255;
window_new_ride_populate_list();
@@ -845,13 +850,99 @@ static ride_list_item window_new_ride_scroll_get_ride_list_item_at(rct_window *w
return result;
}
static int get_num_track_designs(ride_list_item item)
{
track_load_list(*((uint16*)&item));
uint8 *trackDesignList = (uint8*)0x00F441EC;
int count = 0;
while (*trackDesignList != 0 && trackDesignList < (uint8*)0x00F635EC) {
trackDesignList += 128;
count++;
}
return count;
}
/**
*
* rct2: 0x006B701C
*/
static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixelinfo *dpi, ride_list_item item, int x, int y, int width, int unk)
{
RCT2_CALLPROC_X(0x006B701C, w->var_482, unk, x, y, (int)w, (int)dpi, width);
uint8 **rideEntries = (uint8**)0x009ACFA4;
if (unk & 1) {
if (unk & 6)
gfx_fill_rect_inset(dpi, x, y, x + 115, y + 115, w->colours[1], 0x20);
uint8 *rideEntry = rideEntries[item.entry_index];
int ebp = RCT2_GLOBAL(rideEntry + 4, uint32);
if (item.type != RCT2_GLOBAL(rideEntry + 12, uint32))
ebp++;
if (item.type != RCT2_GLOBAL(rideEntry + 13, uint32))
ebp++;
RCT2_CALLPROC_X(0x00681DE2, 0, 29013, x + 2, y + 2, (int)w, (int)dpi, ebp);
}
if (unk & 0x100) {
uint8 *rideEntry = rideEntries[item.entry_index];
// Ride name and description
rct_string_id rideName = RCT2_GLOBAL(rideEntry + 0, uint16);
rct_string_id rideDescription = RCT2_GLOBAL(rideEntry + 2, uint16);
if (!(RCT2_GLOBAL(rideEntry + 8, uint32) & 0x1000)) {
rideName = item.type + 2;
rideDescription = item.type + 512;
}
RCT2_GLOBAL(0x013CE952 + 0, rct_string_id) = rideName;
RCT2_GLOBAL(0x013CE952 + 2, rct_string_id) = rideDescription;
gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, width, 1690, 0);
// Number of designs available
uint32 rideTypeFlags = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (item.type * 8), uint32);
if (rideTypeFlags & 0x10000000) {
if (item.type != _lastTrackDesignCountRideType.type || item.entry_index != _lastTrackDesignCountRideType.entry_index) {
_lastTrackDesignCountRideType = item;
_lastTrackDesignCount = get_num_track_designs(item);
}
rct_string_id stringId;
switch (_lastTrackDesignCount) {
case 0:
stringId = 3338;
break;
case 1:
stringId = 3339;
break;
default:
stringId = 3340;
break;
}
gfx_draw_string_left(dpi, stringId, &_lastTrackDesignCount, 0, x, y + 40);
}
// Price
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_11)) {
// Get price of ride
int unk2 = RCT2_GLOBAL(0x0097CC68 + (item.type * 2), uint8);
money32 price = RCT2_GLOBAL(0x0097DD78 + (item.type * 4), uint16);
if (rideTypeFlags & 0x80000) {
price *= RCT2_ADDRESS(0x0099DE34, uint32)[unk2];
} else {
price *= RCT2_ADDRESS(0x0099DA34, uint32)[unk2];
}
price = (price >> 17) * 10 * RCT2_GLOBAL(0x0097D21D + (item.type * 8), uint8);
//
rct_string_id stringId = 1691;
if (!(rideTypeFlags & 0x8000))
stringId++;
gfx_draw_string_right(dpi, stringId, &price, 0, x + width, y + 40);
}
}
}
/**