OpenRCT2/src/windows/main.c

103 lines
2.6 KiB
C
Raw Normal View History

/*****************************************************************************
* 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.
2015-10-20 20:16:30 +02:00
* 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.
2015-10-20 20:16:30 +02:00
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
2014-10-06 18:36:58 +02:00
#include "../addresses.h"
#include "../interface/viewport.h"
#include "../interface/widget.h"
#include "../interface/window.h"
rct_widget window_main_widgets[] = {
{ WWT_VIEWPORT, 0, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0xFFFFFFFE, 0xFFFF },
{ WIDGETS_END },
};
void window_main_paint(rct_window *w, rct_drawpixelinfo *dpi);
2014-07-15 15:59:43 +02:00
static rct_window_event_list window_main_events = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
2014-07-15 15:59:43 +02:00
window_main_paint,
NULL
};
2014-07-15 15:59:43 +02:00
/**
2014-07-15 15:59:43 +02:00
* Creates the main window that holds the main viewport.
* rct2: 0x0066B3E8
*/
void window_main_open()
{
rct_window* window;
2015-07-05 16:57:01 +02:00
window_main_widgets[0].right = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16);
window_main_widgets[0].bottom = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16);
2014-04-24 21:26:05 +02:00
window = window_create(
0, 0,
window_main_widgets[0].right, window_main_widgets[0].bottom,
&window_main_events,
2014-04-24 21:26:05 +02:00
WC_MAIN_WINDOW,
WF_STICK_TO_BACK
);
2014-07-15 15:59:43 +02:00
window->widgets = window_main_widgets;
viewport_create(window, window->x, window->y, window->width, window->height, 0,0x0FFF,0x0FFF, 0, 0x1, -1);
2014-10-09 16:55:47 +02:00
window->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32) = 0;
RCT2_GLOBAL(0x009E32B0, uint8) = 0;
RCT2_GLOBAL(0x009E32B2, uint8) = 0;
RCT2_GLOBAL(0x009E32B3, uint8) = 0;
2014-07-18 22:03:33 +02:00
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_TYPE, uint8) = 0;
}
2014-07-15 15:59:43 +02:00
/**
*
2015-10-20 20:16:30 +02:00
* rct2: 0x66CCAE
2014-07-15 15:59:43 +02:00
* This function immediately jumps to 0x00685BE1 this is the second function
* decompiled.
*/
void window_main_paint(rct_window *w, rct_drawpixelinfo *dpi)
2014-10-09 16:55:47 +02:00
{
viewport_render(dpi, w->viewport, dpi->x, dpi->y, dpi->x + dpi->width, dpi->y + dpi->height);
2014-07-15 15:59:43 +02:00
}