Merge branch 'master' into viewport-window

Conflicts:
	projects/openrct2.vcxproj.filters
This commit is contained in:
IntelOrca 2014-10-12 17:28:17 +01:00
commit f22cc6bbeb
13 changed files with 1024 additions and 163 deletions

View File

@ -125,6 +125,7 @@
<ClCompile Include="..\src\windows\scenery.c" />
<ClCompile Include="..\src\windows\shortcut_keys.c" />
<ClCompile Include="..\src\windows\shortcut_key_change.c" />
<ClCompile Include="..\src\windows\staff_fire_prompt.c" />
<ClCompile Include="..\src\windows\staff_list.c" />
<ClCompile Include="..\src\windows\staff.c" />
<ClCompile Include="..\src\windows\title_exit.c" />

View File

@ -418,6 +418,9 @@
<ClCompile Include="..\src\world\banner.c">
<Filter>Source\World</Filter>
</ClCompile>
<ClCompile Include="..\src\windows\staff_fire_prompt.c">
<Filter>Source\Windows</Filter>
</ClCompile>
<ClCompile Include="..\lib\libspeex\resample.c;..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\src\windows\viewport.c">
<Filter>Source\Windows</Filter>

View File

@ -44,7 +44,7 @@ enum GAME_COMMAND {
GAME_COMMAND_REMOVE_PATH, // 19
GAME_COMMAND_20,
GAME_COMMAND_21,
GAME_COMMAND_22,
GAME_COMMAND_22, //To do with text input
GAME_COMMAND_23,
GAME_COMMAND_24,
GAME_COMMAND_25,
@ -52,9 +52,9 @@ enum GAME_COMMAND {
GAME_COMMAND_27,
GAME_COMMAND_28,
GAME_COMMAND_HIRE_NEW_STAFF_MEMBER, // 29
GAME_COMMAND_30,
GAME_COMMAND_31,
GAME_COMMAND_SET_STAFF_ORDER,
GAME_COMMAND_SET_STAFF_PATROL, //30
GAME_COMMAND_FIRE_STAFF_MEMBER, // 31
GAME_COMMAND_SET_STAFF_ORDER, // 32
GAME_COMMAND_33,
GAME_COMMAND_SET_PARK_OPEN, // 34
GAME_COMMAND_35,

View File

@ -481,6 +481,7 @@ void window_shortcut_keys_open();
void window_shortcut_change_open(int selected_key);
void window_guest_open(rct_peep* peep);
void window_staff_open(rct_peep* peep);
void window_staff_fire_prompt_open(rct_peep* peep);
void window_park_awards_open();
void window_park_entrance_open();
void window_park_guests_open();

View File

@ -174,7 +174,8 @@ enum {
STR_RIDES_IN_PARK_TIP = 1053,
STR_NAME_RIDE_TIP = 1054,
STR_NAME_GUEST_TIP = 1055,
STR_NAME_STAFF_TIP = 1056,
STR_RIDE_ATTRACTION_NAME = 1057,
STR_ENTER_NEW_NAME_FOR_THIS_RIDE_ATTRACTION = 1058,
STR_CANT_RENAME_RIDE_ATTRACTION = 1059,
@ -436,8 +437,13 @@ enum {
STR_HIRE_SECURITY_GUARD = 1702,
STR_HIRE_ENTERTAINER = 1703,
STR_CANT_HIRE_NEW_STAFF = 1704,
STR_FIRE_STAFF_TIP = 1705,
STR_PICKUP_TIP = 1706,
STR_TOO_MANY_STAFF_IN_GAME = 1707,
STR_SET_PATROL_TIP = 1708,
STR_SACK_STAFF = 1709,
STR_YES = 1710,
STR_FIRE_STAFF_ID = 1711,
STR_CANT_RENAME_PARK = 1717,
STR_PARK_NAME = 1718,
@ -611,6 +617,10 @@ enum {
STR_SHOW_SUBJECT_TIP = 1937,
STR_STAFF_OVERVIEW_TIP = 1939,
STR_STAFF_OPTIONS_TIP = 1945,
STR_SELECT_COSTUME_TIP = 1946,
STR_SHOW_PATROL_AREA_TIP = 1947,
STR_HIRE_STAFF_TIP = 1948,
STR_FINANCIAL_SUMMARY = 1949,
@ -756,6 +766,9 @@ enum {
STR_IMPERIAL = 2344,
STR_METRIC = 2345,
STR_DISPLAY = 2346,
STR_STAFF_STATS_TIP = 2348,
//STR_UNITS = 2358,
STR_REAL_VALUES = 2359,
STR_DISPLAY_RESOLUTION = 2360,
@ -1168,6 +1181,9 @@ enum {
STR_PAGE_4 = STR_PAGE_1 + 3,
STR_PAGE_5 = STR_PAGE_1 + 4,
STR_SET_PATROL_AREA = 3445,
STR_CLEAR_PATROL_AREA = 3446,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768
};

View File

@ -332,9 +332,9 @@ typedef struct {
uint8 pad_2C;
uint8 sprite_type; // 0x2D
uint8 type; // 0x2E
union{ // 0x2F
uint8 staff_type;
uint8 no_of_rides;
union{
uint8 staff_type; // 0x2F
uint8 no_of_rides; // 0x2F
};
uint8 tshirt_colour; // 0x30
uint8 trousers_colour; // 0x31
@ -396,7 +396,10 @@ typedef struct {
uint8 staff_id;
uint8 guest_heading_to_ride_id;
};
uint8 var_C6;
union{
uint8 staff_orders; // 0xC6
uint8 var_C6;
};
uint8 photo1_ride_ref; // 0xC7
uint32 flags; // 0xC8
uint32 var_CC;

View File

@ -51,6 +51,8 @@ enum {
SPR_RENAME = 5168,
SPR_ROTATE_ARROW = 5169,
SPR_PICKUP_BTN = 5174,
SPR_PATROL_BTN = 5175,
SPR_BUY_LAND_RIGHTS = 5176,
SPR_BUY_CONSTRUCTION_RIGHTS = 5177,
SPR_NO_ENTRY = 5178,
@ -122,6 +124,14 @@ enum {
SPR_PEEP_LARGE_FACE_ANGRY = 5314,
SPR_TAB_STAFF_OPTIONS_0 = 5319,
SPR_TAB_STAFF_OPTIONS_1 = SPR_TAB_STAFF_OPTIONS_0 + 1,
SPR_TAB_STAFF_OPTIONS_2 = SPR_TAB_STAFF_OPTIONS_0 + 2,
SPR_TAB_STAFF_OPTIONS_3 = SPR_TAB_STAFF_OPTIONS_0 + 3,
SPR_TAB_STAFF_OPTIONS_4 = SPR_TAB_STAFF_OPTIONS_0 + 4,
SPR_TAB_STAFF_OPTIONS_5 = SPR_TAB_STAFF_OPTIONS_0 + 5,
SPR_TAB_STAFF_OPTIONS_6 = SPR_TAB_STAFF_OPTIONS_0 + 6,
SPR_TAB_FINANCES_RESEARCH_0 = 5327,
SPR_TAB_SHOPS_AND_STALLS_0 = 5351,

View File

@ -1178,29 +1178,6 @@ void window_guest_overview_tool_update(){
RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, uint32) = ebx;
}
/* rct2: 0x664F72 */
int sub_664F72(int x, int y, int z){
if (x > 0x1FFF || y > 0x1FFF){
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1;
return 1;
}
rct_map_element* map_element = map_get_surface_element_at(x / 32, y / 32);
if (map_element->properties.surface.ownership & 0x20) return 0;
if (!(map_element->properties.surface.ownership & 0x10)){
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1;
return 1;
}
z >>= 3;
if ((z & 0xFF) < map_element->base_height)return 0;
z = (z & 0xFF) - 2;
if (z > map_element->base_height)return 0;
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1;
return 1;
}
/* rct2: 0x696A54 */
void window_guest_overview_tool_down(){
short widgetIndex;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,155 @@
/*****************************************************************************
* 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 "../interface/widget.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../peep/peep.h"
#include "../peep/staff.h"
#include "../sprites.h"
#include "../world/sprite.h"
#define WW 200
#define WH 100
enum WINDOW_STAFF_FIRE_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
WIDX_YES,
WIDX_CANCEL
};
// 0x9AFB4C
static rct_widget window_staff_fire_widgets[] = {
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE },
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_SACK_STAFF, STR_WINDOW_TITLE_TIP },
{ WWT_CLOSEBOX, 0, WW-13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP },
{ WWT_DROPDOWN_BUTTON, 0, 10, 94, WH - 20, WH - 9, STR_YES, STR_NONE },
{ WWT_DROPDOWN_BUTTON, 0, WW - 95, WW - 11, WH - 20, WH - 9, STR_SAVE_PROMPT_CANCEL, STR_NONE },
{ WIDGETS_END }
};
static void window_staff_fire_emptysub(){}
static void window_staff_fire_mouseup();
static void window_staff_fire_paint();
//0x9A3F7C
static void* window_staff_fire_events[] = {
window_staff_fire_emptysub,
window_staff_fire_mouseup,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_emptysub,
window_staff_fire_paint,
window_staff_fire_emptysub
};
/** Based off of rct2: 0x6C0A77 */
void window_staff_fire_prompt_open(rct_peep* peep){
// Check if the confirm window already exists.
if (window_bring_to_front_by_id(WC_FIRE_PROMPT, peep->sprite_index)) {
return;
}
// Find center of the screen.
int screen_height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16);
int screen_width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16);
int x = screen_width / 2 - WW / 2;
int y = screen_height / 2 - WH / 2;
rct_window* w = window_create(x, y, WW, WH, (uint32*)0x992C3C, 0x1A, 0);
w->widgets = window_staff_fire_widgets;
w->enabled_widgets |= (1 << WIDX_CLOSE) | (1 << WIDX_YES) | (1 << WIDX_CANCEL);
window_init_scroll_widgets(w);
w->flags |= WF_TRANSPARENT;
w->number = peep->sprite_index;
w->colours[0] = 0x9A;
}
/**
*
* rct2: 0x006C0B40
*/
static void window_staff_fire_mouseup(){
short widgetIndex;
rct_window *w;
window_widget_get_registers(w, widgetIndex);
rct_peep* peep = &g_sprite_list[w->number].peep;
switch (widgetIndex){
case WIDX_YES:
game_do_command(peep->x, 1, peep->y, w->number, GAME_COMMAND_FIRE_STAFF_MEMBER, 0, 0);
break;
case WIDX_CANCEL:
case WIDX_CLOSE:
window_close(w);
}
}
/**
*
* rct2: 0x006C0AF2
*/
static void window_staff_fire_paint(){
rct_window *w;
rct_drawpixelinfo *dpi;
window_paint_get_registers(w, dpi);
window_draw_widgets(w, dpi);
rct_peep* peep = &g_sprite_list[w->number].peep;
RCT2_GLOBAL(0x13CE952, uint16) = peep->name_string_idx;
RCT2_GLOBAL(0x13CE954, uint32) = peep->id;
int x = w->x + WW / 2;
int y = w->y + (WH / 2) - 3;
gfx_draw_string_centred_wrapped(dpi, (void*)0x13CE952, x, y, WW - 4, STR_FIRE_STAFF_ID, 0);
}

View File

@ -432,4 +432,27 @@ void sub_6A876D()
static void sub_6A87BB(int x, int y)
{
RCT2_CALLPROC_X(0x006A87BB, x, 0, y, 0, 0, 0, 0);
}
/* rct2: 0x664F72 */
int sub_664F72(int x, int y, int z){
if (x > 0x1FFF || y > 0x1FFF){
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1;
return 1;
}
rct_map_element* map_element = map_get_surface_element_at(x / 32, y / 32);
if (map_element->properties.surface.ownership & 0x20) return 0;
if (!(map_element->properties.surface.ownership & 0x10)){
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1;
return 1;
}
z >>= 3;
if ((z & 0xFF) < map_element->base_height)return 0;
z = (z & 0xFF) - 2;
if (z > map_element->base_height)return 0;
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1;
return 1;
}

View File

@ -205,6 +205,7 @@ void sub_68B089();
int map_coord_is_connected(uint16 coordinate, uint8 height, uint8 face_direction);
void map_invalidate_animations();
void sub_6A876D();
int sub_664F72(int x, int y, int z);
void fountain_update_all();

View File

@ -117,6 +117,8 @@ typedef struct {
uint8 entry_count; // 0x106
uint8 pad_107;
uint8 var_108; // 0x108, order?
uint8 pad_109;
uint32 var_10A;
} rct_scenery_set_entry;
#define g_smallSceneryEntries RCT2_ADDRESS(RCT2_ADDRESS_SMALL_SCENERY_ENTRIES, rct_scenery_entry*)