mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #5113 from IntelOrca/feature/random-entertainer-skin
Set hired entertainers to a random costume.
This commit is contained in:
commit
7eac99c9f0
|
@ -1,12 +1,13 @@
|
|||
0.0.6 (in development)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: Allow entertainers' costume changes even in absence of required scenery
|
||||
- Feature: FreeBSD support
|
||||
- Feature: Allow loading of parks from URLs
|
||||
- Feature: Add boosters (from RCT1 and RCTC) [#4963]
|
||||
- Feature: Add paint Z clipping [#4673]
|
||||
- Improved: Checksum calculations speeded up
|
||||
- Improved: Pathfinding [#4847]
|
||||
- Feature: [#3355] Allow loading of parks from URLs.
|
||||
- Feature: [#4673] Add paint Z clipping.
|
||||
- Feature: [#4901] Allow entertainers' costume changes even in absence of required scenery.
|
||||
- Feature: [#4916] FreeBSD support.
|
||||
- Feature: [#4963] Add boosters (from RCT1 and RCTC).
|
||||
- Feature: [#5113] Entertainers are now hired with a random costume.
|
||||
- Improved: [#4847] Guest / staff pathfinding.
|
||||
- Improved: [#4938] Checksum calculations speeded up.
|
||||
- Improved: Guests and staff are now imported when loading SC4 / SV4 parks.
|
||||
- Fix: [#4571] Only start autosave timer after update or game command.
|
||||
- Fix: [#4584] Junior Coaster diagonal flat-to-steep slopes not drawn.
|
||||
|
@ -15,6 +16,7 @@
|
|||
- Fix: [#4951] Scenarios are not recorded as completed from a saved game.
|
||||
- Fix: [#4968] Completing a scenario does not save the name that is entered.
|
||||
- Fix: [#4996] Objects unloaded after loading landscape.
|
||||
- Fix: [#5114] Some entertainer costumes never select-able.
|
||||
|
||||
0.0.5 (2016-12-27)
|
||||
------------------------------------------------------------------------
|
||||
|
|
|
@ -54,7 +54,7 @@ extern "C" {
|
|||
// This define specifies which version of network stream current build uses.
|
||||
// It is used for making sure only compatible builds get connected, even within
|
||||
// single OpenRCT2 version.
|
||||
#define NETWORK_STREAM_VERSION "30"
|
||||
#define NETWORK_STREAM_VERSION "31"
|
||||
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -16,16 +16,17 @@
|
|||
|
||||
#include "../config.h"
|
||||
#include "../game.h"
|
||||
#include "../scenario/scenario.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../localisation/date.h"
|
||||
#include "../localisation/string_ids.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../localisation/string_ids.h"
|
||||
#include "../management/finance.h"
|
||||
#include "../network/network.h"
|
||||
#include "../scenario/scenario.h"
|
||||
#include "../util/util.h"
|
||||
#include "../world/sprite.h"
|
||||
#include "../world/footpath.h"
|
||||
#include "../world/scenery.h"
|
||||
#include "../world/sprite.h"
|
||||
#include "peep.h"
|
||||
#include "staff.h"
|
||||
|
||||
|
@ -163,12 +164,26 @@ static money32 staff_hire_new_staff_member(uint8 staff_type, uint8 flags, sint16
|
|||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (staff_type != STAFF_TYPE_HANDYMAN &&
|
||||
staff_type != STAFF_TYPE_MECHANIC &&
|
||||
staff_type != STAFF_TYPE_SECURITY &&
|
||||
staff_type != STAFF_TYPE_ENTERTAINER)
|
||||
// Staff type matches STAFF_TYPE enum, but ENTERTAINER onwards will match
|
||||
// the ENTERTAINER_COSTUME enum
|
||||
uint8 entertainerType = ENTERTAINER_COSTUME_PANDA;
|
||||
if (staff_type >= STAFF_TYPE_ENTERTAINER)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
entertainerType = staff_type - STAFF_TYPE_ENTERTAINER;
|
||||
if (entertainerType >= ENTERTAINER_COSTUME_COUNT)
|
||||
{
|
||||
// Invalid entertainer costume
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
uint32 availableCostumes = staff_get_available_entertainer_costumes();
|
||||
if (!(availableCostumes & (1 << entertainerType)))
|
||||
{
|
||||
// Entertainer costume unavailable
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
staff_type = STAFF_TYPE_ENTERTAINER;
|
||||
}
|
||||
|
||||
sint32 i;
|
||||
|
@ -264,6 +279,10 @@ static money32 staff_hire_new_staff_member(uint8 staff_type, uint8 flags, sint16
|
|||
};
|
||||
|
||||
uint8 sprite_type = spriteTypes[staff_type];
|
||||
if (staff_type == STAFF_TYPE_ENTERTAINER)
|
||||
{
|
||||
sprite_type = PEEP_SPRITE_TYPE_ENTERTAINER_PANDA + entertainerType;
|
||||
}
|
||||
newPeep->name_string_idx = staffNames[staff_type];
|
||||
newPeep->sprite_type = sprite_type;
|
||||
|
||||
|
@ -1404,3 +1423,33 @@ bool staff_set_colour(uint8 staffType, colour_t value)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 staff_get_available_entertainer_costumes()
|
||||
{
|
||||
init_scenery();
|
||||
|
||||
uint32 entertainerCostumes = 0;
|
||||
for (sint32 i = 0; i < 19; i++) {
|
||||
if (window_scenery_tab_entries[i][0] != -1) {
|
||||
rct_scenery_set_entry* scenery_entry = get_scenery_group_entry(i);
|
||||
entertainerCostumes |= scenery_entry->entertainer_costumes;
|
||||
}
|
||||
}
|
||||
|
||||
// For some reason the flags are +4 from the actual costume IDs
|
||||
entertainerCostumes >>= 4;
|
||||
|
||||
return entertainerCostumes;
|
||||
}
|
||||
|
||||
sint32 staff_get_available_entertainer_costume_list(uint8 * costumeList)
|
||||
{
|
||||
uint32 availableCostumes = staff_get_available_entertainer_costumes();
|
||||
sint32 numCostumes = 0;
|
||||
for (uint8 i = 0; i < ENTERTAINER_COSTUME_COUNT; i++) {
|
||||
if (availableCostumes & (1 << i)) {
|
||||
costumeList[numCostumes++] = i;
|
||||
}
|
||||
}
|
||||
return numCostumes;
|
||||
}
|
||||
|
|
|
@ -88,5 +88,7 @@ void staff_set_patrol_area(sint32 staffIndex, sint32 x, sint32 y, bool value);
|
|||
void staff_toggle_patrol_area(sint32 staffIndex, sint32 x, sint32 y);
|
||||
colour_t staff_get_colour(uint8 staffType);
|
||||
bool staff_set_colour(uint8 staffType, colour_t value);
|
||||
uint32 staff_get_available_entertainer_costumes();
|
||||
sint32 staff_get_available_entertainer_costume_list(uint8 * costumeList);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1296,32 +1296,13 @@ void window_staff_options_mousedown(sint32 widgetIndex, rct_window* w, rct_widge
|
|||
return;
|
||||
}
|
||||
|
||||
init_scenery();
|
||||
|
||||
uint32 entertainerCostumes = 0;
|
||||
for (sint32 i = 0; i < 19; i++) {
|
||||
if (window_scenery_tab_entries[i][0] != -1) {
|
||||
rct_scenery_set_entry* scenery_entry = get_scenery_group_entry(i);
|
||||
entertainerCostumes |= scenery_entry->entertainer_costumes;
|
||||
}
|
||||
}
|
||||
|
||||
uint8 *costumep = _availableCostumes;
|
||||
uint16 numCostumes = 0;
|
||||
for (uint8 i = 0; i < ENTERTAINER_COSTUME_COUNT; i++) {
|
||||
if (entertainerCostumes & (1 << i)) {
|
||||
// For some reason the flags are +4 from the actual costume IDs
|
||||
*costumep++ = (i - 4);
|
||||
numCostumes++;
|
||||
}
|
||||
}
|
||||
|
||||
rct_peep* peep = GET_PEEP(w->number);
|
||||
sint32 itemsChecked = 0;
|
||||
//This will be moved below where Items Checked is when all
|
||||
//of dropdown related functions are finished. This prevents
|
||||
//the dropdown from not working on first click.
|
||||
for (sint32 i = 0; i < numCostumes; ++i){
|
||||
sint32 numCostumes = staff_get_available_entertainer_costume_list(_availableCostumes);
|
||||
for (sint32 i = 0; i < numCostumes; i++) {
|
||||
uint8 costume = _availableCostumes[i];
|
||||
if (costume == peep->sprite_type) {
|
||||
itemsChecked = 1 << i;
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
#pragma endregion
|
||||
|
||||
#include "../config.h"
|
||||
#include "../game.h"
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../interface/themes.h"
|
||||
#include "../interface/viewport.h"
|
||||
|
@ -27,6 +27,7 @@
|
|||
#include "../peep/staff.h"
|
||||
#include "../rct2.h"
|
||||
#include "../sprites.h"
|
||||
#include "../util/util.h"
|
||||
#include "../world/footpath.h"
|
||||
#include "../world/sprite.h"
|
||||
#include "dropdown.h"
|
||||
|
@ -132,6 +133,8 @@ static uint16 _window_staff_list_selected_type_count = 0;
|
|||
static sint32 _windowStaffListHighlightedIndex;
|
||||
static sint32 _windowStaffListSelectedTab;
|
||||
|
||||
static uint8 window_staff_list_get_random_entertainer_costume();
|
||||
|
||||
typedef struct staff_naming_convention
|
||||
{
|
||||
rct_string_id plural;
|
||||
|
@ -217,8 +220,16 @@ static void window_staff_list_mouseup(rct_window *w, sint32 widgetIndex)
|
|||
window_close(w);
|
||||
break;
|
||||
case WIDX_STAFF_LIST_HIRE_BUTTON:
|
||||
hire_new_staff_member(_windowStaffListSelectedTab);
|
||||
{
|
||||
sint32 staffType = _windowStaffListSelectedTab;
|
||||
if (staffType == STAFF_TYPE_ENTERTAINER)
|
||||
{
|
||||
uint8 costume = window_staff_list_get_random_entertainer_costume();
|
||||
staffType += costume;
|
||||
}
|
||||
hire_new_staff_member(staffType);
|
||||
break;
|
||||
}
|
||||
case WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON:
|
||||
if (!tool_set(w, WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON, 12)) {
|
||||
show_gridlines();
|
||||
|
@ -693,3 +704,16 @@ void window_staff_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint8 window_staff_list_get_random_entertainer_costume()
|
||||
{
|
||||
uint8 result = ENTERTAINER_COSTUME_PANDA;
|
||||
uint8 costumeList[ENTERTAINER_COSTUME_COUNT];
|
||||
sint32 numCostumes = staff_get_available_entertainer_costume_list(costumeList);
|
||||
if (numCostumes > 0)
|
||||
{
|
||||
sint32 index = util_rand() % numCostumes;
|
||||
result = costumeList[index];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue