Implemented object_create_identifier_name and start of last func.

Note requires modification of the strings.
This commit is contained in:
Duncan Frost 2015-06-19 19:11:23 +01:00
parent d67d9349b9
commit 15b2360e13
4 changed files with 59 additions and 3 deletions

View File

@ -3176,7 +3176,7 @@ STR_3168 :{WINDOW_COLOUR_2}Text: {BLACK}{STRINGID}
STR_3169 :Data for the following object not found:
STR_3170 :Not enough space for graphics
STR_3171 :Too many objects of this type selected
STR_3172 :The following object must be selected first:
STR_3172 :The following object must be selected first: {STRING}
STR_3173 :This object is currently in use
STR_3174 :This object is required by another object
STR_3175 :This object is always required

View File

@ -112,6 +112,7 @@ rct_object_entry *object_get_next(rct_object_entry *entry);
int write_object_file(FILE *file, rct_object_entry* entry);
void reset_loaded_objects();
int find_object_in_entry_group(rct_object_entry* entry, uint8* entry_type, uint8* entry_index);
void object_create_identifier_name(uint8* string_buffer, rct_object_entry* object);
rct_object_entry *object_list_find(rct_object_entry *entry);

View File

@ -451,6 +451,30 @@ int check_object_entry(rct_object_entry *entry)
return (0xFFFFFFFF & dwords[0] & dwords[1] & dwords[2] & dwords[3]) + 1 != 0;
}
/* rct2: 0x006AB344 */
void object_create_identifier_name(uint8* string_buffer, rct_object_entry* object){
for (uint8 i = 0; i < 8; ++i){
if (object->name[i] != ' '){
*string_buffer++ = object->name[i];
}
}
*string_buffer++ = '/';
for (uint8 i = 0; i < 4; ++i){
uint8 flag_part = (object->flags >> (i * 8)) & 0xFF;
*string_buffer++ = RCT2_ADDRESS(0x0098DA64, uint8)[flag_part >> 4];
*string_buffer++ = RCT2_ADDRESS(0x0098DA64, uint8)[flag_part & 0xF];
}
for (uint8 i = 0; i < 4; ++i){
uint8 checksum_part = (object->checksum >> (i * 8)) & 0xFF;
*string_buffer++ = RCT2_ADDRESS(0x0098DA64, uint8)[checksum_part >> 4];
*string_buffer++ = RCT2_ADDRESS(0x0098DA64, uint8)[checksum_part & 0xF];
}
*string_buffer++ = '\0';
}
/* rct2: 0x675827 */
void set_load_objects_fail_reason(){
rct_object_entry* object = RCT2_ADDRESS(0x13CE952, rct_object_entry);
@ -463,7 +487,7 @@ void set_load_objects_fail_reason(){
format_string(string_buffer, 3323, 0); //Missing object data, ID:
RCT2_CALLPROC_X(0x6AB344, 0, 0, 0, 0, 0, (int)string_buffer, 0x13CE952);
object_create_identifier_name(string_buffer, object);
RCT2_GLOBAL(RCT2_ADDRESS_ERROR_TYPE, uint8) = 0xFF;
RCT2_GLOBAL(RCT2_ADDRESS_ERROR_STRING_ID, uint16) = 3165;
return;

View File

@ -583,6 +583,35 @@ static void editor_object_flags_free(){
RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*) = NULL;
}
/* rct2: 0x00685791 */
void sub_685791(rct_object_entry* installedObject){
uint8 entry_type, entry_index;
if (!find_object_in_entry_group(installedObject, entry_type, entry_index))
return;
if (entry_type == OBJECT_TYPE_RIDE){
//6857af
}
else if (entry_type == OBJECT_TYPE_SCENERY_SETS){
//6857a5
}
}
/* rct2: 0x006ABB66 */
void sub_6ABB66(){
uint8* selection_flags = RCT2_GLOBAL(RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST, uint8*);
rct_object_entry* installedObject = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
for (int i = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, uint32); i > 0; --i){
if (*selection_flags & OBJECT_SELECTION_FLAG_SELECTED){
sub_685791(installedObject);
object_unload(0, installedObject);
}
selection_flags++;
installedObject = object_get_next(installedObject);
}
}
/**
*
* rct2: 0x006AB199
@ -1645,7 +1674,9 @@ static int window_editor_object_selection_select_object(uint8 bh, int flags, rct
}
if (bh != 0 && !(flags&(1 << 1))){
RCT2_CALLPROC_X(0x6AB344, 0, 0, 0, 0, 0, (int)0x009BC95A, (int)installedObject);
uint32* arguments = RCT2_ADDRESS(0x0013CE952, uint32);
object_create_identifier_name((char*)0x009BC95A, installedObject);
*arguments = (uint32)0x009BC95A;
set_object_selection_error(bh, 3172);
return 0;
}