Integrate entertainer costumes

This commit is contained in:
Ted John 2016-09-11 00:40:51 +01:00
parent 65cd3705b1
commit 7edcd11aa7
5 changed files with 41 additions and 23 deletions

View File

@ -44,7 +44,7 @@ void SceneryGroupObject::ReadLegacy(IReadObjectContext * context, IStream * stre
_legacyType.var_107 = stream->ReadValue<uint8>();
_legacyType.var_108 = stream->ReadValue<uint8>();
_legacyType.pad_109 = stream->ReadValue<uint8>();
_legacyType.var_10A = stream->ReadValue<uint32>();
_legacyType.entertainer_costumes = stream->ReadValue<uint32>();
GetStringTable()->Read(context, stream, OBJ_STRING_ID_NAME);
ReadItems(stream);

View File

@ -1321,9 +1321,10 @@ void game_command_set_staff_name(int *eax, int *ebx, int *ecx, int *edx, int *es
colour_t staff_get_colour(uint8 staffType)
{
switch (staffType) {
case STAFF_TYPE_HANDYMAN: return gStaffHandymanColour;
case STAFF_TYPE_MECHANIC: return gStaffMechanicColour;
case STAFF_TYPE_SECURITY: return gStaffSecurityColour;
case STAFF_TYPE_HANDYMAN: return gStaffHandymanColour;
case STAFF_TYPE_MECHANIC: return gStaffMechanicColour;
case STAFF_TYPE_SECURITY: return gStaffSecurityColour;
case STAFF_TYPE_ENTERTAINER: return 0;
default:
assert(false);
return 0;

View File

@ -45,6 +45,21 @@ enum STAFF_ORDERS{
STAFF_ORDERS_FIX_RIDES = (1 << 1)
};
enum ENTERTAINER_COSTUME {
ENTERTAINER_COSTUME_PANDA,
ENTERTAINER_COSTUME_TIGER,
ENTERTAINER_COSTUME_ELEPHANT,
ENTERTAINER_COSTUME_ROMAN,
ENTERTAINER_COSTUME_GORILLA,
ENTERTAINER_COSTUME_SNOWMAN,
ENTERTAINER_COSTUME_KNIGHT,
ENTERTAINER_COSTUME_ASTRONAUT,
ENTERTAINER_COSTUME_BANDIT,
ENTERTAINER_COSTUME_SHERIFF,
ENTERTAINER_COSTUME_PIRATE,
ENTERTAINER_COSTUME_COUNT,
};
extern uint32 gStaffPatrolAreas[204 * 128];
extern uint8 gStaffModes[204];
extern uint16 gStaffDrawPatrolAreas;

View File

@ -14,7 +14,6 @@
*****************************************************************************/
#pragma endregion
#include "../addresses.h"
#include "../config.h"
#include "../game.h"
#include "../interface/viewport.h"
@ -303,6 +302,8 @@ static const uint32 staffCostumeNames[] = {
STR_STAFF_OPTION_COSTUME_PIRATE,
};
static uint8 _availableCostumes[ENTERTAINER_COSTUME_COUNT];
/**
*
* rct2: 0x006BEE98
@ -1334,34 +1335,35 @@ void window_staff_options_mousedown(int widgetIndex, rct_window* w, rct_widget*
init_scenery();
int ebx = 0;
uint32 entertainerCostumes = 0;
for (int i = 0; i < 19; i++) {
if (window_scenery_tab_entries[i][0] != -1) {
rct_scenery_set_entry* scenery_entry = get_scenery_group_entry(i);
ebx |= scenery_entry->var_10A;
entertainerCostumes |= scenery_entry->entertainer_costumes;
}
}
uint8* ebp = RCT2_ADDRESS(0xF4391B, uint8);
uint16 no_entries = 0;
for (uint8 i = 0; i < 32; ++i){
if (ebx & (1 << i)){
*ebp++ = i;
no_entries++;
uint8 *costume = _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
*costume++ = (i - 4);
numCostumes++;
}
}
rct_peep* peep = GET_PEEP(w->number);
int item_checked = 0;
int 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 (int i = 0; i < no_entries; ++i){
int eax = RCT2_ADDRESS(0xF4391B, uint8)[i];
if (eax == peep->sprite_type){
item_checked = 1 << i;
for (int i = 0; i < numCostumes; ++i){
uint8 costume = _availableCostumes[i];
if (costume == peep->sprite_type) {
itemsChecked = 1 << i;
}
gDropdownItemsArgs[i] = staffCostumeNames[eax - 4];
gDropdownItemsArgs[i] = staffCostumeNames[costume];
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
}
@ -1372,10 +1374,10 @@ void window_staff_options_mousedown(int widgetIndex, rct_window* w, rct_widget*
int y = widget->top + w->y;
int extray = widget->bottom - widget->top + 1;
int width = widget->right - widget->left - 3;
window_dropdown_show_text_custom_width(x, y, extray, w->colours[1], DROPDOWN_FLAG_STAY_OPEN, no_entries, width);
window_dropdown_show_text_custom_width(x, y, extray, w->colours[1], DROPDOWN_FLAG_STAY_OPEN, numCostumes, width);
// See above note.
gDropdownItemsChecked = item_checked;
gDropdownItemsChecked = itemsChecked;
}
/**
@ -1392,6 +1394,6 @@ void window_staff_options_dropdown(rct_window *w, int widgetIndex, int dropdownI
return;
rct_peep* peep = GET_PEEP(w->number);
int costume = (RCT2_ADDRESS(0xF4391B, uint8)[dropdownIndex] - 4) | 0x80;
int costume = _availableCostumes[dropdownIndex] | 0x80;
game_do_command(peep->x, (costume << 8) | 1, peep->y, w->number, GAME_COMMAND_SET_STAFF_ORDER, 0, 0);
}

View File

@ -176,7 +176,7 @@ typedef struct rct_scenery_set_entry {
uint8 var_107;
uint8 var_108; // 0x108, order?
uint8 pad_109;
uint32 var_10A;
uint32 entertainer_costumes; // 0x10A
} rct_scenery_set_entry;
assert_struct_size(rct_scenery_set_entry, 14 + 2 * 0x80);
#pragma pack(pop)