mirror of https://github.com/OpenRCT2/OpenRCT2.git
implement research_populate_list_random
This commit is contained in:
parent
4d11def81d
commit
509b2a1c6d
|
@ -480,7 +480,7 @@ static void sub_6A2B62()
|
|||
RCT2_CALLPROC_EBPSAFE(0x006A29B9);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006A2A68);
|
||||
editor_rct1_reset_research();
|
||||
RCT2_CALLPROC_EBPSAFE(0x00685675);
|
||||
research_populate_list_random();
|
||||
research_remove_non_separate_vehicle_types();
|
||||
|
||||
climate_reset(RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE, uint8));
|
||||
|
@ -947,7 +947,7 @@ static int editor_read_s6(const char *path)
|
|||
RCT2_GLOBAL(0x01357BC8, uint16) = 0;
|
||||
RCT2_GLOBAL(0x013573FE, uint16) = 0;
|
||||
if (s6Header->type != S6_TYPE_SCENARIO) {
|
||||
RCT2_CALLPROC_EBPSAFE(0x00685675);
|
||||
research_populate_list_random();
|
||||
research_remove_non_separate_vehicle_types();
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)
|
||||
|
|
|
@ -189,7 +189,7 @@ void research_finish_item(sint32 entryIndex)
|
|||
if (rideEntry2->var_008 & 0x2000)
|
||||
continue;
|
||||
|
||||
if (rideEntry2->var_00C == ecx || rideEntry2->var_00D == ecx || rideEntry2->var_00E == ecx)
|
||||
if (rideEntry2->ride_type[0] == ecx || rideEntry2->ride_type[1] == ecx || rideEntry2->ride_type[2] == ecx)
|
||||
RCT2_ADDRESS(0x001357424, uint32)[i >> 5] |= 1 << (i & 0x1F);
|
||||
}
|
||||
}
|
||||
|
@ -374,6 +374,105 @@ void research_remove_non_separate_vehicle_types()
|
|||
} while ((researchItem--) != gResearchItems);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006857FA
|
||||
*/
|
||||
static void research_insert_unresearched(int entryIndex, int category)
|
||||
{
|
||||
rct_research_item *researchItem, *researchItem2;
|
||||
|
||||
researchItem = gResearchItems;
|
||||
do {
|
||||
if (researchItem->entryIndex == RESEARCHED_ITEMS_END) {
|
||||
// Insert slot
|
||||
researchItem2 = researchItem;
|
||||
while (researchItem2->entryIndex != RESEARCHED_ITEMS_END_2) {
|
||||
researchItem2++;
|
||||
}
|
||||
memmove(researchItem + 1, researchItem, (researchItem2 - researchItem + 1) * sizeof(rct_research_item));
|
||||
|
||||
// Place new item
|
||||
researchItem->entryIndex = entryIndex;
|
||||
researchItem->category = category;
|
||||
break;
|
||||
}
|
||||
} while (entryIndex != (researchItem++)->entryIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00685826
|
||||
*/
|
||||
static void research_insert_researched(int entryIndex, int category)
|
||||
{
|
||||
rct_research_item *researchItem, *researchItem2;
|
||||
|
||||
researchItem = gResearchItems;
|
||||
do {
|
||||
if (researchItem->entryIndex == RESEARCHED_ITEMS_SEPERATOR) {
|
||||
// Insert slot
|
||||
researchItem2 = researchItem;
|
||||
while (researchItem2->entryIndex != RESEARCHED_ITEMS_END_2) {
|
||||
researchItem2++;
|
||||
}
|
||||
memmove(researchItem + 1, researchItem, (researchItem2 - researchItem + 1) * sizeof(researchItem));
|
||||
|
||||
// Place new item
|
||||
researchItem->entryIndex = entryIndex;
|
||||
researchItem->category = category;
|
||||
break;
|
||||
}
|
||||
} while (entryIndex != (researchItem++)->entryIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00685826
|
||||
*/
|
||||
static void research_insert(int researched, int entryIndex, int category)
|
||||
{
|
||||
if (researched)
|
||||
research_insert_researched(entryIndex, category);
|
||||
else
|
||||
research_insert_unresearched(entryIndex, category);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00685675
|
||||
*/
|
||||
void research_populate_list_random()
|
||||
{
|
||||
rct_ride_type *rideEntry;
|
||||
rct_scenery_set_entry *scenerySetEntry;
|
||||
int rideType, researched;
|
||||
|
||||
// Rides
|
||||
for (int i = 0; i < 128; i++) {
|
||||
rideEntry = GET_RIDE_ENTRY(i);
|
||||
if (rideEntry == (rct_ride_type*)-1)
|
||||
continue;
|
||||
|
||||
researched = (scenario_rand() & 0xFF) > 128;
|
||||
for (int j = 0; j < 3; j++) {
|
||||
rideType = rideEntry->ride_type[j];
|
||||
if (rideType != 255)
|
||||
research_insert(researched, 0x10000 | (rideType << 8) | i, rideEntry->category[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// Scenery
|
||||
for (int i = 0; i < 19; i++) {
|
||||
scenerySetEntry = g_scenerySetEntries[i];
|
||||
if (scenerySetEntry == (rct_scenery_set_entry*)-1)
|
||||
continue;
|
||||
|
||||
researched = (scenario_rand() & 0xFF) > 85;
|
||||
research_insert(researched, i, RESEARCH_CATEGORY_SCENERYSET);
|
||||
}
|
||||
}
|
||||
|
||||
void research_set_funding(int amount)
|
||||
{
|
||||
game_do_command(0, GAME_COMMAND_FLAG_APPLY, 0, amount, GAME_COMMAND_SET_RESEARCH_FUNDING, 0, 0);
|
||||
|
|
|
@ -48,6 +48,16 @@ enum {
|
|||
RESEARCH_STAGE_FINISHED_ALL
|
||||
};
|
||||
|
||||
enum {
|
||||
RESEARCH_CATEGORY_TRANSPORT,
|
||||
RESEARCH_CATEGORY_GENTLE,
|
||||
RESEARCH_CATEGORY_ROLLERCOASTER,
|
||||
RESEARCH_CATEGORY_THRILL,
|
||||
RESEARCH_CATEGORY_WATER,
|
||||
RESEARCH_CATEGORY_SHOP,
|
||||
RESEARCH_CATEGORY_SCENERYSET
|
||||
};
|
||||
|
||||
extern rct_research_item *gResearchItems;
|
||||
extern uint8 gResearchUncompletedCategories;
|
||||
|
||||
|
@ -56,6 +66,7 @@ void research_update_uncompleted_types();
|
|||
void research_update();
|
||||
void sub_684AC3();
|
||||
void research_remove_non_separate_vehicle_types();
|
||||
void research_populate_list_random();
|
||||
|
||||
void research_set_funding(int amount);
|
||||
void research_set_priority(int activeCategories);
|
||||
|
|
14
src/object.c
14
src/object.c
|
@ -652,7 +652,7 @@ int paint_ride_entry(int flags, int ebx, int ecx, int edx, rct_drawpixelinfo* dp
|
|||
if (RCT2_GLOBAL(0x9ADAFD, uint8_t) == 0)
|
||||
{
|
||||
for (int i = 0; i < 3; ++i){
|
||||
sint16 dl = (&ride_type->var_00C)[i];
|
||||
int dl = ride_type->ride_type[i];
|
||||
|
||||
if (dl == 0xFF)continue;
|
||||
|
||||
|
@ -675,7 +675,7 @@ int paint_ride_entry(int flags, int ebx, int ecx, int edx, rct_drawpixelinfo* dp
|
|||
// 0x6DEBAA
|
||||
if (RCT2_GLOBAL(0x9ADAF4, sint32) != 0xFFFFFFFF) *RCT2_GLOBAL(0x9ADAF4, uint16*) = 0;
|
||||
|
||||
int di = ride_type->var_00C | (ride_type->var_00D << 8) | (ride_type->var_00E << 16);
|
||||
int di = ride_type->ride_type[0] | (ride_type->ride_type[1] << 8) | (ride_type->ride_type[2] << 16);
|
||||
|
||||
if (ride_type->var_008 & 0x1000) di |= 0x1000000;
|
||||
|
||||
|
@ -741,10 +741,10 @@ int paint_ride_entry(int flags, int ebx, int ecx, int edx, rct_drawpixelinfo* dp
|
|||
if (!((flags >> 8) & 0xFF))
|
||||
{
|
||||
int image_id = ride_type->images_offset;
|
||||
if (ride_type->var_00C == 0xFF)
|
||||
if (ride_type->ride_type[0] == 0xFF)
|
||||
{
|
||||
image_id++;
|
||||
if (ride_type->var_00D == 0xFF) image_id++;
|
||||
if (ride_type->ride_type[1] == 0xFF) image_id++;
|
||||
}
|
||||
gfx_draw_sprite(dpi, image_id, x - 56, y - 56, ebp);
|
||||
return flags;
|
||||
|
@ -757,11 +757,11 @@ int paint_ride_entry(int flags, int ebx, int ecx, int edx, rct_drawpixelinfo* dp
|
|||
int format_args = ride_type->description;
|
||||
if (!(ride_type->var_008 & 0x1000))
|
||||
{
|
||||
format_args = ride_type->var_00C;
|
||||
format_args = ride_type->ride_type[0];
|
||||
if ((format_args & 0xFF) == 0xFF)
|
||||
{
|
||||
format_args = ride_type->var_00D;
|
||||
if ((format_args & 0xFF) == 0xFF) format_args = ride_type->var_00E;
|
||||
format_args = ride_type->ride_type[1];
|
||||
if ((format_args & 0xFF) == 0xFF) format_args = ride_type->ride_type[2];
|
||||
}
|
||||
format_args += 0x200;
|
||||
}
|
||||
|
|
|
@ -649,11 +649,11 @@ static uint32 install_object_entry(rct_object_entry* entry, rct_object_entry* in
|
|||
// When made of two parts i.e Wooden Roller Coaster (Dream Woodie Cars)
|
||||
if ((objectType == OBJECT_TYPE_RIDE) && !((((rct_ride_type*)chunk)->var_008) & 0x1000)) {
|
||||
rct_ride_type* ride_type = (rct_ride_type*)chunk;
|
||||
rct_string_id obj_string = ride_type->var_00C;
|
||||
rct_string_id obj_string = ride_type->ride_type[0];
|
||||
if (obj_string == 0xFF){
|
||||
obj_string = ride_type->var_00D;
|
||||
obj_string = ride_type->ride_type[1];
|
||||
if (obj_string == 0xFF) {
|
||||
obj_string = ride_type->var_00E;
|
||||
obj_string = ride_type->ride_type[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,10 +101,7 @@ typedef struct {
|
|||
rct_string_id description; // 0x002
|
||||
uint32 images_offset; // 0x004
|
||||
uint32 var_008;
|
||||
// 0xC, D, E are related
|
||||
uint8 var_00C;
|
||||
uint8 var_00D;
|
||||
uint8 var_00E;
|
||||
uint8 ride_type[3]; // 0x00C
|
||||
uint8 min_cars_in_train; // 0x00F
|
||||
uint8 max_cars_in_train; // 0x010
|
||||
uint8 var_011;
|
||||
|
|
|
@ -256,7 +256,7 @@ static void window_editor_object_selection_close()
|
|||
reset_loaded_objects();
|
||||
object_free_scenario_text();
|
||||
RCT2_CALLPROC_EBPSAFE(0x6AB316);
|
||||
RCT2_CALLPROC_EBPSAFE(0x685675);
|
||||
research_populate_list_random();
|
||||
research_remove_non_separate_vehicle_types();
|
||||
window_new_ride_init_vars();
|
||||
}
|
||||
|
@ -820,7 +820,7 @@ static void window_editor_object_selection_manage_tracks()
|
|||
RCT2_GLOBAL(0xF44157, uint8) = entry_index;
|
||||
|
||||
rct_ride_type* ride_entry = GET_RIDE_ENTRY(entry_index);
|
||||
uint8* ride_type_array = &ride_entry->var_00C;
|
||||
uint8* ride_type_array = &ride_entry->ride_type[0];
|
||||
|
||||
int ride_type;
|
||||
for (int i = 0; (ride_type = ride_type_array[i]) == 0xFF; i++);
|
||||
|
|
|
@ -326,7 +326,7 @@ static void window_new_ride_populate_list()
|
|||
nextListItem->entry_index = rideEntryIndex;
|
||||
nextListItem++;
|
||||
} else if (dh & 4) {
|
||||
if (rideType == rideEntry->var_00C) {
|
||||
if (rideType == rideEntry->ride_type[0]) {
|
||||
nextListItem--;
|
||||
nextListItem->type = rideType;
|
||||
nextListItem->entry_index = rideEntryIndex;
|
||||
|
@ -877,9 +877,9 @@ static void window_new_ride_scrollpaint()
|
|||
// Draw ride image
|
||||
rideEntry = rideEntries[listItem->entry_index];
|
||||
int image_id = rideEntry->images_offset;
|
||||
if (listItem->type != rideEntry->var_00C) {
|
||||
if (listItem->type != rideEntry->ride_type[0]) {
|
||||
image_id++;
|
||||
if (listItem->type != rideEntry->var_00D)
|
||||
if (listItem->type != rideEntry->ride_type[1])
|
||||
image_id++;
|
||||
}
|
||||
RCT2_CALLPROC_X(0x00681DE2, 0, 29013, x + 2, y + 2, 0xA0, (int)dpi, image_id);
|
||||
|
|
Loading…
Reference in New Issue