Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Tom van der Kleij 2014-09-06 09:48:54 +02:00
commit 212849ec6c
13 changed files with 1349 additions and 31 deletions

View File

@ -44,6 +44,7 @@
<ClInclude Include="..\src\ride_ratings.h" />
<ClInclude Include="..\src\sawyercoding.h" />
<ClInclude Include="..\src\scenario.h" />
<ClInclude Include="..\src\scenery.h" />
<ClInclude Include="..\src\screenshot.h" />
<ClInclude Include="..\src\sprite.h" />
<ClInclude Include="..\src\sprites.h" />
@ -137,6 +138,7 @@
<ClCompile Include="..\src\window_tooltip.c" />
<ClCompile Include="..\src\window_water.c" />
<ClCompile Include="..\src\staff.c" />
<ClCompile Include="..\src\window_scenery.c" />
</ItemGroup>
<ItemGroup>
<None Include="..\openrct2.exe" />

View File

@ -162,6 +162,9 @@
<ClInclude Include="..\src\input.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\scenery.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\game.c">
@ -380,6 +383,9 @@
<ClCompile Include="..\src\staff.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\window_scenery.c">
<Filter>Windows</Filter>
</ClCompile>
<ClCompile Include="..\src\input.c">
<Filter>Source Files</Filter>
</ClCompile>

View File

@ -184,6 +184,13 @@
#define RCT2_ADDRESS_G1_ELEMENTS 0x009EBD28
#define RCT2_ADDRESS_PATH_TYPES 0x009ADA14
#define RCT2_ADDRESS_SMALL_SCENERY_ENTRIES 0x009AD1A4
#define RCT2_ADDRESS_LARGE_SCENERY_ENTRIES 0x009AD594
#define RCT2_ADDRESS_WALL_SCENERY_ENTRIES 0x009AD794
#define RCT2_ADDRESS_BANNER_SCENERY_ENTRIES 0x009AD994
#define RCT2_ADDRESS_PATH_BIT_SCENERY_ENTRIES 0x009ADA54
#define RCT2_ADDRESS_SCENERY_SET_ENTRIES 0x009ADA90
//Every pixel changed by rain is stored.
//32bit (pixel_offset 24 bit)(pixel_colour 8 bit)

View File

@ -2265,14 +2265,13 @@ rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int widt
newDrawPixelInfo->height = dpi->height;
newDrawPixelInfo->pitch = dpi->pitch;
newDrawPixelInfo->zoom_level = 0;
newDrawPixelInfo->var_0F = dpi->var_0F;
if (left > newDrawPixelInfo->x) {
uint16 newWidth = left - newDrawPixelInfo->x;
newDrawPixelInfo->width -= newWidth;
uint16 clippedFromLeft = left - newDrawPixelInfo->x;
newDrawPixelInfo->width -= clippedFromLeft;
newDrawPixelInfo->x = left;
newDrawPixelInfo->pitch += newWidth;
newDrawPixelInfo->bits += newWidth;
newDrawPixelInfo->pitch += clippedFromLeft;
newDrawPixelInfo->bits += clippedFromLeft;
}
int stickOutWidth = newDrawPixelInfo->x + newDrawPixelInfo->width - right;
@ -2282,10 +2281,10 @@ rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int widt
}
if (top > newDrawPixelInfo->y) {
uint16 newHeight = top - newDrawPixelInfo->y;
newDrawPixelInfo->height = newHeight;
uint16 clippedFromTop = top - newDrawPixelInfo->y;
newDrawPixelInfo->height -= clippedFromTop;
newDrawPixelInfo->y = top;
int bitsPlus = (newDrawPixelInfo->pitch + newDrawPixelInfo->width) * newHeight;
uint32 bitsPlus = (newDrawPixelInfo->pitch + newDrawPixelInfo->width) * clippedFromTop;
newDrawPixelInfo->bits += bitsPlus;
}

130
src/scenery.h Normal file
View File

@ -0,0 +1,130 @@
/*****************************************************************************
* Copyright (c) 2014 Dániel Tar
* 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 _SCENERY_H_
#define _SCENERY_H_
#include "rct2.h"
#include "string_ids.h"
typedef struct {
uint32 flags; // 0x06
uint8 height; // 0x0A
uint8 tool_id; // 0x0B
uint16 price; // 0x0C
uint8 pad_0E[12];
uint8 scenery_tab_id; // 0x1A
} rct_small_scenery_entry;
typedef enum {
SMALL_SCENERY_FLAG1 = (1 << 0), // 0x1
SMALL_SCENERY_FLAG2 = (1 << 1), // 0x2
SMALL_SCENERY_FLAG3 = (1 << 2), // 0x4
SMALL_SCENERY_FLAG4 = (1 << 3), // 0x8
SMALL_SCENERY_FLAG5 = (1 << 4), // 0x10
SMALL_SCENERY_FLAG6 = (1 << 5), // 0x20
SMALL_SCENERY_FLAG7 = (1 << 6), // 0x40
SMALL_SCENERY_FLAG8 = (1 << 7), // 0x80
SMALL_SCENERY_FLAG9 = (1 << 8), // 0x100
SMALL_SCENERY_FLAG10 = (1 << 9), // 0x200
SMALL_SCENERY_HAS_PRIMARY_COLOUR = (1 << 10), // 0x400
SMALL_SCENERY_FLAG12 = (1 << 11), // 0x800
SMALL_SCENERY_FLAG13 = (1 << 12), // 0x1000
SMALL_SCENERY_FLAG14 = (1 << 13), // 0x2000
SMALL_SCENERY_FLAG15 = (1 << 14), // 0x4000
SMALL_SCENERY_FLAG16 = (1 << 15), // 0x8000
SMALL_SCENERY_FLAG17 = (1 << 16), // 0x10000
SMALL_SCENERY_FLAG18 = (1 << 17), // 0x20000
SMALL_SCENERY_FLAG19 = (1 << 18), // 0x40000
SMALL_SCENERY_HAS_SECONDARY_COLOUR = (1 << 19), // 0x80000
} SMALL_SCENERY_FLAGS;
typedef struct {
uint8 tool_id; // 0x06
uint8 flags; // 0x07
uint16 price; // 0x08
uint8 pad_0A[6];
uint8 scenery_tab_id; // 0x10
} rct_large_scenery_entry;
typedef struct {
uint8 tool_id; // 0x06
uint8 flags; // 0x07
uint8 height; // 0x08
uint8 flags2; // 0x09
uint16 price; // 0x0A
uint8 scenery_tab_id; // 0x0C
} rct_wall_scenery_entry;
typedef enum {
WALL_SCENERY_FLAG1 = (1 << 0), // 0x1
WALL_SCENERY_FLAG2 = (1 << 1), // 0x2
WALL_SCENERY_FLAG3 = (1 << 2), // 0x4
WALL_SCENERY_FLAG4 = (1 << 3), // 0x8
WALL_SCENERY_FLAG5 = (1 << 4), // 0x10
WALL_SCENERY_FLAG6 = (1 << 5), // 0x20
WALL_SCENERY_HAS_SECONDARY_COLOUR = (1 << 6), // 0x40
WALL_SCENERY_HAS_TERNARY_COLOUR = (1 << 7), // 0x80
} WALL_SCENERY_FLAGS;
typedef struct {
uint8 pad_02[3];
uint8 tool_id; // 0x09
uint16 price; // 0x0A
uint8 scenery_tab_id; // 0x0C
} rct_path_bit_scenery_entry;
typedef struct {
uint8 var_06;
uint8 flags; // 0x07
uint16 price; // 0x08
uint8 scenery_tab_id; // 0x0A
} rct_banner_scenery_entry;
typedef struct {
rct_string_id name; // 0x00
uint32 image; // 0x02
union {
rct_small_scenery_entry small_scenery;
rct_large_scenery_entry large_scenery;
rct_wall_scenery_entry wall;
rct_path_bit_scenery_entry path_bit;
rct_banner_scenery_entry banner;
};
} rct_scenery_entry;
typedef struct {
rct_string_id name; // 0x00
uint32 image; // 0x02
uint16 scenery_entries[0x80]; // 0x06
uint8 entry_count; // 0x106
uint8 pad_107;
uint8 var_108; // 0x108, order?
} rct_scenery_set_entry;
#define g_smallSceneryEntries RCT2_ADDRESS(RCT2_ADDRESS_SMALL_SCENERY_ENTRIES, rct_scenery_entry*)
#define g_largeSceneryEntries RCT2_ADDRESS(RCT2_ADDRESS_LARGE_SCENERY_ENTRIES, rct_scenery_entry*)
#define g_wallSceneryEntries RCT2_ADDRESS(RCT2_ADDRESS_WALL_SCENERY_ENTRIES, rct_scenery_entry*)
#define g_bannerSceneryEntries RCT2_ADDRESS(RCT2_ADDRESS_BANNER_SCENERY_ENTRIES, rct_scenery_entry*)
#define g_pathBitSceneryEntries RCT2_ADDRESS(RCT2_ADDRESS_PATH_BIT_SCENERY_ENTRIES, rct_scenery_entry*)
#define g_scenerySetEntries RCT2_ADDRESS(RCT2_ADDRESS_SCENERY_SET_ENTRIES, rct_scenery_set_entry*)
#endif

View File

@ -820,6 +820,10 @@ enum {
STR_REAL_PARKS = STR_BEGINNER_PARKS + 3,
STR_OTHER_PARKS = STR_BEGINNER_PARKS + 4,
STR_SELECT_COLOUR = 3099,
STR_SELECT_SECONDARY_COLOUR = 3100,
STR_SELECT_TERNARY_COLOUR = 3101,
STR_LIST_RIDES_TIP = 3104,
STR_LIST_SHOPS_AND_STALLS_TIP = 3105,
STR_LIST_KIOSKS_AND_FACILITIES_TIP = 3106,

View File

@ -736,13 +736,15 @@ static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
// Get the colour
colour = w->colours[widget->colour];
// checkbox
gfx_fill_rect_inset(dpi, l, t, l + 9, b - 1, colour, 0x60);
if (widget->type != WWT_24) {
// checkbox
gfx_fill_rect_inset(dpi, l, t, l + 9, b - 1, colour, 0x60);
// fill it when checkbox is pressed
if (widget_is_pressed(w, widgetIndex)) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gfx_draw_string(dpi, (char*)0x009DED72, colour & 0x7F, l, t);
// fill it when checkbox is pressed
if (widget_is_pressed(w, widgetIndex)) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gfx_draw_string(dpi, (char*)0x009DED72, colour & 0x7F, l, t);
}
}
// draw the text

View File

@ -162,6 +162,11 @@ typedef struct {
sint32 var_482;
} ride_variables;
typedef struct {
sint16 selected_scenery_id;
sint16 hover_counter;
} scenery_variables;
/**
* Window structure
* size: 0x4C0
@ -199,6 +204,7 @@ typedef struct rct_window {
news_variables news;
map_variables map;
ride_variables ride;
scenery_variables scenery;
};
sint16 page; // 0x48A
sint16 var_48C;
@ -457,6 +463,7 @@ void window_new_ride_open();
void window_banner_open();
void window_cheats_open();
void window_research_open();
void window_scenery_open();
void window_guest_list_init_vars_a();
void window_guest_list_init_vars_b();

View File

@ -259,7 +259,8 @@ static void window_game_top_toolbar_mouseup()
case WIDX_SCENERY:
if (!tool_set(w, WIDX_SCENERY, 0)) {
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
RCT2_CALLPROC_EBPSAFE(0x006E0FEF);
window_scenery_open();
//RCT2_CALLPROC_EBPSAFE(0x006E0FEF);
}
break;
case WIDX_PATH:

View File

@ -25,6 +25,7 @@
#include "news_item.h"
#include "ride.h"
#include "string_ids.h"
#include "scenery.h"
#include "track.h"
#include "widget.h"
#include "window.h"
@ -761,8 +762,7 @@ static void window_new_ride_paint()
rideEntry->name :
(typeId & 0xFF00) + 2;
} else {
uint8 *sceneryEntry = RCT2_GLOBAL(0x009ADA90 + (typeId & 0xFFFF) * 4, uint8*);
stringId = RCT2_GLOBAL(sceneryEntry, uint16);
stringId = g_scenerySetEntries[typeId]->name;
}
}
}
@ -798,8 +798,7 @@ static void window_new_ride_paint()
rideEntry->name :
(typeId & 0xFF00) + 2;
} else {
uint8 *sceneryEntry = RCT2_GLOBAL(0x009ADA90 + (typeId & 0xFFFF) * 4, uint8*);
stringId = RCT2_GLOBAL(sceneryEntry, uint16);
stringId = g_scenerySetEntries[typeId]->name;
}
gfx_draw_string_left_wrapped(dpi, &stringId, x, y, 266, STR_RESEARCH_RIDE_LABEL, 0);
}

View File

@ -23,6 +23,7 @@
#include "game.h"
#include "news_item.h"
#include "ride.h"
#include "scenery.h"
#include "string_ids.h"
#include "sprites.h"
#include "widget.h"
@ -348,8 +349,7 @@ static void window_research_development_paint()
rideEntry->name :
((typeId >> 8) & 0xFF) + 2;
} else {
uint8 *sceneryEntry = RCT2_GLOBAL(0x009ADA90 + (typeId & 0xFFFF) * 4, uint8*);
stringId = RCT2_GLOBAL(sceneryEntry, uint16);
stringId = g_scenerySetEntries[typeId]->name;
}
}
}
@ -388,8 +388,7 @@ static void window_research_development_paint()
lastDevelopmentFormat = STR_RESEARCH_RIDE_LABEL;
} else {
uint8 *sceneryEntry = RCT2_GLOBAL(0x009ADA90 + (typeId & 0xFFFF) * 4, uint8*);
stringId = RCT2_GLOBAL(sceneryEntry, uint16);
stringId = g_scenerySetEntries[typeId]->name;
lastDevelopmentFormat = STR_RESEARCH_SCENERY_LABEL;
}
gfx_draw_string_left_wrapped(dpi, &stringId, x, y, 266, lastDevelopmentFormat, 0);

1166
src/window_scenery.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright (c) 2014 Maciek Baron, Daniel Tar
/*****************************************************************************
* Copyright (c) 2014 Maciek Baron, Dániel Tar
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
@ -171,11 +171,7 @@ void window_staff_open()
window->colours[2] = 4;
}
void window_staff_cancel_tools() {
rct_window *w;
window_get_register(w);
void window_staff_cancel_tools(rct_window *w) {
int toolWindowClassification = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass);
int toolWindowNumber = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber);
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
@ -264,7 +260,7 @@ static void window_staff_resize()
*
* rct2: 0x006BD971
*/
static void window_staff_mousedown(int widgetIndex, rct_window*w, rct_widget* widget)
static void window_staff_mousedown(int widgetIndex, rct_window* w, rct_widget* widget)
{
short newSelectedTab;
int eax;