1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

implement three functions used in save scenario

This commit is contained in:
IntelOrca
2015-06-08 21:35:09 +01:00
parent 999488d38c
commit 2888494faa
4 changed files with 56 additions and 15 deletions

View File

@@ -799,6 +799,27 @@ int scenario_write_available_objects(FILE *file)
return 1;
}
static void sub_677552()
{
RCT2_GLOBAL(0x0013587BC, uint32) = 0x31144;
RCT2_GLOBAL(0x001358778, uint32) = RCT2_GLOBAL(0x009E2D28, uint32);
}
static void sub_674BCF()
{
char *savedExpansionPackNames = (char*)0x0135946C;
for (int i = 0; i < 16; i++) {
char *dst = &savedExpansionPackNames[i * 128];
if (RCT2_GLOBAL(RCT2_ADDRESS_EXPANSION_FLAGS, uint16) & (1 << i)) {
char *src = &(RCT2_ADDRESS(RCT2_ADDRESS_EXPANSION_NAMES, char)[i * 128]);
strncpy(dst, src, 128);
} else {
*dst = 0;
}
}
}
/**
*
* rct2: 0x006754F5
@@ -833,10 +854,10 @@ int scenario_save(char *path, int flags)
window_close_construction_windows();
map_reorganise_elements();
RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
RCT2_CALLPROC_EBPSAFE(0x0069EBA4);
RCT2_CALLPROC_EBPSAFE(0x00677552);
RCT2_CALLPROC_EBPSAFE(0x00674BCF);
reset_0x69EBE4();
sprite_clear_all_unused();
sub_677552();
sub_674BCF();
// Set saved view
w = window_get_main();

View File

@@ -255,7 +255,7 @@ typedef struct {
uint16 word_01358836;
uint32 word_01358838;
uint16 suggested_max_guests;
uint16 word_0135883E;
uint16 park_rating_warning_days;
uint8 word_01358840;
uint8 rct1_water_colour;
uint8 pad_01358842[2];
@@ -270,10 +270,9 @@ typedef struct {
uint16 park_entrance_x[4];
uint16 park_entrance_y[4];
uint16 park_entrance_z[4];
uint8 byte_01359368;
uint8 pad_01359369[3];
uint8 byte_0135936C[256];
uint8 byte_0135946C[3256];
uint8 park_entrance_direction[4];
uint8 scenario_filename[256];
uint8 saved_expansion_pack_names[3256];
rct_banner banners[250]
char custom_strings[0x8000];
uint32 game_ticks_1;

View File

@@ -611,19 +611,15 @@ void reset_sprite_list(){
RCT2_GLOBAL(0x13573C8, uint16) = 0x2710;
//RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
reset_0x69EBE4();
}
/*
*
* rct: 0x0069EBE4
/**
* rct2: 0x0069EBE4
* This function looks as though it sets some sort of order for sprites.
* Sprites can share thier position if this is the case.
*/
void reset_0x69EBE4(){
//RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
//return;
memset((uint16*)0xF1EF60, -1, 0x10001*2);
rct_sprite* spr = g_sprite_list;
@@ -648,6 +644,28 @@ void reset_0x69EBE4(){
}
}
/**
* Clears all the unused sprite memory to zero. Probably so that it can be compressed better when saving.
* rct2: 0x0069EBA4
*/
void sprite_clear_all_unused()
{
rct_unk_sprite *sprite;
uint16 spriteIndex, nextSpriteIndex;
spriteIndex = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_NEXT_INDEX, uint16);
while (spriteIndex != SPRITE_INDEX_NULL) {
sprite = &g_sprite_list[spriteIndex].unknown;
nextSpriteIndex = sprite->next;
memset(sprite, 0, sizeof(rct_sprite));
sprite->sprite_identifier = SPRITE_IDENTIFIER_NULL;
sprite->next = nextSpriteIndex;
sprite->linked_list_type_offset = SPRITE_LINKEDLIST_OFFSET_NULL;
sprite->sprite_index = spriteIndex;
spriteIndex = nextSpriteIndex;
}
}
/*
* rct2: 0x0069EC6B
* bl: if bl & 2 > 0, the sprite ends up in the MISC linked list.

View File

@@ -34,9 +34,11 @@ enum SPRITE_IDENTIFIER{
SPRITE_IDENTIFIER_PEEP = 1,
SPRITE_IDENTIFIER_MISC = 2,
SPRITE_IDENTIFIER_LITTER = 3,
SPRITE_IDENTIFIER_NULL = 255
};
typedef enum {
SPRITE_LINKEDLIST_OFFSET_NULL = 0,
SPRITE_LINKEDLIST_OFFSET_VEHICLE = 2,
SPRITE_LINKEDLIST_OFFSET_PEEP = 4,
SPRITE_LINKEDLIST_OFFSET_MISC = 6,
@@ -243,6 +245,7 @@ void money_effect_create(money32 value);
rct_sprite *create_sprite(uint8 bl);
void reset_sprite_list();
void reset_0x69EBE4();
void sprite_clear_all_unused();
void move_sprite_to_list(rct_sprite *sprite, uint8 cl);
void sprite_misc_update_all();
void sprite_move(sint16 x, sint16 y, sint16 z, rct_sprite* sprite);