mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 13:33:02 +01:00
add screenshot and error window base functions
This commit is contained in:
@@ -103,6 +103,7 @@
|
||||
#define RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX 0x009DE560
|
||||
|
||||
#define RCT2_ADDRESS_SCREEN_FLAGS 0x009DEA68
|
||||
#define RCT2_ADDRESS_SCREENSHOT_COUNTDOWN 0x009DEA6D
|
||||
#define RCT2_ADDRESS_PLACE_OBJECT_MODIFIER 0x009DEA70
|
||||
#define RCT2_ADDRESS_ON_TUTORIAL 0x009DEA71
|
||||
|
||||
|
||||
25
src/game.c
25
src/game.c
@@ -26,11 +26,15 @@
|
||||
#include "news_item.h"
|
||||
#include "osinterface.h"
|
||||
#include "peep.h"
|
||||
#include "screenshot.h"
|
||||
#include "strings.h"
|
||||
#include "widget.h"
|
||||
#include "window.h"
|
||||
#include "window_error.h"
|
||||
#include "window_tooltip.h"
|
||||
|
||||
void game_handle_input();
|
||||
void game_handle_keyboard_input();
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -50,6 +54,8 @@ void game_update()
|
||||
|
||||
// 0x006E3AEC // screen_game_process_mouse_input();
|
||||
// RCT2_CALLPROC_EBPSAFE(0x006E3AEC); // screen_game_process_keyboard_input();
|
||||
screenshot_check();
|
||||
game_handle_keyboard_input();
|
||||
|
||||
// do game logic
|
||||
eax = RCT2_GLOBAL(0x009DE588, uint16) / 31;
|
||||
@@ -119,7 +125,7 @@ void game_update()
|
||||
|
||||
void game_logic_update()
|
||||
{
|
||||
short _bx, _dx;
|
||||
short stringId, _dx;
|
||||
|
||||
RCT2_GLOBAL(0x013628F4, sint32)++;
|
||||
RCT2_GLOBAL(0x00F663AC, sint32)++;
|
||||
@@ -151,15 +157,15 @@ void game_logic_update()
|
||||
window_dispatch_update_all();
|
||||
|
||||
if (RCT2_GLOBAL(0x009AC31B, uint8) != 0) {
|
||||
_bx = 3010;
|
||||
stringId = STR_UNABLE_TO_LOAD_FILE;
|
||||
_dx = RCT2_GLOBAL(0x009AC31C, uint16);
|
||||
if (RCT2_GLOBAL(0x009AC31B, uint8) != 254) {
|
||||
_bx = RCT2_GLOBAL(0x009AC31C, uint16);
|
||||
stringId = RCT2_GLOBAL(0x009AC31C, uint16);
|
||||
_dx = 0xFFFF;
|
||||
}
|
||||
RCT2_GLOBAL(0x009AC31B, uint8) = 0;
|
||||
|
||||
RCT2_CALLPROC_X(0x0066792F, 0, _bx, 0, _dx, 0, 0, 0);
|
||||
window_error_open(stringId, _dx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -753,4 +759,15 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex)
|
||||
RCT2_CALLPROC_X(w->event_handlers[WE_MOUSE_DOWN], 0, 0, 0, widgetIndex, w, widget, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E3B43
|
||||
*/
|
||||
void game_handle_keyboard_input()
|
||||
{
|
||||
RCT2_CALLPROC_EBPSAFE(0x006E3B43);
|
||||
}
|
||||
60
src/screenshot.c
Normal file
60
src/screenshot.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*****************************************************************************
|
||||
* 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 "screenshot.h"
|
||||
#include "strings.h"
|
||||
#include "window_error.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E3AEC
|
||||
*/
|
||||
void screenshot_check()
|
||||
{
|
||||
int screenshotIndex;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8) != 0) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8)--;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8) == 0) {
|
||||
RCT2_CALLPROC_EBPSAFE(0x00684218);
|
||||
screenshotIndex = screenshot_dump();
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = STR_SCR_BMP;
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint16) = screenshotIndex;
|
||||
RCT2_GLOBAL(0x009A8C29, uint8) |= 1;
|
||||
|
||||
window_error_open(screenshotIndex == -1 ? STR_SCREENSHOT_FAILED : STR_SCREENSHOT_SAVED_AS, -1);
|
||||
RCT2_GLOBAL(0x009A8C29, uint8) &= ~1;
|
||||
RCT2_CALLPROC_EBPSAFE(0x006843DC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00683D20
|
||||
*/
|
||||
int screenshot_dump()
|
||||
{
|
||||
int eax, ebx, ecx, edx, esi, edi, ebp;
|
||||
RCT2_CALLFUNC_X(0x00683D20, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
return eax & 0xFFFF;
|
||||
}
|
||||
27
src/screenshot.h
Normal file
27
src/screenshot.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*****************************************************************************
|
||||
* 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/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _SCREENSHOT_H_
|
||||
#define _SCREENSHOT_H_
|
||||
|
||||
void screenshot_check();
|
||||
int screenshot_dump();
|
||||
|
||||
#endif
|
||||
@@ -144,6 +144,11 @@ enum {
|
||||
STR_PAUSE_GAME_TIP = 833,
|
||||
STR_DISC_AND_GAME_OPTIONS_TIP = 834,
|
||||
|
||||
STR_SCR_BMP = 890,
|
||||
STR_SCREENSHOT = 891,
|
||||
STR_SCREENSHOT_SAVED_AS = 892,
|
||||
STR_SCREENSHOT_FAILED = 893,
|
||||
|
||||
STR_VIEW_OPTIONS_TIP = 937,
|
||||
STR_ADJUST_LAND_TIP = 938,
|
||||
|
||||
@@ -352,6 +357,8 @@ enum {
|
||||
STR_LICENCE_AGREEMENT_NOTICE_1 = 2969,
|
||||
STR_LICENCE_AGREEMENT_NOTICE_2 = 2970,
|
||||
|
||||
STR_UNABLE_TO_LOAD_FILE = 3010,
|
||||
|
||||
STR_BEGINNER_PARKS = 3064,
|
||||
STR_CHALLENGING_PARKS = STR_BEGINNER_PARKS + 1,
|
||||
STR_EXPERT_PARKS = STR_BEGINNER_PARKS + 2,
|
||||
|
||||
31
src/window_error.c
Normal file
31
src/window_error.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/*****************************************************************************
|
||||
* 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 "window_error.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0066792F
|
||||
*/
|
||||
void window_error_open(int stringId, int edx)
|
||||
{
|
||||
RCT2_CALLPROC_X(0x0066792F, 0, stringId, 0, edx, 0, 0, 0);
|
||||
}
|
||||
26
src/window_error.h
Normal file
26
src/window_error.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*****************************************************************************
|
||||
* 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/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _WINDOW_ERROR_H_
|
||||
#define _WINDOW_ERROR_H_
|
||||
|
||||
void window_error_open(int stringId, int edx);
|
||||
|
||||
#endif
|
||||
@@ -1,22 +1,22 @@
|
||||
/*****************************************************************************
|
||||
* 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/>.
|
||||
*****************************************************************************/
|
||||
* 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 <memory.h>
|
||||
#include "addresses.h"
|
||||
|
||||
Reference in New Issue
Block a user