|
@@ -499,12 +499,35 @@ static bool LoadOldOrder(LoadgameState *
|
|
|
if (num > 0 && GetOrder(num)->IsValid())
|
|
|
GetOrder(num - 1)->next = GetOrder(num);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
static bool LoadOldAnimTileList(LoadgameState *ls, int num)
|
|
|
{
|
|
|
/* This is sligthly hackish - we must load a chunk into an array whose
|
|
|
* address isn't static, but instead pointed to by _animated_tile_list.
|
|
|
* To achieve that, create an OldChunks list on the stack on the fly.
|
|
|
* The list cannot be static because the value of _animated_tile_list
|
|
|
* can change between calls. */
|
|
|
|
|
|
const OldChunks anim_chunk[] = {
|
|
|
OCL_VAR ( OC_TILE, 256, _animated_tile_list ),
|
|
|
OCL_END ()
|
|
|
};
|
|
|
|
|
|
if (!LoadChunk(ls, NULL, anim_chunk)) return false;
|
|
|
|
|
|
/* Update the animated tile counter by counting till the first zero in the array */
|
|
|
for (_animated_tile_count = 0; _animated_tile_count < 256; _animated_tile_count++) {
|
|
|
if (_animated_tile_list[_animated_tile_count] == 0) break;
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
static const OldChunks depot_chunk[] = {
|
|
|
OCL_SVAR( OC_TILE, Depot, xy ),
|
|
|
OCL_VAR ( OC_UINT32, 1, &_old_town_index ),
|
|
|
OCL_END()
|
|
|
};
|
|
|
|
|
@@ -1420,13 +1443,13 @@ static const OldChunks main_chunk[] = {
|
|
|
OCL_ASSERT( 0x264 ),
|
|
|
OCL_CHUNK( 70, LoadOldTown ),
|
|
|
OCL_ASSERT( 0x1C18 ),
|
|
|
OCL_CHUNK(5000, LoadOldOrder ),
|
|
|
OCL_ASSERT( 0x4328 ),
|
|
|
|
|
|
OCL_VAR ( OC_TILE, 256, _animated_tile_list ),
|
|
|
OCL_CHUNK( 1, LoadOldAnimTileList ),
|
|
|
OCL_NULL( 4 ), ///< old end-of-order-list-pointer, no longer in use
|
|
|
|
|
|
OCL_CHUNK( 255, LoadOldDepot ),
|
|
|
OCL_ASSERT( 0x4B26 ),
|
|
|
|
|
|
OCL_VAR ( OC_UINT32, 1, &_old_cur_town_ctr ),
|
|
@@ -1551,16 +1574,12 @@ static bool LoadOldMain(LoadgameState *l
|
|
|
/* _old_map3 is changed in _map3_lo and _map3_hi */
|
|
|
for (i = 0; i < OLD_MAP_SIZE; i++) {
|
|
|
_m[i].m3 = _old_map3[i * 2];
|
|
|
_m[i].m4 = _old_map3[i * 2 + 1];
|
|
|
}
|
|
|
|
|
|
for (_animated_tile_count = 0; _animated_tile_count < 256; _animated_tile_count++) {
|
|
|
if (_animated_tile_list[_animated_tile_count] == 0) break;
|
|
|
}
|
|
|
|
|
|
for (i = 0; i < OLD_MAP_SIZE; i ++) {
|
|
|
switch (GetTileType(i)) {
|
|
|
case MP_STATION:
|
|
|
_m[i].m4 = 0; // We do not understand this TTDP station mapping (yet)
|
|
|
switch (_m[i].m5) {
|
|
|
/* We have drive through stops at a totally different place */
|