1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 00:34:46 +01:00

create_new_banner done by duncanspumpkin

This commit is contained in:
zsilencer
2015-04-23 10:36:31 -06:00
parent a8a434e261
commit 3b416a646e
4 changed files with 44 additions and 8 deletions

View File

@@ -1069,6 +1069,8 @@ enum {
STR_MUSIC_ACKNOWLEDGEMENTS_ELLIPSIS = 2862,
STR_MUSIC_ACKNOWLEDGEMENTS = 2863,
STR_TOO_MANY_BANNERS_IN_GAME = 2980,
STR_CHANGE_BANNER_TEXT_TIP = 2986,
STR_SET_AS_NO_ENTRY_BANNER_TIP = 2987,
STR_DEMOLISH_BANNER_TIP = 2988,

View File

@@ -19,6 +19,8 @@
*****************************************************************************/
#include "../addresses.h"
#include "../game.h"
#include "../localisation/localisation.h"
#include "banner.h"
rct_banner *gBanners = (rct_banner*)0x0135A124;
@@ -32,3 +34,34 @@ void banner_init() {
gBanners[i].type = BANNER_NULL;
}
}
/* rct2: 0x006BA278
* Creates a new banner and returns the index of the banner
* If the flag GAME_COMMAND_FLAG_APPLY is NOT set then returns
* the first unused index but does NOT mark the banner as created.
* returns 0xFF on failure.
*/
int create_new_banner(uint8 flags){
int banner_index = 0;
for (; banner_index < MAX_BANNERS; banner_index++){
if (gBanners[banner_index].type == BANNER_NULL){
break;
}
}
if (banner_index == MAX_BANNERS){
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_TOO_MANY_BANNERS_IN_GAME;
return BANNER_NULL;
}
if (flags & GAME_COMMAND_FLAG_APPLY){
rct_banner* banner = &gBanners[banner_index];
banner->flags = 0;
banner->type = 0;
banner->string_idx = 778;
banner->colour = 2;
banner->text_colour = 2;
}
return banner_index;
}

View File

@@ -44,5 +44,6 @@ enum{
extern rct_banner *gBanners;
void banner_init();
int create_new_banner(uint8 flags);
#endif

View File

@@ -1711,24 +1711,24 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi,
(map_element->properties.banner.position & 0x3) != edge){
map_element++;
if((map_element - 1)->flags & MAP_ELEMENT_FLAG_LAST_TILE){
uint8 a = sub_6BA278(*ebx);
if(a == 0xFF){
int banner_index = create_new_banner(*ebx);
if(banner_index == BANNER_NULL){
*ebx = MONEY32_UNDEFINED;
return;
}
*edi = a;
*edi = banner_index;
if(*ebx & GAME_COMMAND_FLAG_APPLY){
rct_map_element* new_map_element = map_element_insert(x / 32, y / 32, (base_height + 1) * 2, 0);
gBanners[a].type = type;
gBanners[a].colour = colour;
gBanners[a].x = x / 32;
gBanners[a].y = y / 32;
gBanners[banner_index].type = type;
gBanners[banner_index].colour = colour;
gBanners[banner_index].x = x / 32;
gBanners[banner_index].y = y / 32;
new_map_element->type = MAP_ELEMENT_TYPE_BANNER;
new_map_element->clearance_height = new_map_element->base_height + 2;
new_map_element->properties.banner.position = edge;
new_map_element->properties.banner.flags = 0xFF;
new_map_element->properties.banner.unused = 0;
new_map_element->properties.banner.index = a;
new_map_element->properties.banner.index = banner_index;
if(*ebx & 0x40){
new_map_element->flags |= 0x10;
}