mirror of https://github.com/OpenRCT2/OpenRCT2.git
commit
b51842078a
File diff suppressed because it is too large
Load Diff
39
install.sh
39
install.sh
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
SDL2_PV=2.0.3
|
||||
|
||||
cachedir=.cache
|
||||
|
@ -11,13 +9,44 @@ echo `uname`
|
|||
|
||||
if [[ `uname` == "Darwin" ]]; then
|
||||
echo "Installation of OpenRCT2 assumes you have homebrew and use it to install packages."
|
||||
|
||||
echo "Check if brew is installed"
|
||||
package_command="brew"
|
||||
which -s brew
|
||||
if [ $? -eq 1 ]; then
|
||||
echo "brew is not installed, or is not in your \$PATH"
|
||||
echo "Check if MacPorts is installed"
|
||||
which -s port
|
||||
if [ $? -eq 1 ]; then
|
||||
echo "MacPorts not found either, abort"
|
||||
exit
|
||||
else
|
||||
echo "MacPorts found"
|
||||
package_command="sudo port"
|
||||
fi
|
||||
else
|
||||
echo "brew was found"
|
||||
fi
|
||||
|
||||
echo "Check if wget is installed"
|
||||
which -s wget
|
||||
if [ $? -eq 1 ]; then
|
||||
echo "wget is not installed, installing wget.."
|
||||
eval "$package_command install wget"
|
||||
fi
|
||||
|
||||
# Install packages with whatever command was found.
|
||||
# Very possible I'm missing some dependencies here.
|
||||
brew install cmake wine
|
||||
eval "$package_command install cmake wine"
|
||||
|
||||
if [[ ! -d /usr/include/wine ]]; then
|
||||
# This will almost certainly break as brew changes. Better ideas
|
||||
# welcome.
|
||||
sudo ln -s /usr/local/Cellar/wine/1.6.2/include/wine /usr/include
|
||||
wine_path="/usr/local/Cellar/wine/1.6.2/include/wine"
|
||||
if [ $package_command == "sudo port" ]; then
|
||||
wine_path="/opt/local/include/wine"
|
||||
fi
|
||||
sudo ln -s $wine_path /usr/include
|
||||
fi
|
||||
|
||||
mingw_dmg=gcc-4.8.0-qt-4.8.4-for-mingw32.dmg
|
||||
|
@ -68,7 +97,7 @@ if [[ ! -f $cachedir/i686-w64-mingw32-pkg-config ]]; then
|
|||
# If this fails to work because of newlines, be sure you are running this
|
||||
# script with Bash, and not sh. We should really move this to a separate
|
||||
# file.
|
||||
echo -e "#! /bin/sh\nexport PKG_CONFIG_LIBDIR=/usr/local/cross-tools/i686-w64-mingw32/lib/pkgconfig\npkg-config \$@" > $cachedir/i686-w64-mingw32-pkg-config;
|
||||
echo -e "#!/bin/sh\nexport PKG_CONFIG_LIBDIR=/usr/local/cross-tools/i686-w64-mingw32/lib/pkgconfig\npkg-config \$@" > $cachedir/i686-w64-mingw32-pkg-config;
|
||||
fi
|
||||
|
||||
chmod +x $cachedir/i686-w64-mingw32-pkg-config
|
||||
|
|
|
@ -123,6 +123,7 @@
|
|||
<ClCompile Include="..\src\window_ride_list.c" />
|
||||
<ClCompile Include="..\src\window_save_prompt.c" />
|
||||
<ClCompile Include="..\src\window_staff.c" />
|
||||
<ClCompile Include="..\src\window_staff_peep.c" />
|
||||
<ClCompile Include="..\src\window_title_exit.c" />
|
||||
<ClCompile Include="..\src\window_title_logo.c" />
|
||||
<ClCompile Include="..\src\window_main.c" />
|
||||
|
|
|
@ -368,6 +368,9 @@
|
|||
<ClCompile Include="..\src\window_research.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\window_staff_peep.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\openrct2.exe">
|
||||
|
|
18
readme.md
18
readme.md
|
@ -36,7 +36,7 @@ The project therefore acts as a patch to RollerCoaster Tycoon 2, allowing each p
|
|||
## 1.3 Progress
|
||||
Currently, the windowing system, graphics rendering and basic game loop are being decompiled. Decompiling all of the game's procedures is a convenient way of identifying the game's memory structure. SDL2 has been used as a replacement for the operating system calls, allowing for cross-platform support after the dependency on the original game's executable has been removed.
|
||||
|
||||
As of 16th August 2014, various UI improvements have already been made, settings are now stored in a local INI file. More drawing functions have now been decompiled but still remain cryptic C, much of the game management have been decompiled (e.g. peep generation, awards, cash out) and almost half of the windows. A rough estimate based on number of functions in the original game and number of functions now in C tells us that the project is approximately 25% complete of its target goal of haivng the game run on 100% C code. More information can be found in [changes to original game](https://github.com/IntelOrca/OpenRCT2/wiki/Changes-to-original-game) and [window progress](https://github.com/IntelOrca/OpenRCT2/wiki/Window-progress).
|
||||
As of 16th August 2014, various UI improvements have already been made, settings are now stored in a local INI file. More drawing functions have now been decompiled but still remain cryptic C, much of the game management have been decompiled (e.g. peep generation, awards, cash out) and almost half of the windows. A rough estimate based on number of functions in the original game and number of functions now in C tells us that the project is approximately 25% complete of its target goal of having the game run on 100% C code. More information can be found in [changes to original game](https://github.com/IntelOrca/OpenRCT2/wiki/Changes-to-original-game) and [window progress](https://github.com/IntelOrca/OpenRCT2/wiki/Window-progress).
|
||||
|
||||
## 1.4 Aim
|
||||
The aim is to completely decompile RollerCoaster Tycoon 2 into C so that cross-platform support, new features, and new gameplay can be added in a similar fashion to OpenTTD. With the addition of SDL2, the game can already be run in a resizeable window (which was not possible originally). Once the game has been fully decompiled, additional gameplay features, gameplay tweaks, and improvements can be introduced. The following is only a brief, non-exhaustive list of the possibilities - there is much more possible:
|
||||
|
@ -60,9 +60,13 @@ The aim is to completely decompile RollerCoaster Tycoon 2 into C so that cross-p
|
|||
- Visual Studio 2013 (paid) / [Visual Studio Express 2013](http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-desktop) (free)
|
||||
- [SDL2 development library for Visual C++](http://www.libsdl.org/release/SDL2-devel-2.0.3-VC.zip).
|
||||
|
||||
### Linux:
|
||||
### Max OS X:
|
||||
- [Homebrew](http://brew.sh)
|
||||
- RollerCoaster Tycoon 2
|
||||
|
||||
### Mac OS X / Linux:
|
||||
- [MinGW-w64](mingw-w64.sourceforge.net)
|
||||
- [Wine](http://www.winehq.org/)
|
||||
- [Wine](http://www.winehq.org)
|
||||
- RollerCoaster Tycoon 2
|
||||
- libsdl2 compiled with MinGW-w64
|
||||
|
||||
|
@ -76,6 +80,14 @@ The aim is to completely decompile RollerCoaster Tycoon 2 into C so that cross-p
|
|||
6. When OpenRCT2 is run for the first time, it creates a settings file in `My Documents/OpenRCT2`. If it can't find the original installation of RCT2, you will need to edit `config.ini` in that folder and change the value of `game_path` to where RCT2 is installed.
|
||||
7. If the game crashes, you may need to press the red, square Stop button along the top of VS Express to stop the program.
|
||||
|
||||
### Mac OS X:
|
||||
Providing Homebrew is installed, OpenRCT2's dependencies and Wine can be installed automatically through `install.sh`.
|
||||
```
|
||||
bash install.sh
|
||||
bash build.sh
|
||||
wine openrct2.exe
|
||||
```
|
||||
|
||||
### Linux:
|
||||
As the easiest approach depends on your distribution, please take a look at the [wiki](https://github.com/IntelOrca/OpenRCT2/wiki).
|
||||
|
||||
|
|
|
@ -823,7 +823,7 @@ static void game_handle_input_mouse(int x, int y, int state)
|
|||
switch (ebx & 0xFF) {
|
||||
case 2:
|
||||
if (*((uint8*)edx) == 0)
|
||||
RCT2_CALLPROC_X(0x006B4857, eax, 0, ecx, 0, 0, 0, 0);
|
||||
RCT2_CALLPROC_X(0x006B4857, eax, 0, ecx, edx, 0, 0, 0);
|
||||
break;
|
||||
case 3:
|
||||
RCT2_CALLPROC_X(0x006CC056, eax, 0, ecx, edx, 0, 0, 0);
|
||||
|
|
|
@ -54,7 +54,7 @@ static void graph_draw_line_a_uint8(rct_drawpixelinfo *dpi, uint8 *history, int
|
|||
x = baseX;
|
||||
for (i = count - 1; i >= 0; i--) {
|
||||
if (history[i] != 0 && history[i] != 255) {
|
||||
y = baseY + (history[i] * 100) / 256;
|
||||
y = baseY + ((255 - history[i]) * 100) / 256;
|
||||
|
||||
if (lastX != -1) {
|
||||
gfx_draw_line(dpi, lastX + 1, lastY + 1, x + 1, y + 1, 10);
|
||||
|
@ -78,7 +78,7 @@ static void graph_draw_line_b_uint8(rct_drawpixelinfo *dpi, uint8 *history, int
|
|||
x = baseX;
|
||||
for (i = count - 1; i >= 0; i--) {
|
||||
if (history[i] != 0 && history[i] != 255) {
|
||||
y = baseY + (history[i] * 100) / 256;
|
||||
y = baseY + ((255 - history[i]) * 100) / 256;
|
||||
|
||||
if (lastX != -1)
|
||||
gfx_draw_line(dpi, lastX, lastY, x, y, 21);
|
||||
|
|
|
@ -52,6 +52,24 @@ char **language_strings = NULL;
|
|||
|
||||
static int language_open_file(const char *filename);
|
||||
|
||||
static int utf8_get_next(char *char_ptr, char **nextchar_ptr)
|
||||
{
|
||||
int result;
|
||||
int numBytes;
|
||||
|
||||
if (!(char_ptr[0] & 0x80)) {
|
||||
result = char_ptr[0];
|
||||
numBytes = 1;
|
||||
} else if (!(char_ptr[0] & 0x20)) {
|
||||
result = ((char_ptr[0] & 0x1F) << 6) | (char_ptr[1] & 0x3F);
|
||||
numBytes = 2;
|
||||
}
|
||||
|
||||
if (nextchar_ptr != NULL)
|
||||
*nextchar_ptr = char_ptr + numBytes;
|
||||
return result;
|
||||
}
|
||||
|
||||
const char *language_get_string(rct_string_id id)
|
||||
{
|
||||
const char *rct = RCT2_ADDRESS(0x009BF2D4, const char*)[id];
|
||||
|
@ -114,12 +132,21 @@ static int language_open_file(const char *filename)
|
|||
for (i = 0; i < language_buffer_size; i++) {
|
||||
char *src = &language_buffer[i];
|
||||
|
||||
// Handle UTF-8
|
||||
char *srcNext;
|
||||
int utf8Char = utf8_get_next(src, &srcNext);
|
||||
i += srcNext - src - 1;
|
||||
if (utf8Char > 0xFF)
|
||||
utf8Char = '?';
|
||||
else if (utf8Char > 0x7F)
|
||||
utf8Char &= 0xFF;
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
// Search for a comment
|
||||
if (*src == '#') {
|
||||
if (utf8Char == '#') {
|
||||
mode = 3;
|
||||
} else if (*src == ':' && string_no != -1) {
|
||||
} else if (utf8Char == ':' && string_no != -1) {
|
||||
// Search for colon
|
||||
dst = src + 1;
|
||||
language_strings[string_no] = dst;
|
||||
|
@ -134,19 +161,19 @@ static int language_open_file(const char *filename)
|
|||
break;
|
||||
case 1:
|
||||
// Copy string over, stop at line break
|
||||
if (*src == '{') {
|
||||
if (utf8Char == '{') {
|
||||
token = src + 1;
|
||||
mode = 2;
|
||||
} else if (*src == '\n' || *src == '\r') {
|
||||
} else if (utf8Char == '\n' || *src == '\r') {
|
||||
*dst = 0;
|
||||
mode = 0;
|
||||
} else {
|
||||
*dst++ = *src;
|
||||
*dst++ = utf8Char;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// Read token, convert to code
|
||||
if (*src == '}') {
|
||||
if (utf8Char == '}') {
|
||||
int tokenLength = min(src - token, sizeof(tokenBuffer) - 1);
|
||||
memcpy(tokenBuffer, token, tokenLength);
|
||||
tokenBuffer[tokenLength] = 0;
|
||||
|
@ -158,7 +185,7 @@ static int language_open_file(const char *filename)
|
|||
}
|
||||
break;
|
||||
case 3:
|
||||
if (*src == '\n' || *src == '\r') {
|
||||
if (utf8Char == '\n' || utf8Char == '\r') {
|
||||
mode = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -318,11 +318,11 @@ static void widget_tab_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetInd
|
|||
b = w->y + widget->bottom;
|
||||
|
||||
// Get the colour and image
|
||||
colour = w->colours[widget->colour] << 19;
|
||||
colour = w->colours[widget->colour];
|
||||
image = widget->image + 2;
|
||||
|
||||
// Draw coloured image
|
||||
gfx_draw_sprite(dpi, image | colour, l, t, 0);
|
||||
gfx_draw_sprite(dpi, image | (colour << 19), l, t, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -375,6 +375,7 @@ void window_park_rating_open();
|
|||
void window_finances_open();
|
||||
void window_new_campaign_open(int campaignType);
|
||||
void window_ride_list_open();
|
||||
void window_new_ride_open();
|
||||
void window_banner_open();
|
||||
void window_cheats_open();
|
||||
void window_research_open();
|
||||
|
|
|
@ -153,8 +153,27 @@ void window_game_top_toolbar_open()
|
|||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_5
|
||||
);
|
||||
window->widgets = window_game_top_toolbar_widgets;
|
||||
window->enabled_widgets |= (1 | 2 | 4 | 8 | 0x10 | 0x20 | 0x40 | 0x80 | 0x100 | 0x200 | 0x400 | 0x800 |
|
||||
0x1000 | 0x2000 | 0x4000 | 0x8000 | 0x10000 | 0x20000);
|
||||
|
||||
window->enabled_widgets |=
|
||||
(1 << WIDX_PAUSE) |
|
||||
(1 << WIDX_FILE_MENU) |
|
||||
(1 << WIDX_ZOOM_OUT) |
|
||||
(1 << WIDX_ZOOM_IN) |
|
||||
(1 << WIDX_ROTATE) |
|
||||
(1 << WIDX_VIEW_MENU) |
|
||||
(1 << WIDX_MAP) |
|
||||
(1 << WIDX_LAND) |
|
||||
(1 << WIDX_WATER) |
|
||||
(1 << WIDX_SCENERY) |
|
||||
(1 << WIDX_PATH) |
|
||||
(1 << WIDX_CONSTRUCT_RIDE) |
|
||||
(1 << WIDX_RIDES) |
|
||||
(1 << WIDX_PARK) |
|
||||
(1 << WIDX_STAFF) |
|
||||
(1 << WIDX_CLEAR_SCENERY) |
|
||||
(1ULL << WIDX_FASTFORWARD) |
|
||||
(1ULL << WIDX_RESEARCH);
|
||||
|
||||
window_init_scroll_widgets(window);
|
||||
window->colours[0] = 7;
|
||||
window->colours[1] = 12;
|
||||
|
@ -171,22 +190,13 @@ static void window_game_top_toolbar_mouseup()
|
|||
short widgetIndex;
|
||||
rct_window *w, *mainWindow;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
__asm mov widgetIndex, dx
|
||||
#else
|
||||
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) );
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
__asm mov w, esi
|
||||
#else
|
||||
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
|
||||
#endif
|
||||
|
||||
window_mouse_up_get_registers(w, widgetIndex);
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_PAUSE:
|
||||
game_do_command(0, 1, 0, 0, GAME_COMMAND_TOGGLE_PAUSE, 0, 0);
|
||||
// Not sure where this was done in the original code
|
||||
w->pressed_widgets ^= (1 << WIDX_PAUSE);
|
||||
break;
|
||||
case WIDX_FASTFORWARD:
|
||||
// This is an excellent place to add in debugging statements and
|
||||
|
@ -210,7 +220,6 @@ static void window_game_top_toolbar_mouseup()
|
|||
window_rotate_camera(mainWindow);
|
||||
break;
|
||||
case WIDX_MAP:
|
||||
//RCT2_CALLPROC_EBPSAFE(0x0068C88A);
|
||||
window_map_open();
|
||||
break;
|
||||
case WIDX_CLEAR_SCENERY:
|
||||
|
@ -261,7 +270,7 @@ static void window_game_top_toolbar_mouseup()
|
|||
}
|
||||
break;
|
||||
case WIDX_CONSTRUCT_RIDE:
|
||||
RCT2_CALLPROC_EBPSAFE(0x006B3CFF);
|
||||
window_new_ride_open();
|
||||
break;
|
||||
case WIDX_RIDES:
|
||||
window_ride_list_open();
|
||||
|
@ -271,7 +280,6 @@ static void window_game_top_toolbar_mouseup()
|
|||
break;
|
||||
case WIDX_STAFF:
|
||||
window_staff_open();
|
||||
//RCT2_CALLPROC_EBPSAFE(0x006BD3CC);
|
||||
break;
|
||||
case WIDX_GUESTS:
|
||||
window_guest_list_open();
|
||||
|
@ -532,6 +540,18 @@ static void window_game_top_toolbar_invalidate()
|
|||
w->pressed_widgets |= (1 << WIDX_FASTFORWARD);
|
||||
else
|
||||
w->pressed_widgets &= ~(1 << WIDX_FASTFORWARD);
|
||||
|
||||
// Zoomed out/in disable. Not sure where this code is in the original.
|
||||
if (window_get_main()->viewport->zoom == 0){
|
||||
w->disabled_widgets |= (1 << WIDX_ZOOM_IN);
|
||||
}
|
||||
else if (window_get_main()->viewport->zoom == 3){
|
||||
w->disabled_widgets |= (1 << WIDX_ZOOM_OUT);
|
||||
}
|
||||
else
|
||||
{
|
||||
w->disabled_widgets &= ~((1 << WIDX_ZOOM_IN) | (1 << WIDX_ZOOM_OUT));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,6 +33,24 @@ enum {
|
|||
WINDOW_NEW_RIDE_TAB_RESEARCH
|
||||
} WINDOW_RIDE_CONSTRUCTION_TAB;
|
||||
|
||||
enum {
|
||||
WIDX_BACKGROUND,
|
||||
WIDX_TITLE,
|
||||
WIDX_CLOSE,
|
||||
WIDX_PAGE_BACKGROUND,
|
||||
WIDX_TAB_1,
|
||||
WIDX_TAB_2,
|
||||
WIDX_TAB_3,
|
||||
WIDX_TAB_4,
|
||||
WIDX_TAB_5,
|
||||
WIDX_TAB_6,
|
||||
WIDX_TAB_7,
|
||||
|
||||
WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP,
|
||||
WIDX_LAST_DEVELOPMENT_GROUP,
|
||||
WIDX_LAST_DEVELOPMENT_BUTTON
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006ACA58
|
||||
|
@ -55,4 +73,54 @@ void window_new_ride_init_vars() {
|
|||
}
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_INFORMATION_TYPE, uint8) = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B3CFF
|
||||
*/
|
||||
void window_new_ride_open()
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
w = window_bring_to_front_by_id(WC_CONSTRUCT_RIDE, 0);
|
||||
if (w != NULL)
|
||||
return;
|
||||
|
||||
// Not sure what these windows are
|
||||
window_close_by_id(161, 0);
|
||||
window_close_by_id(162, 0);
|
||||
|
||||
w = window_create_auto_pos(601, 370, (uint32*)0x0098E354, WC_CONSTRUCT_RIDE, 0x400);
|
||||
w->widgets = (rct_widget*)0x009AEBF4;
|
||||
w->enabled_widgets =
|
||||
(1 << WIDX_CLOSE) |
|
||||
(1 << WIDX_TAB_1) |
|
||||
(1 << WIDX_TAB_2) |
|
||||
(1 << WIDX_TAB_3) |
|
||||
(1 << WIDX_TAB_4) |
|
||||
(1 << WIDX_TAB_5) |
|
||||
(1 << WIDX_TAB_6) |
|
||||
(1 << WIDX_TAB_7) |
|
||||
(1 << 14) |
|
||||
(1 << 15);
|
||||
window_init_scroll_widgets(w);
|
||||
|
||||
w->frame_no = 0;
|
||||
w->colours[0] = 24;
|
||||
w->colours[1] = 26;
|
||||
w->colours[2] = 26;
|
||||
w->var_480 = -1;
|
||||
w->var_482 = -1;
|
||||
RCT2_GLOBAL(0x00F43866, sint16) = -1;
|
||||
|
||||
RCT2_CALLPROC_EBPSAFE(0x006B6F3E);
|
||||
|
||||
w->var_482 = RCT2_ADDRESS(0x00F43825, sint16)[RCT2_GLOBAL(0x00F43824, uint8)];
|
||||
if (w->var_482 == -1)
|
||||
w->var_482 = RCT2_GLOBAL(0x00F43523, sint16);
|
||||
|
||||
w->width = 1;
|
||||
RCT2_CALLPROC_EBPSAFE(0x006B3DF1); // initialise window size and widgets
|
||||
RCT2_CALLPROC_EBPSAFE(0x006B7220);
|
||||
}
|
|
@ -129,7 +129,8 @@ uint32 window_peep_page_enabled_widgets[] = {
|
|||
void window_peep_open(rct_peep* peep){
|
||||
|
||||
if (peep->type == PEEP_TYPE_STAFF){
|
||||
RCT2_CALLPROC_X(0x006989E9, 0, 0, 0, (int)peep, 0, 0, 0);
|
||||
window_staff_peep_open(peep);
|
||||
return;
|
||||
}
|
||||
|
||||
rct_window* window;
|
||||
|
@ -151,7 +152,7 @@ void window_peep_open(rct_peep* peep){
|
|||
window->min_height = 157;
|
||||
window->max_width = 500;
|
||||
window->max_height = 450;
|
||||
window->flags = 8;
|
||||
window->flags = 1 << 8;
|
||||
window->no_list_items = 0;
|
||||
window->selected_list_item = -1;
|
||||
window->colours[0] = 1;
|
||||
|
@ -173,35 +174,3 @@ void window_peep_open(rct_peep* peep){
|
|||
window_init_scroll_widgets(window);
|
||||
RCT2_CALLPROC_X(0x0069883C, 0, 0, 0, 0, (int)window, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BEE98
|
||||
*/
|
||||
void window_staff_peep_open(rct_peep* peep)
|
||||
{
|
||||
rct_window* w = window_bring_to_front_by_id(WC_PEEP, peep->sprite_index);
|
||||
if (!w) {
|
||||
int eax, ebx, ecx, edx, esi, edi;
|
||||
|
||||
eax = peep->sprite_index;
|
||||
ecx = WC_PEEP;
|
||||
edx = peep->sprite_index;
|
||||
|
||||
RCT2_CALLFUNC_X(0x006BEF1B, &eax, &ebx, &ecx, &edx, &esi, &edi, (int*)peep);
|
||||
w = (rct_window*)esi;
|
||||
}
|
||||
|
||||
int PEEP_BACKGROUND_IDX = 0;
|
||||
w->widgets = RCT2_GLOBAL(0x992998, rct_widget*);
|
||||
w->enabled_widgets = RCT2_GLOBAL(0x9929B0, uint32);
|
||||
w->var_020 = RCT2_GLOBAL(0x9929BC, uint32);
|
||||
w->event_handlers = (uint32*)RCT2_GLOBAL(0x9929A4, uint32);
|
||||
w->pressed_widgets = 0;
|
||||
RCT2_CALLPROC_X(0x006BED21, 0, 0, 0, 0, (int)w, 0, 0);
|
||||
window_init_scroll_widgets(w);
|
||||
RCT2_CALLPROC_X(0x006BEDA3, 0, 0, 0, 0, (int)w, 0, 0);
|
||||
if (g_sprite_list[w->number].peep.state == PEEP_STATE_PICKED) {
|
||||
RCT2_CALLPROC_X(w->event_handlers[1], 0, 0, 0, 10, (int)w, 0, 0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,244 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014 Ted John, Duncan Frost
|
||||
* 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 "game.h"
|
||||
#include "peep.h"
|
||||
#include "string_ids.h"
|
||||
#include "sprite.h"
|
||||
#include "sprites.h"
|
||||
#include "widget.h"
|
||||
#include "window.h"
|
||||
#include "window_dropdown.h"
|
||||
|
||||
enum WINDOW_STAFF_PEEP_PAGE {
|
||||
WINDOW_STAFF_PEEP_OVERVIEW,
|
||||
WINDOW_STAFF_PEEP_OPTIONS,
|
||||
WINDOW_STAFF_PEEP_STATISTICS,
|
||||
};
|
||||
|
||||
enum WINDOW_STAFF_PEEP_WIDGET_IDX {
|
||||
WIDX_BACKGROUND,
|
||||
WIDX_TITLE,
|
||||
WIDX_CLOSE,
|
||||
WIDX_RESIZE,
|
||||
WIDX_TAB_1,
|
||||
WIDX_TAB_2,
|
||||
WIDX_TAB_3,
|
||||
WIDX_TAB_4,
|
||||
WIDX_VIEWPORT,
|
||||
WIDX_BTM_LABEL,
|
||||
WIDX_PATROL,
|
||||
WIDX_RENAME,
|
||||
WIDX_LOCATE,
|
||||
WIDX_FIRE
|
||||
};
|
||||
|
||||
void window_staff_peep_emptysub(){};
|
||||
|
||||
rct_widget window_staff_peep_overview_widgets[] = {
|
||||
{ WWT_FRAME, 0, 0, 189, 0, 179, 0x0FFFFFFFF, STR_NONE }, // Panel / Background
|
||||
{ WWT_CAPTION, 0, 1, 188, 1, 14, 0x361, STR_WINDOW_TITLE_TIP }, // Title
|
||||
{ WWT_CLOSEBOX, 0, 177, 187, 2, 13, 0x338, STR_CLOSE_WINDOW_TIP }, // Close x button
|
||||
{ WWT_RESIZE, 1, 0, 189, 43, 179, 0x0FFFFFFFF, STR_NONE }, // Resize
|
||||
{ WWT_TAB, 1, 3, 33, 17, 43, 0x2000144E, 1939 }, // Tab 1
|
||||
{ WWT_TAB, 1, 34, 64, 17, 43, 0x2000144E, 1945}, // Tab 2
|
||||
{ WWT_TAB, 1, 65, 95, 17, 43, 0x2000144E, 2348}, // Tab 3
|
||||
{ WWT_TAB, 1, 96, 126, 17, 43, 0x2000144E, STR_NONE}, // Tab 4
|
||||
{ WWT_VIEWPORT, 1, 3, 164, 47, 166, 0x0FFFFFFFF, STR_NONE}, // Viewport
|
||||
{ WWT_12, 1, 3, 164, 167, 177, 0x0FFFFFFFF, STR_NONE }, // Label at bottom of viewport
|
||||
{ WWT_FLATBTN, 1, 165, 188, 45, 68, 0x1436, 1706}, // Pickup Button
|
||||
{ WWT_FLATBTN, 1, 165, 188, 69, 92, 0x1437, 1708}, // Patrol Button
|
||||
{ WWT_FLATBTN, 1, 165, 188, 93, 116, 0x1430, 1056}, // Rename Button
|
||||
{ WWT_FLATBTN, 1, 165, 188, 117, 140, 0x142F, 1027}, // Locate Button
|
||||
{ WWT_FLATBTN, 1, 165, 188, 141, 164, 0x142D, 1705}, // Fire Button
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
rct_widget *window_staff_peep_page_widgets[] = {
|
||||
window_staff_peep_overview_widgets
|
||||
};
|
||||
|
||||
// 0x992AEC
|
||||
static void* window_staff_peep_overview_events[] = {
|
||||
(void*)0x6BDFF8,
|
||||
(void*)0x6BDF55,
|
||||
(void*)0x6BE558,
|
||||
(void*)0x6BDF98,
|
||||
(void*)0x6BDFA3,
|
||||
window_staff_peep_emptysub,
|
||||
(void*)0x6BE602,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
(void*)0x6BDFD8,
|
||||
(void*)0x6BDFC3,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
(void*)0x6BDFAE,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
(void*)0x6BDFED,
|
||||
(void*)0x6BE5FC,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
window_staff_peep_emptysub,
|
||||
(void*)0x6BDD91, //Invalidate
|
||||
(void*)0x6BDEAF, //Paint
|
||||
(void*)0x6BE62A
|
||||
};
|
||||
|
||||
void* window_staff_peep_page_events[] = {
|
||||
window_staff_peep_overview_events
|
||||
};
|
||||
|
||||
uint32 window_staff_peep_page_enabled_widgets[] = {
|
||||
(1 << WIDX_CLOSE) |
|
||||
(1 << WIDX_TAB_1) |
|
||||
(1 << WIDX_TAB_2) |
|
||||
(1 << WIDX_TAB_3) |
|
||||
(1 << WIDX_PATROL) |
|
||||
(1 << WIDX_RENAME) |
|
||||
(1 << WIDX_LOCATE) |
|
||||
(1 << WIDX_FIRE) |
|
||||
(1 << 14)
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* rct2: 0x006BED21
|
||||
*
|
||||
*/
|
||||
void sub_6BED21(rct_window* w, rct_peep* peep)
|
||||
{
|
||||
int eax = 0 | 0x80;
|
||||
|
||||
if (peep->staff_type == 2) {
|
||||
eax |= 0x20;
|
||||
}
|
||||
|
||||
//RCT2_CALLFUNC_X(0x698827, 0, 0, 0, 0, 0, 0, 0);
|
||||
// sub_698827
|
||||
// This is here due to needing the Carry Flag.
|
||||
|
||||
int CF = 0;
|
||||
int res = RCT2_GLOBAL(0x982004 + peep->state, uint8) & 1;
|
||||
|
||||
if (res == 0) {
|
||||
CF = 1;
|
||||
}
|
||||
else {
|
||||
eax = eax & eax;
|
||||
}
|
||||
|
||||
// end sub_698827
|
||||
|
||||
int a = 0;
|
||||
|
||||
// pop esi
|
||||
if (CF == 1 && w->page == 0) {
|
||||
eax |= 0x400; //or eax, 400h
|
||||
|
||||
a = w->disabled_widgets & (1 << 0xA); //bt dword ptr[esi + 10h], 0Ah
|
||||
|
||||
}
|
||||
|
||||
if (a == 0) {
|
||||
CF = w->disabled_widgets & (1 << 0xA); //bt dword ptr [esi+10h], 0Ah
|
||||
if (CF == 1) {
|
||||
window_invalidate(w);
|
||||
}
|
||||
}
|
||||
|
||||
w->disabled_widgets = eax;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the window for a specific peep.
|
||||
*
|
||||
* rct2: 0x006BEF1B
|
||||
*/
|
||||
rct_window* sub_6BEF1B(rct_peep* peep)
|
||||
{
|
||||
rct_window* w = window_create_auto_pos(190, 180, (uint32*)window_staff_peep_overview_events, WC_PEEP, (uint16)0x400);
|
||||
|
||||
w->widgets = RCT2_GLOBAL(0x9AF81C, rct_widget*);
|
||||
w->enabled_widgets = RCT2_GLOBAL(0x9929B0, uint32);
|
||||
w->number = peep->sprite_index;
|
||||
w->page = 0;
|
||||
w->var_482 = 0;
|
||||
w->frame_no = 0;
|
||||
|
||||
RCT2_GLOBAL((int*)w + 0x496, uint16) = 0; // missing, var_494 should perhaps be uint16?
|
||||
|
||||
sub_6BED21(w, peep);
|
||||
|
||||
w->min_width = 190;
|
||||
w->min_height = 180;
|
||||
w->max_width = 500;
|
||||
w->max_height = 450;
|
||||
|
||||
w->flags = 1 << 8;
|
||||
|
||||
w->colours[0] = 1;
|
||||
w->colours[1] = 4;
|
||||
w->colours[2] = 4;
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BEE98
|
||||
*/
|
||||
void window_staff_peep_open(rct_peep* peep)
|
||||
{
|
||||
rct_window* w = window_bring_to_front_by_id(WC_PEEP, peep->sprite_index);
|
||||
if (!w) {
|
||||
//int eax, ebx, ecx, edx, esi, edi;
|
||||
|
||||
//eax = peep->sprite_index;
|
||||
//ecx = WC_PEEP;
|
||||
//edx = peep->sprite_index;
|
||||
|
||||
//RCT2_CALLFUNC_X(0x006BEF1B, &eax, &ebx, &ecx, &edx, &esi, &edi, (int*)peep);
|
||||
//w = (rct_window*)esi;
|
||||
|
||||
w = sub_6BEF1B(peep);
|
||||
}
|
||||
w->page = 0;
|
||||
window_invalidate(w);
|
||||
|
||||
w->widgets = window_staff_peep_overview_widgets;
|
||||
w->enabled_widgets = window_staff_peep_page_enabled_widgets[0];
|
||||
w->var_020 = RCT2_GLOBAL(0x9929BC, uint32);
|
||||
w->event_handlers = window_staff_peep_page_events[0];
|
||||
w->pressed_widgets = 0;
|
||||
//RCT2_CALLPROC_X(0x006BED21, 0, 0, 0, 0, (int)w, 0, 0);
|
||||
sub_6BED21(w, peep);
|
||||
window_init_scroll_widgets(w);
|
||||
RCT2_CALLPROC_X(0x006BEDA3, 0, 0, 0, 0, (int)w, 0, 0);
|
||||
if (g_sprite_list[w->number].peep.state == PEEP_STATE_PICKED) {
|
||||
RCT2_CALLPROC_X(w->event_handlers[WE_MOUSE_UP], 0, 0, 0, 10, (int)w, 0, 0);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue