1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +01:00
Files
OpenRCT2/src/viewport.c
2014-04-08 17:52:39 +01:00

95 lines
2.9 KiB
C

/*****************************************************************************
* 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 "addresses.h"
#include "gfx.h"
#include "strings.h"
#include "viewport.h"
#include "window.h"
#define RCT2_FIRST_VIEWPORT (RCT2_ADDRESS(RCT2_ADDRESS_VIEWPORT_LIST, rct_viewport))
#define RCT2_LAST_VIEWPORT (RCT2_GLOBAL(RCT2_ADDRESS_NEW_VIEWPORT_PTR, rct_viewport*) - 1)
#define RCT2_NEW_VIEWPORT (RCT2_GLOBAL(RCT2_ADDRESS_NEW_VIEWPORT_PTR, rct_viewport*))
/**
*
* rct2: 0x006E6EAC
*/
void viewport_init_all()
{
int i, d;
rct_g1_element *g1_element;
// Palette from sprites?
d = 0;
for (i = 4915; i < 4947; i++) {
g1_element = &(RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[i]);
*((int*)(0x0141FC44 + d)) = *((int*)(&g1_element->offset[0xF5]));
*((int*)(0x0141FC48 + d)) = *((int*)(&g1_element->offset[0xF9]));
*((int*)(0x0141FD44 + d)) = *((int*)(&g1_element->offset[0xFD]));
d += 8;
}
// Setting up windows
RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*) = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window);
RCT2_GLOBAL(0x01423604, sint32) = 0;
// Setting up viewports
for (i = 0; i < 9; i++)
RCT2_FIRST_VIEWPORT[i].width = 0;
RCT2_NEW_VIEWPORT = NULL;
// ?
RCT2_GLOBAL(0x009DE518, sint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, sint8) = INPUT_STATE_RESET;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass) = -1;
RCT2_GLOBAL(0x009DE550, sint32) = -1;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, sint16) = -1;
RCT2_GLOBAL(0x009DE58A, sint16) = 0;
RCT2_GLOBAL(0x009DEA50, sint16) = -1;
RCT2_CALLPROC_EBPSAFE(0x006EE3C3);
format_string((char*)0x0141FA44, STR_CANCEL, NULL);
format_string((char*)0x0141F944, STR_OK, NULL);
}
/**
* UNTESTED
* rct2: 0x006EE510
*/
void viewport_update_pointers()
{
rct_viewport *viewport;
rct_viewport **vp = &RCT2_NEW_VIEWPORT;
for (viewport = RCT2_FIRST_VIEWPORT; viewport <= RCT2_NEW_VIEWPORT; viewport++)
if (viewport->width != 0)
*vp++ = viewport;
*vp = NULL;
}
/**
*
* rct2: 0x006E7A3A
*/
void viewport_update_position(rct_window *window)
{
RCT2_CALLPROC_X(0x006E7A3A, 0, 0, 0, 0, window, 0, 0);
}