1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 07:43:01 +01:00

Minor cleanups

Mostly just setting variables to better define game state, with one
minor update of decompilation where an `or` instruction was used in
place of `mov` (in `sub_6CBCE2`).
This commit is contained in:
Michał Janiszewski
2015-11-12 12:15:20 +01:00
parent ed8e7c2d38
commit 075b98e209
10 changed files with 18 additions and 9 deletions

View File

@@ -1493,7 +1493,7 @@ static void title_sequence_open(const char *path, const char *customName)
token = &parts[0 * 128]; token = &parts[0 * 128];
part1 = &parts[1 * 128]; part1 = &parts[1 * 128];
part2 = &parts[2 * 128]; part2 = &parts[2 * 128];
title_command command; title_command command = { 0 };
command.command = 0xFF; command.command = 0xFF;
if (token[0] != 0) { if (token[0] != 0) {

View File

@@ -389,6 +389,7 @@ uint16 hire_new_staff_member(uint8 staffType)
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_HIRE_NEW_STAFF; RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_HIRE_NEW_STAFF;
int eax, ebx, ecx, edx, esi, edi, ebp; int eax, ebx, ecx, edx, esi, edi, ebp;
ecx = edx = esi = edi = ebp = 0;
eax = 0x8000; eax = 0x8000;
ebx = staffType << 8 | GAME_COMMAND_FLAG_APPLY; ebx = staffType << 8 | GAME_COMMAND_FLAG_APPLY;

View File

@@ -850,6 +850,7 @@ int ride_create_ride(ride_list_item listItem)
ebx = GAME_COMMAND_FLAG_APPLY; ebx = GAME_COMMAND_FLAG_APPLY;
edi = 0; edi = 0;
esi = 0; esi = 0;
ebp = 0;
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 0x3DC; RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 0x3DC;
@@ -1194,7 +1195,7 @@ int sub_6C683D(int* x, int* y, int* z, int direction, int type, uint16 extra_par
mapElement->properties.track.colour &= 0x0F; mapElement->properties.track.colour &= 0x0F;
mapElement->properties.track.colour |= (extra_params & 0xFF) << 4; mapElement->properties.track.colour |= (extra_params & 0xFF) << 4;
} }
if (flags & (1 << 3)) { if (flags & (1 << 3)) {
track_element_set_cable_lift(mapElement); track_element_set_cable_lift(mapElement);
} }
@@ -5562,7 +5563,7 @@ void game_command_callback_ride_remove_track_piece(int eax, int ebx, int ecx, in
z = gRideRemoveTrackPieceCallbackZ; z = gRideRemoveTrackPieceCallbackZ;
direction = gRideRemoveTrackPieceCallbackDirection; direction = gRideRemoveTrackPieceCallbackDirection;
type = gRideRemoveTrackPieceCallbackType; type = gRideRemoveTrackPieceCallbackType;
window_ride_construction_mouseup_demolish_next_piece(x, y, z, direction, type); window_ride_construction_mouseup_demolish_next_piece(x, y, z, direction, type);
} }
@@ -6412,9 +6413,9 @@ static void ride_update_vehicle_colours(int rideIndex)
{ {
rct_ride *ride; rct_ride *ride;
rct_vehicle *vehicle; rct_vehicle *vehicle;
rct_vehicle_colour colours; rct_vehicle_colour colours = { 0 };
uint16 spriteIndex; uint16 spriteIndex;
uint8 coloursExtended; uint8 coloursExtended = 0;
ride = GET_RIDE(rideIndex); ride = GET_RIDE(rideIndex);
if (ride->type == RIDE_TYPE_SPACE_RINGS || ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_16)) { if (ride->type == RIDE_TYPE_SPACE_RINGS || ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_16)) {

View File

@@ -497,7 +497,7 @@ void scenario_success_submit_name(const char *name)
**/ **/
void scenario_entrance_fee_too_high_check() void scenario_entrance_fee_too_high_check()
{ {
uint16 x, y; uint16 x = 0, y = 0;
uint16 totalRideValue = RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, uint16); uint16 totalRideValue = RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, uint16);
uint16 park_entrance_fee = RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, uint16); uint16 park_entrance_fee = RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, uint16);
int max_fee = totalRideValue + (totalRideValue / 2); int max_fee = totalRideValue + (totalRideValue / 2);

View File

@@ -1597,7 +1597,7 @@ static uint16 map_window_get_pixel_colour_ride(int x, int y)
static void map_window_set_pixels(rct_window *w) static void map_window_set_pixels(rct_window *w)
{ {
uint16 colour, *destination; uint16 colour = 0, *destination;
int x, y, dx, dy; int x, y, dx, dy;
destination = (uint16*)((RCT2_GLOBAL(0x00F1AD6C, uint32) * 511) + RCT2_GLOBAL(RCT2_ADDRESS_MAP_IMAGE_DATA, uint32) + 255); destination = (uint16*)((RCT2_GLOBAL(0x00F1AD6C, uint32) * 511) + RCT2_GLOBAL(RCT2_ADDRESS_MAP_IMAGE_DATA, uint32) + 255);

View File

@@ -1053,6 +1053,7 @@ static void window_park_entrance_paint(rct_window *w, rct_drawpixelinfo *dpi)
static void window_park_init_viewport(rct_window *w) static void window_park_init_viewport(rct_window *w)
{ {
int i, x, y, z, r, xy, zr, viewportFlags; int i, x, y, z, r, xy, zr, viewportFlags;
x = y = z = r = xy = zr = 0;
rct_viewport *viewport; rct_viewport *viewport;
rct_widget *viewportWidget; rct_widget *viewportWidget;

View File

@@ -5341,6 +5341,9 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi
top = measurement->lateral[x] + 52; top = measurement->lateral[x] + 52;
bottom = measurement->lateral[x + 1] + 52; bottom = measurement->lateral[x + 1] + 52;
break; break;
default:
log_error("Wrong graph type %d", listType);
top = bottom = 0;
} }
top = widget->bottom - widget->top - top - 13; top = widget->bottom - widget->top - top - 13;

View File

@@ -2273,7 +2273,7 @@ static void sub_6CBCE2(
offsetX = -trackBlock->y; offsetX = -trackBlock->y;
offsetY = trackBlock->x; offsetY = trackBlock->x;
bl = rol8(bl, 3); bl = rol8(bl, 3);
bh |= bl; bh = bl;
bh = ror8(bh, 4); bh = ror8(bh, 4);
bl &= 0x88; bl &= 0x88;
bh &= 0x77; bh &= 0x77;

View File

@@ -943,7 +943,7 @@ void window_title_editor_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int
gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + ROW_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000); gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + ROW_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000);
} }
rct_string_id commandName; rct_string_id commandName = STR_NONE;
switch (command->command) { switch (command->command) {
case TITLE_SCRIPT_LOAD: case TITLE_SCRIPT_LOAD:
commandName = 5415; commandName = 5415;
@@ -984,6 +984,8 @@ void window_title_editor_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int
case TITLE_SCRIPT_END: case TITLE_SCRIPT_END:
commandName = 5426; commandName = 5426;
break; break;
default:
log_warning("Unknown command %d", command->command);
} }
if ((selected || hover) && !error) { if ((selected || hover) && !error) {

View File

@@ -352,6 +352,7 @@ static void window_track_place_attempt_placement(int x, int y, int z, int bl, mo
int eax, ebx, ecx, edx, esi, edi, ebp; int eax, ebx, ecx, edx, esi, edi, ebp;
money32 result; money32 result;
edx = esi = ebp = 0;
eax = x; eax = x;
ebx = bl; ebx = bl;
ecx = y; ecx = y;