mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-26 00:04:43 +01:00
Implement game action for sign naming.
This commit is contained in:
@@ -4250,75 +4250,6 @@ void map_clear_all_elements()
|
||||
}
|
||||
}
|
||||
|
||||
void game_command_set_sign_name(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp) {
|
||||
static char newName[128];
|
||||
|
||||
if ((*ecx >= MAX_BANNERS) || (*ecx < 0))
|
||||
{
|
||||
log_warning("Invalid game command for setting sign name, banner id = %d", *ecx);
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
rct_banner* banner = &gBanners[*ecx];
|
||||
sint32 x = banner->x << 5;
|
||||
sint32 y = banner->y << 5;
|
||||
|
||||
sint32 nameChunkIndex = *eax & 0xFFFF;
|
||||
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_RUNNING_COSTS;
|
||||
sint32 nameChunkOffset = nameChunkIndex - 1;
|
||||
if (nameChunkOffset < 0)
|
||||
nameChunkOffset = 2;
|
||||
nameChunkOffset *= 12;
|
||||
nameChunkOffset = std::min(nameChunkOffset, (sint32)Util::CountOf(newName) - 12);
|
||||
memcpy(newName + nameChunkOffset + 0, edx, 4);
|
||||
memcpy(newName + nameChunkOffset + 4, ebp, 4);
|
||||
memcpy(newName + nameChunkOffset + 8, edi, 4);
|
||||
|
||||
if (nameChunkIndex != 0) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(*ebx & GAME_COMMAND_FLAG_APPLY)) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (newName[0] != 0) {
|
||||
rct_string_id string_id = user_string_allocate(USER_STRING_DUPLICATION_PERMITTED, newName);
|
||||
if (string_id != 0) {
|
||||
rct_string_id prev_string_id = banner->string_idx;
|
||||
banner->string_idx = string_id;
|
||||
user_string_free(prev_string_id);
|
||||
|
||||
banner->flags &= ~(BANNER_FLAG_LINKED_TO_RIDE);
|
||||
gfx_invalidate_screen();
|
||||
} else {
|
||||
gGameCommandErrorText = STR_ERR_CANT_SET_BANNER_TEXT;
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
sint32 rideIndex = banner_get_closest_ride_index(x, y, 16);
|
||||
if (rideIndex == -1) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
banner->colour = rideIndex;
|
||||
banner->flags |= BANNER_FLAG_LINKED_TO_RIDE;
|
||||
|
||||
rct_string_id prev_string_id = banner->string_idx;
|
||||
banner->string_idx = STR_DEFAULT_SIGN;
|
||||
user_string_free(prev_string_id);
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
|
||||
*ebx = 0;
|
||||
}
|
||||
|
||||
void game_command_set_sign_style(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp) {
|
||||
uint8 bannerId = *ecx & 0xFF;
|
||||
if (bannerId > Util::CountOf(gBanners)) {
|
||||
|
||||
Reference in New Issue
Block a user