mirror of https://github.com/OpenRCT2/OpenRCT2.git
Integrate gEditorSelectedObjects
This commit is contained in:
parent
669396e841
commit
32a6722cda
26
src/editor.c
26
src/editor.c
|
@ -42,6 +42,32 @@
|
|||
#include "world/scenery.h"
|
||||
#include "world/sprite.h"
|
||||
|
||||
uint8 _editorSelectedRides[128];
|
||||
uint8 _editorSelectedSmallScenery[252];
|
||||
uint8 _editorSelectedLargeScenery[128];
|
||||
uint8 _editorSelectedWalls[128];
|
||||
uint8 _editorSelectedBanners[32];
|
||||
uint8 _editorSelectedFootpaths[16];
|
||||
uint8 _editorSelectedFootpathAdditions[15];
|
||||
uint8 _editorSelectedSceneryGroups[19];
|
||||
uint8 _editorSelectedParkEntrances[1];
|
||||
uint8 _editorSelectedWaters[1];
|
||||
uint8 _editorSelectedStexs[1];
|
||||
|
||||
uint8 * gEditorSelectedObjects[OBJECT_ENTRY_GROUP_COUNT] = {
|
||||
_editorSelectedRides,
|
||||
_editorSelectedSmallScenery,
|
||||
_editorSelectedLargeScenery,
|
||||
_editorSelectedWalls,
|
||||
_editorSelectedBanners,
|
||||
_editorSelectedFootpaths,
|
||||
_editorSelectedFootpathAdditions,
|
||||
_editorSelectedSceneryGroups,
|
||||
_editorSelectedParkEntrances,
|
||||
_editorSelectedWaters,
|
||||
_editorSelectedStexs,
|
||||
};
|
||||
|
||||
void editor_convert_save_to_scenario_callback(int result);
|
||||
static void set_all_land_owned();
|
||||
static int editor_load_landscape_from_sv4(const char *path);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#ifndef _EDITOR_H_
|
||||
#define _EDITOR_H_
|
||||
|
||||
#include "object.h"
|
||||
#include "rct2.h"
|
||||
|
||||
typedef enum {
|
||||
|
@ -30,6 +31,8 @@ typedef enum {
|
|||
EDITOR_STEP_TRACK_DESIGNS_MANAGER // 7
|
||||
} RCT2_EDITOR_STEP;
|
||||
|
||||
extern uint8 * gEditorSelectedObjects[OBJECT_ENTRY_GROUP_COUNT];
|
||||
|
||||
void editor_load();
|
||||
void editor_convert_save_to_scenario();
|
||||
void trackdesigner_load();
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "../addresses.h"
|
||||
#include "../cursors.h"
|
||||
#include "../editor.h"
|
||||
#include "../input.h"
|
||||
#include "../interface/themes.h"
|
||||
#include "../interface/widget.h"
|
||||
|
@ -180,7 +181,7 @@ static int research_item_is_always_researched(rct_research_item *researchItem)
|
|||
static void research_rides_setup(){
|
||||
// Reset all objects to not required
|
||||
for (uint8 object_type = OBJECT_TYPE_RIDE; object_type < 11; object_type++){
|
||||
uint8* in_use = RCT2_ADDRESS(0x0098DA38, uint8*)[object_type];
|
||||
uint8* in_use = gEditorSelectedObjects[object_type];
|
||||
for (uint8 num_objects = object_entry_group_counts[object_type]; num_objects != 0; num_objects--){
|
||||
*in_use++ = 0;
|
||||
}
|
||||
|
@ -190,7 +191,7 @@ static void research_rides_setup(){
|
|||
for (uint16 rideIndex = 0; rideIndex < 255; rideIndex++){
|
||||
rct_ride* ride = get_ride(rideIndex);
|
||||
if (ride->type == RIDE_TYPE_NULL)continue;
|
||||
RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_RIDE][ride->subtype] |= 1;
|
||||
gEditorSelectedObjects[OBJECT_TYPE_RIDE][ride->subtype] |= 1;
|
||||
}
|
||||
|
||||
for (rct_research_item* research = gResearchItems; research->entryIndex != RESEARCHED_ITEMS_END; research++){
|
||||
|
@ -218,7 +219,7 @@ static void research_rides_setup(){
|
|||
continue;
|
||||
|
||||
// If master ride not in use
|
||||
if (!(RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_RIDE][rideType] & (1 << 0)))
|
||||
if (!(gEditorSelectedObjects[OBJECT_TYPE_RIDE][rideType] & (1 << 0)))
|
||||
continue;
|
||||
|
||||
if (ride_base_type == master_ride->ride_type[0] ||
|
||||
|
@ -232,7 +233,7 @@ static void research_rides_setup(){
|
|||
|
||||
if (!master_found){
|
||||
// If not in use
|
||||
if (!(RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_RIDE][object_index] & (1 << 0)))
|
||||
if (!(gEditorSelectedObjects[OBJECT_TYPE_RIDE][object_index] & (1 << 0)))
|
||||
continue;
|
||||
if (ride_base_type != ride_entry->ride_type[0] &&
|
||||
ride_base_type != ride_entry->ride_type[1] &&
|
||||
|
|
|
@ -537,14 +537,14 @@ static void setup_in_use_selection_flags()
|
|||
{
|
||||
for (uint8 object_type = 0; object_type < 11; object_type++){
|
||||
for (uint16 i = 0; i < object_entry_group_counts[object_type]; i++){
|
||||
RCT2_ADDRESS(0x0098DA38, uint8*)[object_type][i] = 0;
|
||||
gEditorSelectedObjects[object_type][i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8 object_type = 0; object_type < 11; object_type++){
|
||||
for (uint16 i = 0; i < object_entry_group_counts[object_type]; i++){
|
||||
if (object_entry_groups[object_type].chunks[i] != (uint8*)-1) {
|
||||
RCT2_ADDRESS(0x0098DA38, uint8*)[object_type][i] |= (1 << 1);
|
||||
gEditorSelectedObjects[object_type][i] |= (1 << 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -564,43 +564,43 @@ static void setup_in_use_selection_flags()
|
|||
type = iter.element->properties.path.type;
|
||||
type >>= 4;
|
||||
assert(type < object_entry_group_counts[OBJECT_TYPE_PATHS]);
|
||||
RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_PATHS][type] |= (1 << 0);
|
||||
gEditorSelectedObjects[OBJECT_TYPE_PATHS][type] |= (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;
|
||||
gEditorSelectedObjects[OBJECT_TYPE_PATH_BITS][path_additions] |= 1;
|
||||
}
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY:
|
||||
type = iter.element->properties.scenery.type;
|
||||
assert(type < object_entry_group_counts[OBJECT_TYPE_SMALL_SCENERY]);
|
||||
RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_SMALL_SCENERY][type] |= (1 << 0);
|
||||
gEditorSelectedObjects[OBJECT_TYPE_SMALL_SCENERY][type] |= (1 << 0);
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_ENTRANCE:
|
||||
if (iter.element->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE)
|
||||
break;
|
||||
|
||||
RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_PARK_ENTRANCE][0] |= (1 << 0);
|
||||
gEditorSelectedObjects[OBJECT_TYPE_PARK_ENTRANCE][0] |= (1 << 0);
|
||||
|
||||
type = iter.element->properties.entrance.path_type;
|
||||
assert(type < object_entry_group_counts[OBJECT_TYPE_PATHS]);
|
||||
RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_PATHS][type] |= (1 << 0);
|
||||
gEditorSelectedObjects[OBJECT_TYPE_PATHS][type] |= (1 << 0);
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
type = iter.element->properties.fence.type;
|
||||
assert(type < object_entry_group_counts[OBJECT_TYPE_WALLS]);
|
||||
RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_WALLS][type] |= (1 << 0);
|
||||
gEditorSelectedObjects[OBJECT_TYPE_WALLS][type] |= (1 << 0);
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
||||
type = iter.element->properties.scenerymultiple.type & 0x3FF;
|
||||
assert(type < object_entry_group_counts[OBJECT_TYPE_LARGE_SCENERY]);
|
||||
RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_LARGE_SCENERY][type] |= (1 << 0);
|
||||
gEditorSelectedObjects[OBJECT_TYPE_LARGE_SCENERY][type] |= (1 << 0);
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_BANNER:
|
||||
banner = &gBanners[iter.element->properties.banner.index];
|
||||
type = banner->type;
|
||||
assert(type < object_entry_group_counts[OBJECT_TYPE_BANNERS]);
|
||||
RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_BANNERS][type] |= (1 << 0);
|
||||
gEditorSelectedObjects[OBJECT_TYPE_BANNERS][type] |= (1 << 0);
|
||||
break;
|
||||
}
|
||||
} while (map_element_iterator_next(&iter));
|
||||
|
@ -609,7 +609,7 @@ static void setup_in_use_selection_flags()
|
|||
rct_ride* ride = get_ride(ride_index);
|
||||
if (ride->type != RIDE_TYPE_NULL) {
|
||||
uint8 type = ride->subtype;
|
||||
RCT2_ADDRESS(0x0098DA38, uint8*)[OBJECT_TYPE_RIDE][type] |= (1 << 0);
|
||||
gEditorSelectedObjects[OBJECT_TYPE_RIDE][type] |= (1 << 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -622,12 +622,12 @@ static void setup_in_use_selection_flags()
|
|||
|
||||
uint8 entryType, entryIndex;
|
||||
if (find_object_in_entry_group(&item->ObjectEntry, &entryType, &entryIndex)) {
|
||||
if (RCT2_ADDRESS(0x0098DA38, uint8*)[entryType][entryIndex] & (1 << 0)) {
|
||||
if (gEditorSelectedObjects[entryType][entryIndex] & (1 << 0)) {
|
||||
*selectionFlags |=
|
||||
OBJECT_SELECTION_FLAG_IN_USE |
|
||||
OBJECT_SELECTION_FLAG_SELECTED;
|
||||
}
|
||||
if (RCT2_ADDRESS(0x0098DA38, uint8*)[entryType][entryIndex] & (1 << 1)) {
|
||||
if (gEditorSelectedObjects[entryType][entryIndex] & (1 << 1)) {
|
||||
*selectionFlags |= OBJECT_SELECTION_FLAG_SELECTED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -319,9 +319,11 @@ static void window_game_bottom_toolbar_invalidate(rct_window *w)
|
|||
*/
|
||||
void window_game_bottom_toolbar_invalidate_news_item()
|
||||
{
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type =
|
||||
news_item_is_queue_empty() ? WWT_EMPTY : WWT_IMGBTN;
|
||||
widget_invalidate_by_class(WC_BOTTOM_TOOLBAR, WIDX_MIDDLE_OUTSET);
|
||||
if (gScreenFlags == SCREEN_FLAGS_PLAYING) {
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type =
|
||||
news_item_is_queue_empty() ? WWT_EMPTY : WWT_IMGBTN;
|
||||
widget_invalidate_by_class(WC_BOTTOM_TOOLBAR, WIDX_MIDDLE_OUTSET);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue