OpenRCT2/src/game.c

146 lines
4.1 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.
* 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 "rct2.h"
#include "game.h"
2014-04-08 01:05:05 +02:00
#include "news_item.h"
2014-04-03 01:22:33 +02:00
#include "peep.h"
#include "window.h"
void game_update()
{
int eax, tmp;
// 0x006E3AEC // screen_game_process_mouse_input();
RCT2_CALLPROC_EBPSAFE(0x006E3AEC); // screen_game_process_keyboard_input();
// do game logic
eax = RCT2_GLOBAL(0x009DE588, uint16) / 31;
if (eax == 0)
eax = 1;
if (eax > 4)
eax = 4;
// if (ted_fastforwarding)
// eax += 8 - 1;
if (RCT2_GLOBAL(0x009DEA6E, uint8) == 0) {
for (; eax > 0; eax--) {
game_logic_update();
/*
if (rctmem->dword_009E2D74 == 1) {
rctmem->dword_009E2D74 = 0;
break;
} else {
if (rctmem->input_state != INPUT_STATE_WIDGET_RESET && rctmem->input_state != INPUT_STATE_WIDGET_NORMAL)
break;
tmp = rctmem->dword_009DE518 & 0x80;
rctmem->dword_009DE518 &= ~0x80;
if (tmp)
break;
}
*/
}
}
RCT2_GLOBAL(0x009DE518, uint32) &= ~0x80;
RCT2_GLOBAL(0x009AC861, uint16) &= ~0x8000;
RCT2_GLOBAL(0x009AC861, uint16) &= ~0x02;
tmp = RCT2_GLOBAL(0x009AC861, uint16) & 0x01;
RCT2_GLOBAL(0x009AC861, uint16) &= ~0x01;
if (!tmp)
RCT2_GLOBAL(0x009AC861, uint16) |= 0x02;
RCT2_GLOBAL(0x009AC861, uint16) &= ~0x08;
tmp = RCT2_GLOBAL(0x009AC861, uint16) & 0x04;
RCT2_GLOBAL(0x009AC861, uint16) &= ~0x04;
if (!tmp)
RCT2_GLOBAL(0x009AC861, uint16) |= 0x04;
RCT2_CALLPROC_EBPSAFE(0x006EE77A);
2014-04-08 18:52:39 +02:00
window_update_all();
RCT2_GLOBAL(0x01388698, uint16)++;
// Input
RCT2_CALLPROC_X(0x00667919, 1, 0, 0, 0, 0, 0, 0); // read_input(1)
RCT2_CALLPROC_EBPSAFE(0x006EA627); // window_manager_handle_input();
RCT2_CALLPROC_EBPSAFE(0x006838BD);
RCT2_CALLPROC_EBPSAFE(0x00684218);
if (RCT2_GLOBAL(0x009AAC73, uint8) != 255) {
RCT2_GLOBAL(0x009AAC73, uint8)++;
if (RCT2_GLOBAL(0x009AAC73, uint8) == 255) {
RCT2_CALLPROC_EBPSAFE(0x00675487);
}
}
}
2014-04-09 18:06:47 +02:00
#include "map.h"
void game_logic_update()
{
short _bx, _dx;
RCT2_GLOBAL(0x013628F4, sint32)++;
RCT2_GLOBAL(0x00F663AC, sint32)++;
RCT2_GLOBAL(0x009DEA66, sint16)++;
if (RCT2_GLOBAL(0x009DEA66, sint16) == 0)
RCT2_GLOBAL(0x009DEA66, sint16)--;
RCT2_CALLPROC_EBPSAFE(0x0068B089);
2014-04-09 12:16:35 +02:00
RCT2_CALLPROC_EBPSAFE(0x006C44B1); // update_objective
RCT2_CALLPROC_EBPSAFE(0x006C46B1); // update_climate
RCT2_CALLPROC_EBPSAFE(0x006646E1);
RCT2_CALLPROC_EBPSAFE(0x006A876D);
2014-04-03 01:22:33 +02:00
peep_update_all();
2014-04-09 12:16:35 +02:00
RCT2_CALLPROC_EBPSAFE(0x006D4204); // update vehicles
RCT2_CALLPROC_EBPSAFE(0x00672AA4); // update text effects
RCT2_CALLPROC_EBPSAFE(0x006ABE4C); // update rides
RCT2_CALLPROC_EBPSAFE(0x006674F7); // update park
RCT2_CALLPROC_EBPSAFE(0x00684C7A);
RCT2_CALLPROC_EBPSAFE(0x006B5A2A);
2014-04-09 12:16:35 +02:00
RCT2_CALLPROC_EBPSAFE(0x006B6456); // update ride measurements
RCT2_CALLPROC_EBPSAFE(0x0068AFAD);
RCT2_CALLPROC_EBPSAFE(0x006BBC6B);
RCT2_CALLPROC_EBPSAFE(0x006BD18A);
RCT2_CALLPROC_EBPSAFE(0x006BCB91);
RCT2_CALLPROC_EBPSAFE(0x006BD0F8);
2014-04-08 01:05:05 +02:00
news_item_update_current();
RCT2_CALLPROC_EBPSAFE(0x0067009A);
// Update windows
2014-04-08 18:52:39 +02:00
window_dispatch_update_all();
if (RCT2_GLOBAL(0x009AC31B, uint8) != 0) {
_bx = 3010;
_dx = RCT2_GLOBAL(0x009AC31C, uint16);
if (RCT2_GLOBAL(0x009AC31B, uint8) != 254) {
_bx = RCT2_GLOBAL(0x009AC31C, uint16);
_dx = 0xFFFF;
}
RCT2_GLOBAL(0x009AC31B, uint8) = 0;
RCT2_CALLPROC_X(0x0066792F, 0, _bx, 0, _dx, 0, 0, 0);
}
}