1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

add and start implementing ride window

This commit is contained in:
IntelOrca
2014-08-25 15:04:28 +01:00
parent fd7eb4c107
commit d3055fd3ef
5 changed files with 168 additions and 3 deletions

View File

@@ -123,6 +123,7 @@
<ClCompile Include="..\src\window_options.c" />
<ClCompile Include="..\src\window_peep.c" />
<ClCompile Include="..\src\window_research.c" />
<ClCompile Include="..\src\window_ride.c" />
<ClCompile Include="..\src\window_ride_list.c" />
<ClCompile Include="..\src\window_save_prompt.c" />
<ClCompile Include="..\src\window_staff.c" />

View File

@@ -383,6 +383,9 @@
<ClCompile Include="..\src\input.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\window_ride.c">
<Filter>Windows</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\openrct2.exe">

View File

@@ -155,7 +155,13 @@ typedef struct{
uint16 var_484;
uint16 var_486;
uint16 var_488;
}map_variables;
} map_variables;
typedef struct {
sint16 var_480;
sint32 var_482;
} ride_variables;
/**
* Window structure
* size: 0x4C0
@@ -185,13 +191,14 @@ typedef struct rct_window {
sint16 selected_list_item; // 0x47A -1 for none selected
sint16 pad_47C;
sint16 pad_47E;
union{
union {
coordinate_focus viewport_focus_coordinates;
sprite_focus viewport_focus_sprite;
campaign_variables campaign;
new_ride_variables new_ride;
news_variables news;
map_variables map;
ride_variables ride;
};
sint16 page; // 0x48A
sint16 var_48C;
@@ -442,6 +449,7 @@ void window_park_rating_open();
void window_finances_open();
void window_finances_research_open();
void window_new_campaign_open(sint16 campaignType);
void window_ride_main_open(int rideIndex);
void window_ride_list_open();
void window_new_ride_open();
void window_banner_open();

153
src/window_ride.c Normal file
View File

@@ -0,0 +1,153 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <string.h>
#include "addresses.h"
#include "game.h"
#include "ride.h"
#include "string_ids.h"
#include "sprite.h"
#include "sprites.h"
#include "widget.h"
#include "window.h"
#include "window_dropdown.h"
#pragma region Widgets
static rct_widget *window_ride_page_widgets[] = {
(rct_widget*)0x009ADC34,
(rct_widget*)0x009ADDA8,
(rct_widget*)0x009ADEFC,
(rct_widget*)0x009AE190,
(rct_widget*)0x009AE2A4,
(rct_widget*)0x009AE4C8,
(rct_widget*)0x009AE5DC,
(rct_widget*)0x009AE710,
(rct_widget*)0x009AE844,
(rct_widget*)0x009AE9C8
};
#pragma endregion
#pragma region Events
static uint32* window_ride_page_events[] = {
(uint32*)0x0098DFD4,
(uint32*)0x0098E204,
(uint32*)0x0098E0B4,
(uint32*)0x0098E124,
(uint32*)0x0098E044,
(uint32*)0x0098E194,
(uint32*)0x0098DE14,
(uint32*)0x0098DF64,
(uint32*)0x0098DEF4,
(uint32*)0x0098DE84
};
#pragma endregion
/**
*
* rct2: 0x006ACC28
*/
rct_window *window_ride_open(int rideIndex)
{
rct_window *w;
w = window_create_auto_pos(316, 180, window_ride_page_events[0], WC_RIDE, 0x400);
w->widgets = window_ride_page_widgets[0];
w->enabled_widgets = 0x007DBFF4;
w->number = rideIndex;
w->page = 0;
w->var_48C = 0;
w->frame_no = 0;
w->list_information_type = 0;
w->var_492 = 0;
w->var_494 = 0;
RCT2_CALLPROC_X(0x006AEB9F, 0, 0, 0, 0, (int)w, 0, 0);
w->min_width = 316;
w->min_height = 180;
w->max_width = 500;
w->max_height = 450;
w->flags |= WF_RESIZABLE;
w->colours[0] = 1;
w->colours[1] = 26;
w->colours[2] = 11;
rct_ride *ride = &g_ride_list[rideIndex];
uint8 *edx = (uint8*)0x009E32F8;
if (ride->type != RIDE_TYPE_NULL) {
int rideType = ride->type;
do {
edx++;
if (*(edx - 1) != 0xFF)
continue;
} while (rideType-- != 0);
}
int eax, ebx = 0, ecx;
while (*edx != 0xFF) {
eax = *edx++;
ecx = eax >> 5;
eax &= 0x1F;
if (!(RCT2_ADDRESS(0x001357424, uint32)[ecx] & (1 << eax)))
continue;
ebx++;
}
RCT2_GLOBAL((int)w + 496, uint16) = ebx;
}
/**
*
* rct2: 0x006ACC28
*/
void window_ride_main_open(int rideIndex)
{
rct_window *w;
w = window_bring_to_front_by_id(WC_RIDE, rideIndex);
if (w == NULL) {
w = window_ride_open(rideIndex);
w->ride.var_482 = -1;
}
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) {
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) &&
w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)
) {
tool_cancel();
}
}
w->page = 0;
w->width = 316;
w->height = 180;
window_invalidate(w);
w->widgets = window_ride_page_widgets[0];
w->enabled_widgets = 0x007DBFF4;
w->var_020 = 0;
w->event_handlers = window_ride_page_events[0];
w->pressed_widgets = 0;
RCT2_CALLPROC_X(0x006AEB9F, 0, 0, 0, 0, (int)w, 0, 0);
window_init_scroll_widgets(w);
w->ride.var_480 = 0;
RCT2_CALLPROC_X(0x006AF994, 0, 0, 0, 0, (int)w, 0, 0);
}

View File

@@ -352,7 +352,7 @@ static void window_ride_list_scrollmousedown()
return;
// Open ride window
RCT2_CALLPROC_X(0x006ACC28, w->list_item_positions[index], 0, 0, 0, 0, 0, 0);
window_ride_main_open(w->list_item_positions[index]);
}
/**