mirror of https://github.com/OpenRCT2/OpenRCT2.git
Pick random entertainer costume
This commit is contained in:
parent
2900f38cc3
commit
c699c91348
|
@ -16,16 +16,17 @@
|
||||||
|
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#include "../game.h"
|
#include "../game.h"
|
||||||
#include "../scenario/scenario.h"
|
|
||||||
#include "../interface/viewport.h"
|
#include "../interface/viewport.h"
|
||||||
#include "../localisation/date.h"
|
#include "../localisation/date.h"
|
||||||
#include "../localisation/string_ids.h"
|
|
||||||
#include "../localisation/localisation.h"
|
#include "../localisation/localisation.h"
|
||||||
|
#include "../localisation/string_ids.h"
|
||||||
#include "../management/finance.h"
|
#include "../management/finance.h"
|
||||||
#include "../network/network.h"
|
#include "../network/network.h"
|
||||||
|
#include "../scenario/scenario.h"
|
||||||
#include "../util/util.h"
|
#include "../util/util.h"
|
||||||
#include "../world/sprite.h"
|
|
||||||
#include "../world/footpath.h"
|
#include "../world/footpath.h"
|
||||||
|
#include "../world/scenery.h"
|
||||||
|
#include "../world/sprite.h"
|
||||||
#include "peep.h"
|
#include "peep.h"
|
||||||
#include "staff.h"
|
#include "staff.h"
|
||||||
|
|
||||||
|
@ -174,6 +175,14 @@ static money32 staff_hire_new_staff_member(uint8 staff_type, uint8 flags, sint16
|
||||||
// Invalid entertainer costume
|
// Invalid entertainer costume
|
||||||
return MONEY32_UNDEFINED;
|
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;
|
staff_type = STAFF_TYPE_ENTERTAINER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1414,3 +1423,33 @@ bool staff_set_colour(uint8 staffType, colour_t value)
|
||||||
}
|
}
|
||||||
return true;
|
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);
|
void staff_toggle_patrol_area(sint32 staffIndex, sint32 x, sint32 y);
|
||||||
colour_t staff_get_colour(uint8 staffType);
|
colour_t staff_get_colour(uint8 staffType);
|
||||||
bool staff_set_colour(uint8 staffType, colour_t value);
|
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
|
#endif
|
||||||
|
|
|
@ -1296,32 +1296,13 @@ void window_staff_options_mousedown(sint32 widgetIndex, rct_window* w, rct_widge
|
||||||
return;
|
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);
|
rct_peep* peep = GET_PEEP(w->number);
|
||||||
sint32 itemsChecked = 0;
|
sint32 itemsChecked = 0;
|
||||||
//This will be moved below where Items Checked is when all
|
//This will be moved below where Items Checked is when all
|
||||||
//of dropdown related functions are finished. This prevents
|
//of dropdown related functions are finished. This prevents
|
||||||
//the dropdown from not working on first click.
|
//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];
|
uint8 costume = _availableCostumes[i];
|
||||||
if (costume == peep->sprite_type) {
|
if (costume == peep->sprite_type) {
|
||||||
itemsChecked = 1 << i;
|
itemsChecked = 1 << i;
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#include "../game.h"
|
|
||||||
#include "../drawing/drawing.h"
|
#include "../drawing/drawing.h"
|
||||||
|
#include "../game.h"
|
||||||
#include "../input.h"
|
#include "../input.h"
|
||||||
#include "../interface/themes.h"
|
#include "../interface/themes.h"
|
||||||
#include "../interface/viewport.h"
|
#include "../interface/viewport.h"
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
#include "../peep/staff.h"
|
#include "../peep/staff.h"
|
||||||
#include "../rct2.h"
|
#include "../rct2.h"
|
||||||
#include "../sprites.h"
|
#include "../sprites.h"
|
||||||
|
#include "../util/util.h"
|
||||||
#include "../world/footpath.h"
|
#include "../world/footpath.h"
|
||||||
#include "../world/sprite.h"
|
#include "../world/sprite.h"
|
||||||
#include "dropdown.h"
|
#include "dropdown.h"
|
||||||
|
@ -706,5 +707,12 @@ void window_staff_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32
|
||||||
|
|
||||||
static uint8 window_staff_list_get_random_entertainer_costume()
|
static uint8 window_staff_list_get_random_entertainer_costume()
|
||||||
{
|
{
|
||||||
return ENTERTAINER_COSTUME_PANDA;
|
uint8 result = ENTERTAINER_COSTUME_PANDA;
|
||||||
|
uint8 costumeList[ENTERTAINER_COSTUME_COUNT];
|
||||||
|
sint32 numCostumes = staff_get_available_entertainer_costume_list(costumeList);
|
||||||
|
if (numCostumes > 0)
|
||||||
|
{
|
||||||
|
result = util_rand() % numCostumes;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue