1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 03:53:07 +01:00

Integrate gClearSceneryCost and gLandRightsCost

This commit is contained in:
Ted John
2016-09-10 12:28:01 +01:00
parent b1e9810ec6
commit d0950af9df
8 changed files with 32 additions and 18 deletions

View File

@@ -15,13 +15,14 @@
#pragma endregion
#include "../addresses.h"
#include "../world/map.h"
#include "../input.h"
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../interface/themes.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../interface/themes.h"
#include "../world/map.h"
#include "../world/scenery.h"
#define MINIMUM_TOOL_SIZE 1
#define MAXIMUM_TOOL_SIZE 64
@@ -111,7 +112,7 @@ void window_clear_scenery_open()
window_init_scroll_widgets(window);
window_push_others_below(window);
RCT2_GLOBAL(0x00F1AD62, uint32) = MONEY32_UNDEFINED;
gClearSceneryCost = MONEY32_UNDEFINED;
gClearSmallScenery = true;
gClearLargeScenery = false;
@@ -245,8 +246,11 @@ static void window_clear_scenery_paint(rct_window *w, rct_drawpixelinfo *dpi)
// Draw cost amount
x = (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2 + w->x;
y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + w->y + 5 + 27;
if (RCT2_GLOBAL(0x00F1AD62, uint32) != MONEY32_UNDEFINED && RCT2_GLOBAL(0x00F1AD62, uint32) != 0)
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, 0, RCT2_ADDRESS(0x00F1AD62, void));
if (gClearSceneryCost != MONEY32_UNDEFINED &&
gClearSceneryCost != 0
) {
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, 0, &gClearSceneryCost);
}
}
/**

View File

@@ -228,8 +228,11 @@ static void window_land_rights_paint(rct_window *w, rct_drawpixelinfo *dpi)
// Draw cost amount
x = (window_land_rights_widgets[WIDX_PREVIEW].left + window_land_rights_widgets[WIDX_PREVIEW].right) / 2 + w->x;
y = window_land_rights_widgets[WIDX_PREVIEW].bottom + w->y + 32;
if (RCT2_GLOBAL(0x00F1AD62, uint32) != MONEY32_UNDEFINED && RCT2_GLOBAL(0x00F1AD62, uint32) != 0)
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, 0, RCT2_ADDRESS(0x00F1AD62, void));
if (gLandRightsCost != MONEY32_UNDEFINED &&
gLandRightsCost != 0
) {
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, 0, &gLandRightsCost);
}
}
static int window_land_rights_should_close()

View File

@@ -760,8 +760,8 @@ static void window_park_entrance_tool_update_land_rights(sint16 x, sint16 y)
screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, NULL);
if (mapTile.x == (sint16)0x8000){
if (RCT2_GLOBAL(0x00F1AD62, money32) != MONEY32_UNDEFINED){
RCT2_GLOBAL(0x00F1AD62, money32) = MONEY32_UNDEFINED;
if (gLandRightsCost != MONEY32_UNDEFINED) {
gLandRightsCost = MONEY32_UNDEFINED;
window_invalidate_by_class(WC_CLEAR_SCENERY);
}
return;
@@ -818,7 +818,7 @@ static void window_park_entrance_tool_update_land_rights(sint16 x, sint16 y)
if (!state_changed)
return;
RCT2_GLOBAL(0x00F1AD62, uint32) = game_do_command(
gLandRightsCost = game_do_command(
gMapSelectPositionA.x,
0x4,
gMapSelectPositionA.y,
@@ -826,7 +826,7 @@ static void window_park_entrance_tool_update_land_rights(sint16 x, sint16 y)
GAME_COMMAND_BUY_LAND_RIGHTS,
gMapSelectPositionB.x,
gMapSelectPositionB.y
);
);
}
/**

View File

@@ -1660,8 +1660,8 @@ static void top_toolbar_tool_update_scenery_clear(sint16 x, sint16 y){
screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, NULL);
if (mapTile.x == (sint16)0x8000){
if (RCT2_GLOBAL(0x00F1AD62, money32) != MONEY32_UNDEFINED){
RCT2_GLOBAL(0x00F1AD62, money32) = MONEY32_UNDEFINED;
if (gClearSceneryCost != MONEY32_UNDEFINED) {
gClearSceneryCost = MONEY32_UNDEFINED;
window_invalidate_by_class(WC_CLEAR_SCENERY);
}
return;
@@ -1722,10 +1722,11 @@ static void top_toolbar_tool_update_scenery_clear(sint16 x, sint16 y){
int ecx = gMapSelectPositionA.y;
int edi = gMapSelectPositionB.x;
int ebp = gMapSelectPositionB.y;
money32 cost = game_do_command(eax, 0, ecx, 0, GAME_COMMAND_CLEAR_SCENERY, edi, ebp);
int clear = (gClearSmallScenery << 0) | (gClearLargeScenery << 1) | (gClearFootpath << 2);
money32 cost = game_do_command(eax, 0, ecx, clear, GAME_COMMAND_CLEAR_SCENERY, edi, ebp);
if (RCT2_GLOBAL(0x00F1AD62, money32) != cost){
RCT2_GLOBAL(0x00F1AD62, money32) = cost;
if (gClearSceneryCost != cost) {
gClearSceneryCost = cost;
window_invalidate_by_class(WC_CLEAR_SCENERY);
return;
}
@@ -1739,8 +1740,8 @@ static void top_toolbar_tool_update_land_paint(sint16 x, sint16 y){
screen_get_map_xy(x, y, &mapTile.x, &mapTile.y, NULL);
if (mapTile.x == (sint16)0x8000){
if (RCT2_GLOBAL(0x00F1AD62, money32) != MONEY32_UNDEFINED){
RCT2_GLOBAL(0x00F1AD62, money32) = MONEY32_UNDEFINED;
if (gClearSceneryCost != MONEY32_UNDEFINED) {
gClearSceneryCost = MONEY32_UNDEFINED;
window_invalidate_by_class(WC_CLEAR_SCENERY);
}
return;

View File

@@ -114,6 +114,7 @@ uint8 gLandToolTerrainSurface;
uint8 gLandToolTerrainEdge;
money32 gWaterToolRaiseCost;
money32 gWaterToolLowerCost;
money32 gLandRightsCost;
rct_xyz16 gCommandPosition;

View File

@@ -373,6 +373,7 @@ extern uint8 gLandToolTerrainSurface;
extern uint8 gLandToolTerrainEdge;
extern money32 gWaterToolRaiseCost;
extern money32 gWaterToolLowerCost;
extern money32 gLandRightsCost;
extern rct_xyz16 gCommandPosition;

View File

@@ -61,6 +61,8 @@ sint16 gSceneryCtrlPressZ;
uint8 gSceneryGroundFlags;
money32 gClearSceneryCost;
// rct2: 0x009A3E74
const rct_xy8 ScenerySubTileOffsets[] = {
{ 7, 7 },

View File

@@ -248,6 +248,8 @@ extern const rct_xy8 ScenerySubTileOffsets[];
extern sint16 window_scenery_tab_entries[20][SCENERY_ENTRIES_BY_TAB + 1];
extern money32 gClearSceneryCost;
void init_scenery();
void scenery_update_tile(int x, int y);
void scenery_update_age(int x, int y, rct_map_element *mapElement);