Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved tile inspector and added map element helper functions #2590

Merged
merged 22 commits into from
Jan 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
855e122
Printing path and addition names in tile inspector.
Broxzier Dec 2, 2015
955bf7b
Displaying more path info for queue. Added some helper functions.
Broxzier Dec 3, 2015
370c08f
Added comments to path info
Broxzier Dec 3, 2015
b82504c
Better consistensy with already existing helper functions
Broxzier Dec 3, 2015
6f0d14b
Using ghost helper funcitons for getting and setting the bit now.
Broxzier Dec 4, 2015
f04c97f
Getting path scenery type and index using helper functions throughout…
Broxzier Dec 4, 2015
35bf18b
Added empty button that swaps the top two map elements
Broxzier Dec 20, 2015
d68ed36
Recreated UI for tile inspector. Added swap functionality.
Broxzier Dec 28, 2015
d226012
Function to remove elements using the tile inspector.
Broxzier Dec 29, 2015
2a3aefd
fixed list issue after removing element.
Broxzier Dec 29, 2015
db270d8
automatically en/disabling buttons when needed. Selecting corrupt ele…
Broxzier Dec 29, 2015
6431295
Added column headers instead of labels, and added columns for the flags.
Broxzier Dec 29, 2015
38867b7
Fixed old typo in string ID name.
Broxzier Dec 29, 2015
6f824c9
Resolved warnings.
Broxzier Dec 29, 2015
389249a
Better UI spacing.
Broxzier Dec 29, 2015
05e807a
Displayng ride type for tracks
Broxzier Dec 29, 2015
2b7a882
Moved some UI elements and changed default size. Updated changelog.
Broxzier Dec 30, 2015
a1f506d
Fix all buttons after deleting a map element.
Broxzier Jan 1, 2016
ae4ff5f
Redesigned UI to be more consistent with the ride/staff windows.
Broxzier Jan 1, 2016
bf7e459
Pixel correct paddings for list and column headers
Broxzier Jan 1, 2016
829c3a3
Added correct tooltips for moving up/down buttons.
Broxzier Jan 1, 2016
560a435
Drawing checkmarks for set flags
Broxzier Jan 1, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions data/language/english_uk.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3677,8 +3677,8 @@ STR_5335 :Ride entrance
STR_5336 :Ride exit
STR_5337 :Park entrance
STR_5338 :Element type
STR_5339 :Base height
STR_5340 :Clearance height
STR_5339 :{SMALLFONT}{BLACK}Base height
STR_5340 :{SMALLFONT}{BLACK}Clearance height
STR_5341 :Flags
STR_5342 :Choose a map tile
STR_5343 :Automatically place staff
Expand Down Expand Up @@ -3945,6 +3945,18 @@ STR_5603 :Guest has left ride
STR_5604 :Guest has bought item
STR_5605 :Guest has used facility
STR_5606 :Guest has died
STR_5607 :{SMALLFONT}{BLACK}Forcefully remove selected map element.
STR_5608 :BH
STR_5609 :CH
STR_5610 :{SMALLFONT}{BLACK}Remove the currently selected map element. This will forcefully remove it, so no cash will be used/gained. Use with caution.
STR_5611 :G
STR_5612 :{SMALLFONT}{BLACK}Ghost flag
STR_5613 :B
STR_5614 :{SMALLFONT}{BLACK}Broken flag
STR_5615 :L
STR_5616 :{SMALLFONT}{BLACK}Last element for tile flag
STR_5617 :{SMALLFONT}{BLACK}Move selected element up.
STR_5618 :{SMALLFONT}{BLACK}Move selected element down.

#####################
# Rides/attractions #
Expand Down
1 change: 1 addition & 0 deletions distribution/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Feature: Add SI units as a new measurement system for distance / speed.
- Feature: Update alternative font selection mechanism for all platforms.
- Feature: Allow enabling / disabling of different notifications.
- Feature: Improved tile inspector.
- Fix: [#2126] Ferris Wheels set to "backward rotation" stop working (original bug)
- Fix: [#2449] Turning off Day/Night Circle while it is night doesn't reset back to day

Expand Down
2 changes: 1 addition & 1 deletion src/interface/viewport_interaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info
return info->type;

case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM:
sceneryEntry = g_pathBitSceneryEntries[(mapElement->properties.path.additions & 0x0F) - 1];
sceneryEntry = g_pathBitSceneryEntries[footpath_element_get_path_scenery_index(mapElement)];
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 0, uint16) = 1164;
if (mapElement->flags & 0x20) {
RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = 3124;
Expand Down
10 changes: 9 additions & 1 deletion src/localisation/string_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -2004,9 +2004,17 @@ enum {
STR_TILE_INSPECTOR_ENTRANCE_START = 5335,
STR_TILE_INSPECTOR_ELEMENT_TYPE = 5338,
STR_TILE_INSPECTOR_BASE_HEIGHT = 5339,
STR_TILE_INSPECTOR_CLEARANGE_HEIGHT = 5340,
STR_TILE_INSPECTOR_BASE_HEIGHT_SHORT = 5608,
STR_TILE_INSPECTOR_CLEARANCE_HEIGHT = 5340,
STR_TILE_INSPECTOR_CLEARANGE_HEIGHT_SHORT = 5609,
STR_TILE_INSPECTOR_FLAGS = 5341,
STR_TILE_INSPECTOR_CHOOSE_MSG = 5342,
STR_TILE_INSPECTOR_FLAG_GHOST_SHORT = 5611,
STR_TILE_INSPECTOR_FLAG_GHOST = 5612,
STR_TILE_INSPECTOR_FLAG_BROKEN_SHORT = 5613,
STR_TILE_INSPECTOR_FLAG_BROKEN = 5614,
STR_TILE_INSPECTOR_FLAG_LAST_SHORT = 5615,
STR_TILE_INSPECTOR_FLAG_LAST = 5616,

STR_AUTO_STAFF_PLACEMENT = 5343,

Expand Down
69 changes: 29 additions & 40 deletions src/peep/peep.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ static uint8 peep_assess_surroundings(sint16 center_x, sint16 center_y, sint16 c

switch (map_element_get_type(mapElement)){
case MAP_ELEMENT_TYPE_PATH:
if ((mapElement->properties.path.additions & 0xF) == 0)
if (!footpath_element_has_path_scenery(mapElement))
break;

scenery = g_pathBitSceneryEntries[(mapElement->properties.path.additions & 0x0F) - 1];
if (mapElement->properties.path.additions & (1 << 7))
scenery = g_pathBitSceneryEntries[footpath_element_get_path_scenery_index(mapElement)];
if (footpath_element_path_scenery_is_ghost(mapElement))
break;

if (scenery->path_bit.var_06 &
Expand Down Expand Up @@ -619,9 +619,10 @@ static void sub_68F41A(rct_peep *peep, int index)
if (mapElement->base_height != peep->next_z)
continue;

uint8 additions = mapElement->properties.path.additions & 0xF;
if (additions != 0 && mapElement->properties.path.additions & (1 << 7)){
rct_scenery_entry *sceneryEntry = g_pathBitSceneryEntries[additions - 1];
// Check if the footpath has ghost path scenery on it
if (footpath_element_has_path_scenery(mapElement) && footpath_element_path_scenery_is_ghost(mapElement)){
uint8 pathSceneryIndex = footpath_element_get_path_scenery_index(mapElement);
rct_scenery_entry *sceneryEntry = g_pathBitSceneryEntries[pathSceneryIndex];
if (sceneryEntry->path_bit.var_06 & (1 << 8)){
found = 1;
}
Expand Down Expand Up @@ -3661,16 +3662,16 @@ static void peep_update_emptying_bin(rct_peep* peep){
}
}

if ((map_element->properties.path.additions & 0x0F) == 0) {
if (!footpath_element_has_path_scenery(map_element)) {
peep_state_reset(peep);
return;
}

rct_scenery_entry* scenery_entry = g_pathBitSceneryEntries[(map_element->properties.path.additions & 0xF) - 1];
rct_scenery_entry* scenery_entry = g_pathBitSceneryEntries[footpath_element_get_path_scenery_index(map_element)];
if (
!(scenery_entry->path_bit.var_06 & 1)
|| map_element->flags & (1 << 5)
|| map_element->properties.path.additions & (1 << 7)
|| footpath_element_path_scenery_is_ghost(map_element)
) {
peep_state_reset(peep);
return;
Expand Down Expand Up @@ -3925,16 +3926,14 @@ static int peep_update_walking_find_bench(rct_peep* peep){
}
}

uint8 additions = map_element->properties.path.additions & 0xF;

if (!additions) return 0;
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[additions - 1];
if (!footpath_element_has_path_scenery(map_element)) return 0;
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[footpath_element_get_path_scenery_index(map_element)];

if (!(sceneryEntry->path_bit.var_06 & 0x2))return 0;

if (map_element->flags & MAP_ELEMENT_FLAG_BROKEN)return 0;

if (map_element->properties.path.additions & 0x80)return 0;
if (footpath_element_path_scenery_is_ghost(map_element)) return 0;

int edges = (map_element->properties.path.edges & 0xF) ^ 0xF;
if (edges == 0) return 0;
Expand Down Expand Up @@ -4002,16 +4001,14 @@ static int peep_update_walking_find_bin(rct_peep* peep){
}
}

uint8 additions = map_element->properties.path.additions & 0xF;

if (!additions) return 0;
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[additions - 1];
if (!footpath_element_has_path_scenery(map_element)) return 0;
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[footpath_element_get_path_scenery_index(map_element)];

if (!(sceneryEntry->path_bit.var_06 & 0x1))return 0;

if (map_element->flags & MAP_ELEMENT_FLAG_BROKEN)return 0;

if (map_element->properties.path.additions & 0x80)return 0;
if (footpath_element_path_scenery_is_ghost(map_element)) return 0;

int edges = (map_element->properties.path.edges & 0xF) ^ 0xF;
if (edges == 0) return 0;
Expand Down Expand Up @@ -4085,16 +4082,14 @@ static void peep_update_walking_break_scenery(rct_peep* peep){
}
}

uint8 additions = map_element->properties.path.additions & 0xF;

if (!additions) return;
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[additions - 1];
if (!footpath_element_has_path_scenery(map_element)) return;
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[footpath_element_get_path_scenery_index(map_element)];

if (!(sceneryEntry->path_bit.var_06 & 0x4))return;

if (map_element->flags & MAP_ELEMENT_FLAG_BROKEN)return;

if (map_element->properties.path.additions & 0x80)return;
if (footpath_element_path_scenery_is_ghost(map_element))return;

int edges = map_element->properties.path.edges & 0xF;
if (edges == 0xF) return;
Expand Down Expand Up @@ -4255,13 +4250,12 @@ static void peep_update_using_bin(rct_peep* peep){
}
}

uint8 additions = map_element->properties.path.additions & 0x0F;
if (!additions){
if (!footpath_element_has_path_scenery(map_element)){
peep_state_reset(peep);
return;
}

rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[additions - 1];
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[footpath_element_get_path_scenery_index(map_element)];
if (!(sceneryEntry->path_bit.var_06 & 1)){
peep_state_reset(peep);
return;
Expand All @@ -4272,7 +4266,7 @@ static void peep_update_using_bin(rct_peep* peep){
return;
}

if (map_element->properties.path.additions & 0x80){
if (footpath_element_path_scenery_is_ghost(map_element)){
peep_state_reset(peep);
return;
}
Expand Down Expand Up @@ -4656,19 +4650,16 @@ static int peep_update_patrolling_find_bin(rct_peep* peep){
return 0;
}

uint8 additions = map_element->properties.path.additions & 0xF;

if (additions == 0)return 0;

rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[additions - 1];
if (!footpath_element_has_path_scenery(map_element)) return 0;
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[footpath_element_get_path_scenery_index(map_element)];

if (!(sceneryEntry->path_bit.var_06 & 1))
return 0;

if (map_element->flags & MAP_ELEMENT_FLAG_BROKEN)
return 0;

if (map_element->properties.path.additions & 0x80)
if (footpath_element_path_scenery_is_ghost(map_element))
return 0;

uint8 bin_positions = map_element->properties.path.edges & 0xF;
Expand Down Expand Up @@ -4958,13 +4949,11 @@ static void peep_update_walking(rct_peep* peep){
}
}

uint8 additions = map_element->properties.path.additions & 0xF;

int ebp = 15;

if (additions){
if (!(map_element->properties.path.additions & 0x80)){
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[additions - 1];
if (footpath_element_has_path_scenery(map_element)) {
if (!footpath_element_path_scenery_is_ghost(map_element)) {
rct_scenery_entry* sceneryEntry = g_pathBitSceneryEntries[footpath_element_get_path_scenery_index(map_element)];

if (!(sceneryEntry->path_bit.var_06 & 0x2)) ebp = 9;
}
Expand Down Expand Up @@ -6629,7 +6618,7 @@ static int peep_interact_with_path(rct_peep* peep, sint16 x, sint16 y, rct_map_e

// 0x00F1AEE2
bool vandalism_present = false;
if ((map_element->properties.path.additions & 0xF) != 0 &&
if (footpath_element_has_path_scenery(map_element) &&
(map_element->flags & MAP_ELEMENT_FLAG_BROKEN) &&
(map_element->properties.path.edges & 0xF) != 0xF){
vandalism_present = 1;
Expand Down
13 changes: 6 additions & 7 deletions src/rct1.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,23 +776,22 @@ static void rct1_fix_paths()
mapElement->type &= 0xFC;
mapElement->flags &= ~0x60;
mapElement->properties.path.type &= 0x0F;
mapElement->properties.path.additions &= 0x7F;
footpath_scenery_set_is_ghost(mapElement, false);
if (pathType & 0x80) {
mapElement->type |= 1;
}
mapElement->properties.path.type |= pathType << 4;

// Additions
additions = mapElement->properties.path.additions & 0x0F;
additions = RCT1PathAdditionConversionTable[additions];
if (additions & 0x80) {
additions &= ~0x80;
additions = RCT1PathAdditionConversionTable[footpath_element_get_path_scenery(mapElement)];
if (footpath_element_path_scenery_is_ghost(mapElement)) {
footpath_scenery_set_is_ghost(mapElement, false);
mapElement->flags |= MAP_ELEMENT_FLAG_BROKEN;
} else {
mapElement->flags &= ~MAP_ELEMENT_FLAG_BROKEN;
}
mapElement->properties.path.additions &= 0xF0;
mapElement->properties.path.additions |= additions;

footpath_element_set_path_scenery(mapElement, additions);
break;
case MAP_ELEMENT_TYPE_ENTRANCE:
if (mapElement->properties.entrance.type == ENTRANCE_TYPE_PARK_ENTRANCE) {
Expand Down
6 changes: 3 additions & 3 deletions src/windows/cheats.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ static void cheat_fix_vandalism()
if (map_element_get_type(it.element) != MAP_ELEMENT_TYPE_PATH)
continue;

if ((it.element->properties.path.additions & 0x0F) == 0)
if (!footpath_element_has_path_scenery(it.element))
continue;

it.element->flags &= ~MAP_ELEMENT_FLAG_BROKEN;
Expand Down Expand Up @@ -511,10 +511,10 @@ static void cheat_remove_litter()
if (map_element_get_type(it.element) != MAP_ELEMENT_TYPE_PATH)
continue;

if ((it.element->properties.path.additions & 0x0F) == 0)
if (!footpath_element_has_path_scenery(it.element))
continue;

sceneryEntry = g_pathBitSceneryEntries[(it.element->properties.path.additions & 0xF) - 1];
sceneryEntry = g_pathBitSceneryEntries[footpath_element_get_path_scenery_index(it.element)];
if(sceneryEntry->path_bit.var_06 & (1 << 0))
it.element->properties.path.addition_status = 0xFF;

Expand Down
9 changes: 4 additions & 5 deletions src/windows/editor_object_selection.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "dropdown.h"
#include "error.h"
#include "../util/util.h"
#include "../world/footpath.h"


enum {
Expand Down Expand Up @@ -577,7 +578,6 @@ static void setup_in_use_selection_flags(){
map_element_iterator_begin(&iter);
do {
uint16 type;
uint8 path_additions;
rct_banner* banner;

switch (map_element_get_type(iter.element)) {
Expand All @@ -591,10 +591,9 @@ static void setup_in_use_selection_flags(){
assert(type < object_entry_group_counts[OBJECT_TYPE_PATHS]);
RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_PATHS][type] |= (1 << 0);

path_additions = iter.element->properties.path.additions & 0xF;
if (path_additions){
path_additions--;
RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_PATH_BITS][path_additions] |= (1 << 0);
if (footpath_element_has_path_scenery(iter.element)) {
uint8 path_additions = footpath_element_get_path_scenery_index(iter.element);
RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_PATH_BITS][path_additions] |= 1;
}
break;
case MAP_ELEMENT_TYPE_SCENERY:
Expand Down
Loading