mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
add window functions and title screen windows
This commit is contained in:
@@ -20,12 +20,16 @@
|
||||
<ClInclude Include="..\src\game.h" />
|
||||
<ClInclude Include="..\src\gfx.h" />
|
||||
<ClInclude Include="..\src\intro.h" />
|
||||
<ClInclude Include="..\src\news_item.h" />
|
||||
<ClInclude Include="..\src\osinterface.h" />
|
||||
<ClInclude Include="..\src\peep.h" />
|
||||
<ClInclude Include="..\src\rct2.h" />
|
||||
<ClInclude Include="..\src\sprite.h" />
|
||||
<ClInclude Include="..\src\sprites.h" />
|
||||
<ClInclude Include="..\src\strings.h" />
|
||||
<ClInclude Include="..\src\title.h" />
|
||||
<ClInclude Include="..\src\viewport.h" />
|
||||
<ClInclude Include="..\src\widget.h" />
|
||||
<ClInclude Include="..\src\window.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
@@ -34,11 +38,17 @@
|
||||
<ClCompile Include="..\src\game.c" />
|
||||
<ClCompile Include="..\src\gfx.c" />
|
||||
<ClCompile Include="..\src\intro.c" />
|
||||
<ClCompile Include="..\src\news_item.c" />
|
||||
<ClCompile Include="..\src\osinterface.c" />
|
||||
<ClCompile Include="..\src\peep.c" />
|
||||
<ClCompile Include="..\src\rct2.c" />
|
||||
<ClCompile Include="..\src\title.c" />
|
||||
<ClCompile Include="..\src\viewport.c" />
|
||||
<ClCompile Include="..\src\window.c" />
|
||||
<ClCompile Include="..\src\window_title_exit.c" />
|
||||
<ClCompile Include="..\src\window_title_logo.c" />
|
||||
<ClCompile Include="..\src\window_main.c" />
|
||||
<ClCompile Include="..\src\window_title_menu.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\openrct2.exe" />
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Windows">
|
||||
<UniqueIdentifier>{611458dc-7dd2-4c37-af0f-306cf9d85fb9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\addresses.h">
|
||||
@@ -54,6 +57,18 @@
|
||||
<ClInclude Include="..\src\sprite.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\news_item.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\viewport.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\widget.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\sprites.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\game.c">
|
||||
@@ -83,6 +98,24 @@
|
||||
<ClCompile Include="..\src\peep.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\news_item.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\viewport.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\window_main.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\window_title_menu.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\window_title_logo.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\window_title_exit.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\openrct2.exe">
|
||||
|
||||
@@ -76,6 +76,8 @@
|
||||
#define RCT2_ADDRESS_SPRITES_START_TEXTFX 0x013573C2
|
||||
#define RCT2_ADDRESS_SPRITES_START_LITTER 0x013573C4
|
||||
|
||||
#define RCT2_ADDRESS_NEWS_ITEM_LIST 0x013CA754
|
||||
|
||||
#define RCT2_ADDRESS_WINDOW_LIST 0x01420078
|
||||
#define RCT2_ADDRESS_NEW_WINDOW_PTR 0x014234B8
|
||||
#define RCT2_ADDRESS_VIEWPORT_LIST 0x014234BC
|
||||
|
||||
68
src/gfx.c
68
src/gfx.c
@@ -23,9 +23,9 @@
|
||||
#include "rct2.h"
|
||||
|
||||
/**
|
||||
* Clears the screen with the specified colour.
|
||||
* rct2: 0x00678A9F
|
||||
*/
|
||||
* Clears the screen with the specified colour.
|
||||
* rct2: 0x00678A9F
|
||||
*/
|
||||
void gfx_clear(rct_drawpixelinfo *dpi, int colour)
|
||||
{
|
||||
int y, w, h;
|
||||
@@ -42,37 +42,37 @@ void gfx_clear(rct_drawpixelinfo *dpi, int colour)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00678AD4
|
||||
* left (ax)
|
||||
* top (cx)
|
||||
* right (bx)
|
||||
* bottom (dx)
|
||||
* colour (ebp)
|
||||
*/
|
||||
*
|
||||
* rct2: 0x00678AD4
|
||||
* left (ax)
|
||||
* top (cx)
|
||||
* right (bx)
|
||||
* bottom (dx)
|
||||
* colour (ebp)
|
||||
*/
|
||||
void gfx_fill_rect(rct_drawpixelinfo *dpi, int left, int top, int right, int bottom, int colour)
|
||||
{
|
||||
RCT2_CALLPROC_X(0x00678AD4, left, right, top, bottom, 0, dpi, colour);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0067A28E
|
||||
* image_id (ebx)
|
||||
* x (cx)
|
||||
* y (dx)
|
||||
*/
|
||||
*
|
||||
* rct2: 0x0067A28E
|
||||
* image_id (ebx)
|
||||
* x (cx)
|
||||
* y (dx)
|
||||
*/
|
||||
void gfx_draw_sprite(rct_drawpixelinfo *dpi, int image_id, int x, int y)
|
||||
{
|
||||
RCT2_CALLPROC_X(0x0067A28E, 0, image_id, x, y, 0, dpi, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00683854
|
||||
* a1 (ebx)
|
||||
* product (cl)
|
||||
*/
|
||||
*
|
||||
* rct2: 0x00683854
|
||||
* a1 (ebx)
|
||||
* product (cl)
|
||||
*/
|
||||
void gfx_transpose_palette(int pal, unsigned char product)
|
||||
{
|
||||
int eax, ebx, ebp;
|
||||
@@ -96,24 +96,24 @@ void gfx_transpose_palette(int pal, unsigned char product)
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws i formatted text string centred at i specified position.
|
||||
* rct2: 0x006C1D6C
|
||||
* dpi (edi)
|
||||
* format (bx)
|
||||
* x (cx)
|
||||
* y (dx)
|
||||
* colour (al)
|
||||
* args (esi)
|
||||
*/
|
||||
* Draws i formatted text string centred at i specified position.
|
||||
* rct2: 0x006C1D6C
|
||||
* dpi (edi)
|
||||
* format (bx)
|
||||
* x (cx)
|
||||
* y (dx)
|
||||
* colour (al)
|
||||
* args (esi)
|
||||
*/
|
||||
void gfx_draw_string_centred(rct_drawpixelinfo *dpi, int format, int x, int y, int colour, void *args)
|
||||
{
|
||||
RCT2_CALLPROC_X(0x006C1D6C, colour, format, x, y, args, dpi, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006ED7E5
|
||||
*/
|
||||
*
|
||||
* rct2: 0x006ED7E5
|
||||
*/
|
||||
void gfx_invalidate_screen()
|
||||
{
|
||||
RCT2_CALLPROC_EBPSAFE(0x006ED7E5);
|
||||
|
||||
36
src/gfx.h
36
src/gfx.h
@@ -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/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _GFX_H_
|
||||
#define _GFX_H_
|
||||
|
||||
@@ -277,9 +277,9 @@ static void screen_intro_process_mouse_input()
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E3AEC
|
||||
*/
|
||||
*
|
||||
* rct2: 0x006E3AEC
|
||||
*/
|
||||
static void screen_intro_process_keyboard_input()
|
||||
{
|
||||
if (gLastKeyPressed != 0)
|
||||
|
||||
40
src/news_item.c
Normal file
40
src/news_item.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/*****************************************************************************
|
||||
* 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 "news_item.h"
|
||||
#include "rct2.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0066DF32
|
||||
*/
|
||||
void news_item_init_queue()
|
||||
{
|
||||
int i;
|
||||
rct_news_item *newsItems = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
|
||||
|
||||
newsItems[0].type = NEWS_ITEM_NULL;
|
||||
newsItems[11].type = NEWS_ITEM_NULL;
|
||||
for (i = 0; i < 16; i++)
|
||||
RCT2_ADDRESS(0x01358750, uint8)[i] = 0;
|
||||
|
||||
RCT2_CALLPROC_EBPSAFE(0x0066BB79); // window_game_bottom_toolbar_invalidate_news_item();
|
||||
}
|
||||
58
src/news_item.h
Normal file
58
src/news_item.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*****************************************************************************
|
||||
* 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 _NEWS_ITEM_H_
|
||||
#define _NEWS_ITEM_H_
|
||||
|
||||
#include "rct2.h"
|
||||
|
||||
enum {
|
||||
NEWS_ITEM_NULL,
|
||||
NEWS_ITEM_RIDE,
|
||||
NEWS_ITEM_PEEP_1,
|
||||
NEWS_ITEM_PEEP_2,
|
||||
NEWS_ITEM_MONEY,
|
||||
NEWS_ITEM_BLANK,
|
||||
NEWS_ITEM_SCENERY,
|
||||
NEWS_ITEM_PEEPS,
|
||||
NEWS_ITEM_AWARD,
|
||||
NEWS_ITEM_GRAPH
|
||||
};
|
||||
|
||||
/**
|
||||
* News item structure.
|
||||
* size: 0x10C
|
||||
*/
|
||||
typedef struct {
|
||||
uint8 type; // 0x00
|
||||
uint8 flags; // 0x01
|
||||
uint32 assoc; // 0x02
|
||||
uint16 ticks; // 0x06
|
||||
uint8 month; // 0x08
|
||||
uint8 pad_09; // 0x09
|
||||
uint8 day; // 0x0A
|
||||
uint8 pad_0B; // 0x0B
|
||||
uint8 colour; // 0x0C
|
||||
char text[255]; // 0x0D
|
||||
} rct_news_item;
|
||||
|
||||
void news_item_init_queue();
|
||||
|
||||
#endif
|
||||
@@ -113,7 +113,7 @@ static void osinterface_resize(int width, int height)
|
||||
if (_screenBuffer == NULL) {
|
||||
memset(newScreenBuffer, 0, newScreenBufferSize);
|
||||
} else {
|
||||
memcpy(newScreenBuffer, _screenBuffer, _screenBufferSize);
|
||||
memcpy(newScreenBuffer, _screenBuffer, min(_screenBufferSize, newScreenBufferSize));
|
||||
if (newScreenBufferSize - _screenBufferSize > 0)
|
||||
memset((uint8*)newScreenBuffer + _screenBufferSize, 0, newScreenBufferSize - _screenBufferSize);
|
||||
free(_screenBuffer);
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
#include "sprite.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0068F0A9
|
||||
*/
|
||||
*
|
||||
* rct2: 0x0068F0A9
|
||||
*/
|
||||
void peep_update_all()
|
||||
{
|
||||
int i;
|
||||
|
||||
36
src/peep.h
36
src/peep.h
@@ -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/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _PEEP_H_
|
||||
#define _PEEP_H_
|
||||
|
||||
@@ -125,7 +125,7 @@ void rct2_init()
|
||||
RCT2_CALLPROC_EBPSAFE(0x0068F050);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BD39C);
|
||||
|
||||
RCT2_CALLPROC_EBPSAFE(0x0068E8DA); // screen_title_load();
|
||||
title_load();
|
||||
|
||||
gfx_clear(RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo), 10);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, int) = 8;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#ifndef _SDL_RCT2_H_
|
||||
#define _SDL_RCT2_H_
|
||||
|
||||
#define NULL 0
|
||||
|
||||
typedef signed char sint8;
|
||||
typedef signed short sint16;
|
||||
typedef signed long sint32;
|
||||
|
||||
42
src/sprite.h
42
src/sprite.h
@@ -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/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _SPRITE_H_
|
||||
#define _SPRITE_H_
|
||||
@@ -46,9 +46,9 @@ typedef struct {
|
||||
} rct_litter;
|
||||
|
||||
/**
|
||||
* Sprite structure.
|
||||
* size: 0x0100
|
||||
*/
|
||||
* Sprite structure.
|
||||
* size: 0x0100
|
||||
*/
|
||||
typedef union {
|
||||
uint8 pad_00[0x100];
|
||||
rct_unk_sprite unknown;
|
||||
|
||||
135
src/sprites.h
Normal file
135
src/sprites.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/*****************************************************************************
|
||||
* 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 _SPRITES_H_
|
||||
#define _SPRITES_H_
|
||||
|
||||
enum {
|
||||
SPR_NONE = -1,
|
||||
|
||||
SPR_RESIZE = 5058,
|
||||
|
||||
SPR_HEARING_VIEWPORT = 5166,
|
||||
SPR_LOCATE = 5167,
|
||||
SPR_RENAME = 5168,
|
||||
|
||||
SPR_BUY_LAND_RIGHTS = 5176,
|
||||
SPR_BUY_CONSTRUCTION_RIGHTS = 5177,
|
||||
SPR_NO_ENTRY = 5178,
|
||||
SPR_CLOSED = 5179,
|
||||
SPR_OPEN = 5180,
|
||||
SPR_TESTING = 5181,
|
||||
|
||||
SPR_RIDE = 5187,
|
||||
SPR_TRACK_PEEP = 5188,
|
||||
SPR_SCENERY = 5189,
|
||||
SPR_FINANCE = 5190,
|
||||
SPR_NEW_RIDE = 5191,
|
||||
SPR_MAP = 5192,
|
||||
SPR_GUESTS = 5193,
|
||||
SPR_AWARD = 5194,
|
||||
SPR_GRAPH = 5195,
|
||||
|
||||
SPR_LAND_TOOL_DECREASE = 5499,
|
||||
|
||||
SPR_LAND_TOOL_INCREASE = 5501,
|
||||
|
||||
SPR_LAND_TOOL_SIZE_0 = 5503,
|
||||
SPR_LAND_TOOL_SIZE_1 = SPR_LAND_TOOL_SIZE_0 + 1,
|
||||
SPR_LAND_TOOL_SIZE_2 = SPR_LAND_TOOL_SIZE_0 + 2,
|
||||
SPR_LAND_TOOL_SIZE_3 = SPR_LAND_TOOL_SIZE_0 + 3,
|
||||
SPR_LAND_TOOL_SIZE_4 = SPR_LAND_TOOL_SIZE_0 + 4,
|
||||
SPR_LAND_TOOL_SIZE_5 = SPR_LAND_TOOL_SIZE_0 + 5,
|
||||
SPR_LAND_TOOL_SIZE_6 = SPR_LAND_TOOL_SIZE_0 + 6,
|
||||
SPR_LAND_TOOL_SIZE_7 = SPR_LAND_TOOL_SIZE_0 + 7,
|
||||
|
||||
SPR_TAB_OBJECTIVE_0 = 5511,
|
||||
SPR_TAB_OBJECTIVE_1 = SPR_TAB_OBJECTIVE_0 + 1,
|
||||
SPR_TAB_OBJECTIVE_2 = SPR_TAB_OBJECTIVE_0 + 2,
|
||||
SPR_TAB_OBJECTIVE_3 = SPR_TAB_OBJECTIVE_0 + 3,
|
||||
SPR_TAB_OBJECTIVE_4 = SPR_TAB_OBJECTIVE_0 + 4,
|
||||
SPR_TAB_OBJECTIVE_5 = SPR_TAB_OBJECTIVE_0 + 5,
|
||||
SPR_TAB_OBJECTIVE_6 = SPR_TAB_OBJECTIVE_0 + 6,
|
||||
SPR_TAB_OBJECTIVE_7 = SPR_TAB_OBJECTIVE_0 + 7,
|
||||
SPR_TAB_OBJECTIVE_8 = SPR_TAB_OBJECTIVE_0 + 8,
|
||||
SPR_TAB_OBJECTIVE_9 = SPR_TAB_OBJECTIVE_0 + 9,
|
||||
SPR_TAB_OBJECTIVE_10 = SPR_TAB_OBJECTIVE_0 + 10,
|
||||
SPR_TAB_OBJECTIVE_11 = SPR_TAB_OBJECTIVE_0 + 11,
|
||||
SPR_TAB_OBJECTIVE_12 = SPR_TAB_OBJECTIVE_0 + 12,
|
||||
SPR_TAB_OBJECTIVE_13 = SPR_TAB_OBJECTIVE_0 + 13,
|
||||
SPR_TAB_OBJECTIVE_14 = SPR_TAB_OBJECTIVE_0 + 14,
|
||||
SPR_TAB_OBJECTIVE_15 = SPR_TAB_OBJECTIVE_0 + 15,
|
||||
|
||||
SPR_TOOLBAR_PAUSE = 5597,
|
||||
SPR_TOOLBAR_FILE = 5599,
|
||||
SPR_TOOLBAR_ZOOM_OUT = 5601,
|
||||
SPR_TOOLBAR_ZOOM_IN = 5604,
|
||||
SPR_TOOLBAR_ROTATE = 5607,
|
||||
SPR_TOOLBAR_LAND = 5609,
|
||||
SPR_TOOLBAR_MAP = 5611,
|
||||
SPR_TOOLBAR_GUESTS = 5613,
|
||||
SPR_TOOLBAR_SCENERY = 5615,
|
||||
SPR_TOOLBAR_WATER = 5617,
|
||||
SPR_TOOLBAR_RIDES = 5619,
|
||||
SPR_TOOLBAR_VIEW = 5621,
|
||||
SPR_TOOLBAR_FOOTPATH = 5623,
|
||||
SPR_TOOLBAR_STAFF = 5627,
|
||||
SPR_TOOLBAR_PARK = 5629,
|
||||
SPR_TOOLBAR_CONSTRUCT_RIDE = 5631,
|
||||
SPR_TOOLBAR_CLEAR_SCENERY = 5633,
|
||||
|
||||
SPR_NEXT_WEATHER = 23189,
|
||||
SPR_WEATHER_SUN = 23190,
|
||||
SPR_WEATHER_SUN_CLOUD = 23191,
|
||||
SPR_WEATHER_CLOUD = 23192,
|
||||
SPR_WEATHER_LIGHT_RAIN = 23193,
|
||||
SPR_WEATHER_HEAVY_RAIN = 23194,
|
||||
SPR_WEATHER_STORM = 23195,
|
||||
SPR_WEATHER_UNKNOWN = 23196,
|
||||
|
||||
SPR_RATING_LOW = 23197,
|
||||
SPR_RATING_HIGH = 23198,
|
||||
|
||||
SPR_MENU_NEW_GAME = 23207,
|
||||
SPR_MENU_LOAD_GAME = 23208,
|
||||
SPR_MENU_TUTORIAL = 23209,
|
||||
SPR_MENU_EXIT = 23210,
|
||||
SPR_MENU_TOOLBOX = 23211,
|
||||
SPR_MENU_LOGO = 23212,
|
||||
SPR_CREDITS_LOGO_SMALL = 23213,
|
||||
SPR_CREDITS_CHRIS_SAWYER_SMALL = 23214,
|
||||
SPR_INTRO_CHRIS_SAWYER_00 = 23215,
|
||||
SPR_INTRO_CHRIS_SAWYER_10 = SPR_INTRO_CHRIS_SAWYER_00 + 1,
|
||||
SPR_INTRO_LOGO_00 = 23218,
|
||||
SPR_INTRO_LOGO_10 = SPR_INTRO_LOGO_00 + 1,
|
||||
SPR_INTRO_LOGO_20 = SPR_INTRO_LOGO_00 + 2,
|
||||
SPR_INTRO_LOGO_01 = SPR_INTRO_LOGO_00 + 3,
|
||||
SPR_INTRO_LOGO_11 = SPR_INTRO_LOGO_00 + 4,
|
||||
SPR_INTRO_LOGO_21 = SPR_INTRO_LOGO_00 + 5,
|
||||
|
||||
SPR_SIX_FLAGS = 23225,
|
||||
SPR_INTRO_INFOGRAMES_00 = 23226,
|
||||
SPR_INTRO_INFOGRAMES_10 = SPR_INTRO_INFOGRAMES_00 + 1,
|
||||
SPR_INTRO_INFOGRAMES_01 = SPR_INTRO_INFOGRAMES_00 + 2,
|
||||
SPR_INTRO_INFOGRAMES_11 = SPR_INTRO_INFOGRAMES_00 + 3,
|
||||
SPR_CREDITS_INFOGRAMES = 23230,
|
||||
};
|
||||
|
||||
#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/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _STRINGS_H_
|
||||
#define _STRINGS_H_
|
||||
|
||||
71
src/title.c
71
src/title.c
@@ -20,8 +20,79 @@
|
||||
|
||||
#include "addresses.h"
|
||||
#include "game.h"
|
||||
#include "gfx.h"
|
||||
#include "news_item.h"
|
||||
#include "rct2.h"
|
||||
#include "intro.h"
|
||||
#include "viewport.h"
|
||||
|
||||
static void title_create_windows();
|
||||
static void title_init_showcase();
|
||||
|
||||
void window_main_open();
|
||||
void window_title_menu_open();
|
||||
void window_title_exit_open();
|
||||
void window_title_logo_open();
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0068E8DA
|
||||
*/
|
||||
void title_load()
|
||||
{
|
||||
if (RCT2_GLOBAL(0x009DEA6E, uint8) & 1)
|
||||
RCT2_CALLPROC_X(0x00667C15, 0, 1, 0, 0, 0, 0, 0);
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TITLE_DEMO;
|
||||
|
||||
RCT2_CALLPROC_EBPSAFE(0x00667104);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006C4209);
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069EB13);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006ACA89);
|
||||
RCT2_CALLPROC_EBPSAFE(0x0068F083);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BD3A4);
|
||||
RCT2_CALLPROC_EBPSAFE(0x0068AB4C);
|
||||
RCT2_CALLPROC_EBPSAFE(0x00667132);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006C4494);
|
||||
RCT2_CALLPROC_X(0x006C45ED, 0, 0, 0, 0, 0, 0, 0);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006ACA58);
|
||||
RCT2_CALLPROC_EBPSAFE(0x0068F050);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BD39C);
|
||||
RCT2_CALLPROC_EBPSAFE(0x0068AFFD);
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
|
||||
viewport_init_all();
|
||||
news_item_init_queue();
|
||||
title_create_windows();
|
||||
title_init_showcase();
|
||||
gfx_invalidate_screen();
|
||||
RCT2_GLOBAL(0x009DEA66, uint16) = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the windows shown on the title screen; New game, load game,
|
||||
* tutorial, toolbox and exit.
|
||||
* rct2: 0x0066B5C0 (part of 0x0066B3E8)
|
||||
*/
|
||||
static void title_create_windows()
|
||||
{
|
||||
// RCT2_CALLPROC_EBPSAFE(0x0066B3E8);
|
||||
|
||||
window_main_open();
|
||||
window_title_menu_open();
|
||||
window_title_exit_open();
|
||||
window_title_logo_open();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0066B905);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00678680
|
||||
*/
|
||||
static void title_init_showcase()
|
||||
{
|
||||
RCT2_CALLPROC_EBPSAFE(0x00678680);
|
||||
}
|
||||
|
||||
void title_update()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef _TITLE_H_
|
||||
#define _TITLE_H_
|
||||
|
||||
void title_load();
|
||||
void title_update();
|
||||
|
||||
#endif
|
||||
27
src/viewport.c
Normal file
27
src/viewport.c
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/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "addresses.h"
|
||||
#include "viewport.h"
|
||||
|
||||
void viewport_init_all()
|
||||
{
|
||||
RCT2_CALLPROC_EBPSAFE(0x006E6EAC);
|
||||
}
|
||||
26
src/viewport.h
Normal file
26
src/viewport.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 _VIEWPORT_H_
|
||||
#define _VIEWPORT_H_
|
||||
|
||||
void viewport_init_all();
|
||||
|
||||
#endif
|
||||
45
src/widget.h
Normal file
45
src/widget.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*****************************************************************************
|
||||
* 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 _WIDGET_H_
|
||||
#define _WIDGET_H_
|
||||
|
||||
typedef enum {
|
||||
WWT_EMPTY = 0,
|
||||
WWT_FRAME = 1,
|
||||
WWT_RESIZE = 2,
|
||||
WWT_IMGBTN = 3,
|
||||
WWT_4 = 4,
|
||||
WWT_TRNBTN = 7,
|
||||
WWT_TAB = 8,
|
||||
WWT_FLATBTN = 9,
|
||||
WWT_DROPDOWN_BUTTON = 10,
|
||||
WWT_12 = 12,
|
||||
WWT_DROPDOWN = 16,
|
||||
WWT_VIEWPORT = 17,
|
||||
WWT_CAPTION = 20,
|
||||
WWT_CLOSEBOX = 21,
|
||||
WWT_SCROLL = 22,
|
||||
WWT_25 = 25,
|
||||
WWT_LAST = 26,
|
||||
} WINDOW_WIDGET_TYPES;
|
||||
#define WIDGETS_END WWT_LAST, 0, 0, 0, 0, 0, 0, 0
|
||||
|
||||
#endif
|
||||
170
src/window.c
170
src/window.c
@@ -19,10 +19,12 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "addresses.h"
|
||||
#include "rct2.h"
|
||||
#include "window.h"
|
||||
|
||||
#define RCT2_FIRST_WINDOW (RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window))
|
||||
#define RCT2_LAST_WINDOW (RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*) - 1)
|
||||
#define RCT2_NEW_WINDOW (RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*))
|
||||
|
||||
// rct2: 0x006ED7B0
|
||||
void window_update_all()
|
||||
@@ -36,4 +38,172 @@ void window_update_all()
|
||||
}
|
||||
|
||||
RCT2_CALLPROC_EBPSAFE(0x006EE411);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a new window.
|
||||
* rct2: 0x006EACA4
|
||||
*
|
||||
* @param x (ax)
|
||||
* @param y (eax >> 16)
|
||||
* @param width (bx)
|
||||
* @param height (ebx >> 16)
|
||||
* @param events (edx)
|
||||
* @param flags (ch)
|
||||
* @param class (cl)
|
||||
*/
|
||||
rct_window *window_create(int x, int y, int width, int height, uint32 *event_handlers, rct_windowclass cls, uint16 flags)
|
||||
{
|
||||
rct_window *w, *v;
|
||||
|
||||
// Check if there are any window slots left
|
||||
if (RCT2_NEW_WINDOW == &(RCT2_FIRST_WINDOW[12])) {
|
||||
// Close least recently used window
|
||||
for (w = RCT2_FIRST_WINDOW; w < RCT2_NEW_WINDOW; w++)
|
||||
if (!(w->flags & 0x203))
|
||||
break;
|
||||
|
||||
window_close(w);
|
||||
}
|
||||
|
||||
w = RCT2_NEW_WINDOW;
|
||||
|
||||
// Flags
|
||||
if (flags & 0x01) {
|
||||
for (; w >= RCT2_FIRST_WINDOW + 1; w--)
|
||||
if (((w - 1)->flags & 0x01) && !((w - 1)->flags & 0x02))
|
||||
break;
|
||||
}
|
||||
else if (flags & 0x02) {
|
||||
for (; w >= RCT2_FIRST_WINDOW + 1; w--)
|
||||
if (!((w - 1)->flags & 0x02))
|
||||
break;
|
||||
}
|
||||
|
||||
// Move w to new window slot
|
||||
if (w != RCT2_NEW_WINDOW)
|
||||
*RCT2_NEW_WINDOW = *w;
|
||||
|
||||
// Setup window
|
||||
w->classification = cls;
|
||||
w->var_4B8 = -1;
|
||||
w->var_4B9 = -1;
|
||||
w->flags = 0;
|
||||
w->flags |= flags;
|
||||
|
||||
// Play sound
|
||||
if (!(flags & 0x03))
|
||||
RCT2_CALLPROC_X(0x006BB76E, 40, x + (width / 2), 0, 0, 0, 0, 0);
|
||||
|
||||
w->number = 0;
|
||||
w->x = x;
|
||||
w->y = y;
|
||||
w->width = width;
|
||||
w->height = height;
|
||||
w->viewport = NULL;
|
||||
w->event_handlers = event_handlers;
|
||||
w->enabled_widgets = 0;
|
||||
w->disabled_widgets = 0;
|
||||
w->pressed_widgets = 0;
|
||||
w->var_020 = 0;
|
||||
w->var_480 = 0;
|
||||
w->var_482 = 0;
|
||||
w->var_484 = 0;
|
||||
w->var_486 = 0;
|
||||
w->var_488 = 0;
|
||||
w->var_48A = 0;
|
||||
w->var_48C = 0;
|
||||
w->var_48E = 0;
|
||||
w->var_490 = 0;
|
||||
w->var_492 = 0;
|
||||
w->var_4AC = 0;
|
||||
w->var_4AE = 0;
|
||||
RCT2_NEW_WINDOW++;
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the specified window.
|
||||
* rct2: 0x006ECD4C
|
||||
*
|
||||
* @param window The window to close (esi).
|
||||
*/
|
||||
void window_close(rct_window* window)
|
||||
{
|
||||
int num_windows;
|
||||
|
||||
if (window == NULL)
|
||||
return;
|
||||
|
||||
// Call close event of window
|
||||
// window_call_basic_event(window, WE_CLOSE);
|
||||
|
||||
window = window_find_by_id(window->classification, window->number);
|
||||
|
||||
// Remove viewport
|
||||
if (window->viewport != NULL) {
|
||||
window->viewport->width = 0;
|
||||
window->viewport = NULL;
|
||||
}
|
||||
|
||||
// Invalidate the window (area)
|
||||
window_invalidate(window);
|
||||
|
||||
// Remove window from list and reshift all windows
|
||||
RCT2_NEW_WINDOW--;
|
||||
num_windows = (RCT2_NEW_WINDOW - window);
|
||||
if (num_windows > 0)
|
||||
memmove(window, window + 1, num_windows * sizeof(rct_window));
|
||||
|
||||
// ?
|
||||
RCT2_CALLPROC(0x006EE510);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006EA8A0
|
||||
* @param cls (cl)
|
||||
* @param number (dx)
|
||||
*/
|
||||
rct_window *window_find_by_id(rct_windowclass cls, rct_windownumber number)
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
if (cls & 0x80) {
|
||||
for (w = RCT2_FIRST_WINDOW; w < RCT2_NEW_WINDOW; w++)
|
||||
if (w->classification == cls)
|
||||
return w;
|
||||
} else {
|
||||
for (w = RCT2_FIRST_WINDOW; w < RCT2_NEW_WINDOW; w++)
|
||||
if (w->classification == cls && w->number == number)
|
||||
return w;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates the specified window.
|
||||
* rct2: 0x006EB31A
|
||||
*
|
||||
* @param window The window to invalidate (esi).
|
||||
*/
|
||||
void window_invalidate(rct_window *window)
|
||||
{
|
||||
RCT2_CALLPROC_X(0x006EB31A, 0, 0, 0, 0, window, 0, 0);
|
||||
|
||||
// if (window != NULL)
|
||||
// gfx_set_dirty_blocks(window->x, window->y, window->x + window->width, window->y + window->height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates the specified window.
|
||||
* rct2: 0x006EAEB8
|
||||
*
|
||||
* @param window The window (esi).
|
||||
*/
|
||||
void window_init_scroll_widgets(rct_window *w)
|
||||
{
|
||||
RCT2_CALLPROC_X(0x006EAEB8, 0, 0, 0, 0, w, 0, 0);
|
||||
}
|
||||
59
src/window.h
59
src/window.h
@@ -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/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _WINDOW_H_
|
||||
#define _WINDOW_H_
|
||||
@@ -29,9 +29,9 @@ union rct_window_event;
|
||||
typedef void wndproc(struct rct_window*, union rct_window_event*);
|
||||
|
||||
/**
|
||||
* Widget structure
|
||||
* size: 0x10
|
||||
*/
|
||||
* Widget structure
|
||||
* size: 0x10
|
||||
*/
|
||||
typedef struct {
|
||||
uint8 type; // 0x00
|
||||
uint8 colour; // 0x01
|
||||
@@ -57,9 +57,9 @@ typedef struct {
|
||||
} widget_identifier;
|
||||
|
||||
/**
|
||||
* Viewport structure
|
||||
* size: 0x14
|
||||
*/
|
||||
* Viewport structure
|
||||
* size: 0x14
|
||||
*/
|
||||
typedef struct {
|
||||
sint16 width; // 0x00
|
||||
sint16 height; // 0x02
|
||||
@@ -115,9 +115,9 @@ typedef struct {
|
||||
} rct_scroll;
|
||||
|
||||
/**
|
||||
* Window structure
|
||||
* size: 0x4C0
|
||||
*/
|
||||
* Window structure
|
||||
* size: 0x4C0
|
||||
*/
|
||||
typedef struct rct_window {
|
||||
uint32* event_handlers; // 0x000
|
||||
rct_viewport* viewport; // 0x004
|
||||
@@ -267,5 +267,10 @@ enum {
|
||||
} WINDOW_CLASS;
|
||||
|
||||
void window_update_all();
|
||||
rct_window *window_create(int x, int y, int width, int height, uint32 *event_handlers, rct_windowclass cls, uint16 flags);
|
||||
void window_close(rct_window *window);
|
||||
rct_window *window_find_by_id(rct_windowclass cls, rct_windownumber number);
|
||||
void window_invalidate(rct_window *window);
|
||||
void window_init_scroll_widgets(rct_window *w);
|
||||
|
||||
#endif
|
||||
65
src/window_main.c
Normal file
65
src/window_main.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/*****************************************************************************
|
||||
* 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 "widget.h"
|
||||
#include "window.h"
|
||||
|
||||
rct_widget window_main_widgets[] = {
|
||||
{ WWT_VIEWPORT, 0, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0xFFFFFFFF, 0xFFFF },
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the main window and the toolbars or title screen buttons.
|
||||
* rct2: 0x0066B3E8
|
||||
*/
|
||||
void window_main_open()
|
||||
{
|
||||
rct_window* window;
|
||||
rct_widget* main_widgets = 0x009A9414;
|
||||
|
||||
main_widgets[0].right = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16);
|
||||
main_widgets[0].bottom = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16);
|
||||
window = window_create(0, 0, window_main_widgets[0].right, window_main_widgets[0].bottom, 0x0097C0BC, WC_MAIN_WINDOW, 0x01);
|
||||
window->widgets = main_widgets;
|
||||
|
||||
// RCT2_CALLPROC_X(0x006EB009, window->x, window->y, 0x4000000, 0x0FFF0FFF, window, 0, 0);
|
||||
__asm {
|
||||
mov esi, window
|
||||
mov edx, 0FFF0FFFh
|
||||
mov eax, [esi+2Ch]
|
||||
mov ebx, [esi+30h]
|
||||
mov ecx, 4000000h
|
||||
push ebp
|
||||
mov ebp, 6EB009h
|
||||
call ebp
|
||||
}
|
||||
__asm {
|
||||
pop ebp
|
||||
or word ptr [edi+12h], 400h
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(0x0141E9E0, sint32) = 0;
|
||||
RCT2_GLOBAL(0x009E32B0, uint8) = 0;
|
||||
RCT2_GLOBAL(0x009E32B2, uint8) = 0;
|
||||
RCT2_GLOBAL(0x009E32B3, uint8) = 0;
|
||||
RCT2_GLOBAL(0x00F3EFA2, uint8) = 0;
|
||||
}
|
||||
52
src/window_title_exit.c
Normal file
52
src/window_title_exit.c
Normal file
@@ -0,0 +1,52 @@
|
||||
/*****************************************************************************
|
||||
* 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 "sprites.h"
|
||||
#include "strings.h"
|
||||
#include "widget.h"
|
||||
#include "window.h"
|
||||
|
||||
static rct_widget window_title_exit_widgets[] = {
|
||||
{ WWT_IMGBTN, 2, 0, 39, 0, 63, SPR_MENU_EXIT, STR_EXIT },
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the window containing the exit button on the title screen.
|
||||
* rct2: 0x0066B624 (part of 0x0066B3E8)
|
||||
*/
|
||||
void window_title_exit_open()
|
||||
{
|
||||
rct_window* window;
|
||||
|
||||
window = window_create(
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 40,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 64,
|
||||
40, 64, 0x0097BEFC, WC_TITLE_EXIT, 0x02
|
||||
);
|
||||
window->widgets = 0x009A9644;
|
||||
window->enabled_widgets |= 1;
|
||||
window_init_scroll_widgets(window);
|
||||
window->flags |= 16;
|
||||
window->colours[0] = 140;
|
||||
window->colours[1] = 140;
|
||||
window->colours[2] = 140;
|
||||
}
|
||||
54
src/window_title_logo.c
Normal file
54
src/window_title_logo.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/*****************************************************************************
|
||||
* 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 "strings.h"
|
||||
#include "widget.h"
|
||||
#include "window.h"
|
||||
|
||||
static rct_widget window_title_logo_widgets[] = {
|
||||
{ WWT_EMPTY, 0, 0, 0, 0, 0, 0xFFFFFFFF, STR_NONE },
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the window containing the logo and the expansion packs on the title screen.
|
||||
* rct2: 0x0066B679 (part of 0x0066B3E8)
|
||||
*/
|
||||
void window_title_logo_open()
|
||||
{
|
||||
int i, packs;
|
||||
rct_window *window;
|
||||
|
||||
// Count number of expansion packs
|
||||
packs = 0;
|
||||
for (i = 0; i < 16; i++)
|
||||
if (RCT2_GLOBAL(0x009AB4C0, uint16) & (1 << i))
|
||||
packs++;
|
||||
|
||||
// Create the window
|
||||
window = window_create(0, 0, 200, 106 + (10 * packs), 0x0097BF6C, WC_TITLE_LOGO, 0x02);
|
||||
window->widgets = window_title_logo_widgets;
|
||||
window_init_scroll_widgets(window);
|
||||
window->flags |= 16;
|
||||
window->colours[0] = 129;
|
||||
window->colours[1] = 129;
|
||||
window->colours[2] = 129;
|
||||
}
|
||||
62
src/window_title_menu.c
Normal file
62
src/window_title_menu.c
Normal file
@@ -0,0 +1,62 @@
|
||||
x/*****************************************************************************
|
||||
* 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 "strings.h"
|
||||
#include "sprites.h"
|
||||
#include "widget.h"
|
||||
#include "window.h"
|
||||
|
||||
enum {
|
||||
WIDX_START_NEW_GAME,
|
||||
WIDX_CONTINUE_SAVED_GAME,
|
||||
WIDX_SHOW_TUTORIAL,
|
||||
WIDX_GAME_TOOLS,
|
||||
};
|
||||
|
||||
static rct_widget window_title_menu_widgets[] = {
|
||||
{ WWT_IMGBTN, 2, 0, 81, 0, 81, SPR_MENU_NEW_GAME, STR_START_NEW_GAME_TIP },
|
||||
{ WWT_IMGBTN, 2, 82, 163, 0, 81, SPR_MENU_LOAD_GAME, STR_CONTINUE_SAVED_GAME_TIP },
|
||||
{ WWT_IMGBTN, 2, 164, 245, 0, 81, SPR_MENU_TUTORIAL, STR_SHOW_TUTORIAL_TIP },
|
||||
{ WWT_IMGBTN, 2, 246, 327, 0, 81, SPR_MENU_TOOLBOX, STR_GAME_TOOLS },
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the window containing the menu buttons on the title screen.
|
||||
* rct2: 0x0066B5C0 (part of 0x0066B3E8)
|
||||
*/
|
||||
void window_title_menu_open()
|
||||
{
|
||||
rct_window* window;
|
||||
|
||||
window = window_create(
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 328) / 2,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 142,
|
||||
328, 82, 0x0097BE8C, WC_TITLE_MENU, 0x02
|
||||
);
|
||||
window->widgets = 0x009A9600;
|
||||
window->enabled_widgets |= (8 | 4 | 2 | 1);
|
||||
window_init_scroll_widgets(window);
|
||||
window->flags |= 16;
|
||||
window->colours[0] = 140;
|
||||
window->colours[1] = 140;
|
||||
window->colours[2] = 140;
|
||||
}
|
||||
Reference in New Issue
Block a user