mirror of https://github.com/OpenRCT2/OpenRCT2.git
Name sub_6DFED0(), remove magic numbers, minor refactor to research
This commit is contained in:
parent
f47d7f27a5
commit
acd3b09c80
|
@ -815,7 +815,7 @@ void game_fix_save_vars() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix invalid research items
|
// Fix invalid research items
|
||||||
for (sint32 i = 0; i < 500; i++) {
|
for (sint32 i = 0; i < MAX_RESEARCH_ITEMS; i++) {
|
||||||
rct_research_item *researchItem = &gResearchItems[i];
|
rct_research_item *researchItem = &gResearchItems[i];
|
||||||
if (researchItem->entryIndex == RESEARCHED_ITEMS_SEPARATOR) continue;
|
if (researchItem->entryIndex == RESEARCHED_ITEMS_SEPARATOR) continue;
|
||||||
if (researchItem->entryIndex == RESEARCHED_ITEMS_END) continue;
|
if (researchItem->entryIndex == RESEARCHED_ITEMS_END) continue;
|
||||||
|
|
|
@ -44,16 +44,16 @@ uint8 gResearchNextCategory;
|
||||||
uint32 gResearchNextItem;
|
uint32 gResearchNextItem;
|
||||||
|
|
||||||
// 0x01358844[500]
|
// 0x01358844[500]
|
||||||
rct_research_item gResearchItems[500];
|
rct_research_item gResearchItems[MAX_RESEARCH_ITEMS];
|
||||||
|
|
||||||
// 0x00EE787C
|
// 0x00EE787C
|
||||||
uint8 gResearchUncompletedCategories;
|
uint8 gResearchUncompletedCategories;
|
||||||
|
|
||||||
uint32 gResearchedRideTypes[8];
|
uint32 gResearchedRideTypes[MAX_RESEARCHED_RIDE_TYPES];
|
||||||
uint32 gResearchedRideEntries[8];
|
uint32 gResearchedRideEntries[MAX_RESEARCHED_RIDE_ENTRIES];
|
||||||
uint32 gResearchedTrackTypesA[128];
|
uint32 gResearchedTrackTypesA[MAX_RESEARCHED_TRACK_TYPES];
|
||||||
uint32 gResearchedTrackTypesB[128];
|
uint32 gResearchedTrackTypesB[MAX_RESEARCHED_TRACK_TYPES];
|
||||||
uint32 gResearchedSceneryItems[56];
|
uint32 gResearchedSceneryItems[MAX_RESEARCHED_SCENERY_ITEMS];
|
||||||
|
|
||||||
bool gSilentResearch = false;
|
bool gSilentResearch = false;
|
||||||
|
|
||||||
|
@ -636,3 +636,22 @@ bool scenery_is_invented(uint16 sceneryItem)
|
||||||
bool invented = (gResearchedSceneryItems[quadIndex] & ((uint32)1 << bitIndex));
|
bool invented = (gResearchedSceneryItems[quadIndex] & ((uint32)1 << bitIndex));
|
||||||
return invented;
|
return invented;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset_researched_scenery_items()
|
||||||
|
{
|
||||||
|
for (sint32 i = 0; i < MAX_RESEARCHED_SCENERY_ITEMS; i++) {
|
||||||
|
gResearchedSceneryItems[i] = 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset_researched_ride_types_and_entries()
|
||||||
|
{
|
||||||
|
// Iteration endpoint used to be 4 for unknown reasons, likely a mistake
|
||||||
|
for (sint32 i = 0; i < MAX_RESEARCHED_RIDE_TYPES; i++) {
|
||||||
|
gResearchedRideTypes[i] = 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (sint32 i = 0; i < MAX_RESEARCHED_RIDE_ENTRIES; i++) {
|
||||||
|
gResearchedRideEntries[i] = 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -40,6 +40,12 @@ enum{
|
||||||
// Extra end of list entry. Unsure why?
|
// Extra end of list entry. Unsure why?
|
||||||
#define RESEARCHED_ITEMS_END_2 -3
|
#define RESEARCHED_ITEMS_END_2 -3
|
||||||
|
|
||||||
|
#define MAX_RESEARCH_ITEMS 500
|
||||||
|
#define MAX_RESEARCHED_SCENERY_ITEMS 56
|
||||||
|
#define MAX_RESEARCHED_RIDE_TYPES 8
|
||||||
|
#define MAX_RESEARCHED_RIDE_ENTRIES 8
|
||||||
|
#define MAX_RESEARCHED_TRACK_TYPES 128
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
RESEARCH_FUNDING_NONE,
|
RESEARCH_FUNDING_NONE,
|
||||||
RESEARCH_FUNDING_MINIMUM,
|
RESEARCH_FUNDING_MINIMUM,
|
||||||
|
@ -75,13 +81,13 @@ extern uint8 gResearchExpectedDay;
|
||||||
extern uint8 gResearchNextCategory;
|
extern uint8 gResearchNextCategory;
|
||||||
extern uint32 gResearchNextItem;
|
extern uint32 gResearchNextItem;
|
||||||
|
|
||||||
extern rct_research_item gResearchItems[500];
|
extern rct_research_item gResearchItems[MAX_RESEARCH_ITEMS];
|
||||||
extern uint8 gResearchUncompletedCategories;
|
extern uint8 gResearchUncompletedCategories;
|
||||||
extern uint32 gResearchedRideTypes[8];
|
extern uint32 gResearchedRideTypes[MAX_RESEARCHED_RIDE_TYPES];
|
||||||
extern uint32 gResearchedRideEntries[8];
|
extern uint32 gResearchedRideEntries[MAX_RESEARCHED_RIDE_ENTRIES];
|
||||||
extern uint32 gResearchedTrackTypesA[128];
|
extern uint32 gResearchedTrackTypesA[MAX_RESEARCHED_TRACK_TYPES];
|
||||||
extern uint32 gResearchedTrackTypesB[128];
|
extern uint32 gResearchedTrackTypesB[MAX_RESEARCHED_TRACK_TYPES];
|
||||||
extern uint32 gResearchedSceneryItems[56];
|
extern uint32 gResearchedSceneryItems[MAX_RESEARCHED_SCENERY_ITEMS];
|
||||||
extern bool gSilentResearch;
|
extern bool gSilentResearch;
|
||||||
|
|
||||||
void research_reset_items();
|
void research_reset_items();
|
||||||
|
@ -106,5 +112,7 @@ bool ride_type_is_invented(sint32 rideType);
|
||||||
bool ride_entry_is_invented(sint32 rideEntryIndex);
|
bool ride_entry_is_invented(sint32 rideEntryIndex);
|
||||||
bool track_piece_is_available_for_ride_type(uint8 rideType, sint32 trackType);
|
bool track_piece_is_available_for_ride_type(uint8 rideType, sint32 trackType);
|
||||||
bool scenery_is_invented(uint16 sceneryItem);
|
bool scenery_is_invented(uint16 sceneryItem);
|
||||||
|
void reset_researched_scenery_items();
|
||||||
|
void reset_researched_ride_types_and_entries();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -238,7 +238,7 @@ typedef struct rct_s6_data {
|
||||||
uint8 last_entrance_style;
|
uint8 last_entrance_style;
|
||||||
uint8 rct1_water_colour;
|
uint8 rct1_water_colour;
|
||||||
uint8 pad_01358842[2];
|
uint8 pad_01358842[2];
|
||||||
rct_research_item research_items[500];
|
rct_research_item research_items[MAX_RESEARCH_ITEMS];
|
||||||
uint16 map_base_z;
|
uint16 map_base_z;
|
||||||
char scenario_name[64];
|
char scenario_name[64];
|
||||||
char scenario_description[256];
|
char scenario_description[256];
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "../scenario/scenario.h"
|
#include "../scenario/scenario.h"
|
||||||
#include "../sprites.h"
|
#include "../sprites.h"
|
||||||
#include "../localisation/localisation.h"
|
#include "../localisation/localisation.h"
|
||||||
|
#include "../management/research.h"
|
||||||
#include "../interface/themes.h"
|
#include "../interface/themes.h"
|
||||||
#include "../interface/viewport.h"
|
#include "../interface/viewport.h"
|
||||||
#include "../interface/widget.h"
|
#include "../interface/widget.h"
|
||||||
|
@ -128,8 +129,6 @@ static const rct_string_id EditorStepNames[] = {
|
||||||
STR_EDITOR_STEP_TRACK_DESIGNS_MANAGER,
|
STR_EDITOR_STEP_TRACK_DESIGNS_MANAGER,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void sub_6DFED0();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the main editor top toolbar window.
|
* Creates the main editor top toolbar window.
|
||||||
* rct2: 0x0066F052 (part of 0x0066EF38)
|
* rct2: 0x0066F052 (part of 0x0066EF38)
|
||||||
|
@ -149,7 +148,7 @@ void window_editor_bottom_toolbar_open()
|
||||||
(1 << WIDX_NEXT_IMAGE);
|
(1 << WIDX_NEXT_IMAGE);
|
||||||
|
|
||||||
window_init_scroll_widgets(window);
|
window_init_scroll_widgets(window);
|
||||||
sub_6DFED0();
|
reset_researched_scenery_items();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,24 +161,13 @@ void window_editor_bottom_toolbar_jump_back_to_object_selection() {
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* rct2: 0x006DFED0
|
|
||||||
*/
|
|
||||||
static void sub_6DFED0()
|
|
||||||
{
|
|
||||||
for (sint32 i = 0; i < 56; i++) {
|
|
||||||
gResearchedSceneryItems[i] = 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* rct2: 0x0066F62C
|
* rct2: 0x0066F62C
|
||||||
*/
|
*/
|
||||||
void window_editor_bottom_toolbar_jump_back_to_landscape_editor() {
|
void window_editor_bottom_toolbar_jump_back_to_landscape_editor() {
|
||||||
window_close_all();
|
window_close_all();
|
||||||
sub_6DFED0();
|
reset_researched_scenery_items();
|
||||||
scenery_set_default_placement_configuration();
|
scenery_set_default_placement_configuration();
|
||||||
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
|
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
|
||||||
window_map_open();
|
window_map_open();
|
||||||
|
@ -242,25 +230,6 @@ static bool window_editor_bottom_toolbar_check_object_selection()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* rct2: 0x0066F6E3
|
|
||||||
*/
|
|
||||||
static void sub_66F6E3()
|
|
||||||
{
|
|
||||||
for (sint32 i = 0; i < 4; i++) {
|
|
||||||
gResearchedRideTypes[i] = 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (sint32 i = 0; i < 8; i++) {
|
|
||||||
gResearchedRideEntries[i] = 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
window_new_ride_open();
|
|
||||||
gS6Info.editor_step = EDITOR_STEP_ROLLERCOASTER_DESIGNER;
|
|
||||||
gfx_invalidate_screen();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* rct2: 0x0066F6B0
|
* rct2: 0x0066F6B0
|
||||||
|
@ -271,9 +240,12 @@ void window_editor_bottom_toolbar_jump_forward_from_object_selection()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) {
|
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) {
|
||||||
sub_66F6E3();
|
reset_researched_ride_types_and_entries();
|
||||||
|
window_new_ride_open();
|
||||||
|
gS6Info.editor_step = EDITOR_STEP_ROLLERCOASTER_DESIGNER;
|
||||||
|
gfx_invalidate_screen();
|
||||||
} else {
|
} else {
|
||||||
sub_6DFED0();
|
reset_researched_scenery_items();
|
||||||
scenery_set_default_placement_configuration();
|
scenery_set_default_placement_configuration();
|
||||||
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
|
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
|
||||||
window_map_open();
|
window_map_open();
|
||||||
|
|
|
@ -1684,13 +1684,7 @@ static sint32 get_object_from_object_selection(uint8 object_type, sint32 y)
|
||||||
*/
|
*/
|
||||||
static void window_editor_object_selection_manage_tracks()
|
static void window_editor_object_selection_manage_tracks()
|
||||||
{
|
{
|
||||||
for (sint32 i = 0; i < 4; i++) {
|
reset_researched_ride_types_and_entries();
|
||||||
gResearchedRideTypes[i] = 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (sint32 i = 0; i < 8; i++) {
|
|
||||||
gResearchedRideEntries[i] = 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
gS6Info.editor_step = EDITOR_STEP_TRACK_DESIGNS_MANAGER;
|
gS6Info.editor_step = EDITOR_STEP_TRACK_DESIGNS_MANAGER;
|
||||||
|
|
||||||
|
|
|
@ -107,9 +107,7 @@ void park_init()
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
gResearchedRideTypes[i] = 0;
|
gResearchedRideTypes[i] = 0;
|
||||||
|
|
||||||
for (i = 0; i < 56; i++) {
|
reset_researched_scenery_items();
|
||||||
gResearchedSceneryItems[i] = 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
gParkEntranceFee = MONEY(10, 00);
|
gParkEntranceFee = MONEY(10, 00);
|
||||||
gPeepSpawns[0].x = PEEP_SPAWN_UNDEFINED;
|
gPeepSpawns[0].x = PEEP_SPAWN_UNDEFINED;
|
||||||
|
|
Loading…
Reference in New Issue