Due to increased size of MAX_SEGMENTS old savegames became incompatible. To compensate added MAX_SEGMENTS_ORIGINAL with the original segment amount and read certain savegame info with this info when dealing with standard-sized levels and use Highest_segment_index when dealing with larger levels which are incompatible with older versions of the game anyways. Makes savegame site more efficient and still maintain backwards compability

This commit is contained in:
zicodxx 2011-05-04 15:07:53 +02:00
parent cdbf6c0485
commit 5f5b5b415f
3 changed files with 20 additions and 4 deletions

View file

@ -7,6 +7,7 @@ main/endlevel.c: Make sure the big explosion at the end of the escape sequence a
main/multi.c: Fix crash in multi_maybe_disable_friendly_fire() when killer == NULL
2d/font.c: mipmapping was always on for fonts due to changed filtering code in ogl.c
main/physics.c: To compensate fewer FVI runs in lower FPS and wall penetration caused by strong forces allowed fix_illegal_wall_intersection() to move an object out of the wall half it's size improving the collisions once more
main/segment.h, main/state.c: Due to increased size of MAX_SEGMENTS old savegames became incompatible. To compensate added MAX_SEGMENTS_ORIGINAL with the original segment amount and read certain savegame info with this info when dealing with standard-sized levels and use Highest_segment_index when dealing with larger levels which are incompatible with older versions of the game anyways. Makes savegame site more efficient and still maintain backwards compability
20110424
--------

View file

@ -46,8 +46,10 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#define WBACK 4
#define WFRONT 5
#define MAX_SEGMENTS 9000
#define MAX_SEGMENT_VERTICES (4*MAX_SEGMENTS)
#define MAX_SEGMENTS_ORIGINAL 900
#define MAX_SEGMENT_VERTICES_ORIGINAL (4*MAX_SEGMENTS_ORIGINAL)
#define MAX_SEGMENTS 9000
#define MAX_SEGMENT_VERTICES (4*MAX_SEGMENTS)
//normal everyday vertices

View file

@ -1018,7 +1018,13 @@ int state_save_all_sub(char *filename, char *desc)
ai_save_state( fp );
// Save the automap visited info
PHYSFS_write(fp, Automap_visited, sizeof(ubyte), MAX_SEGMENTS);
if ( Highest_segment_index+1 > MAX_SEGMENTS_ORIGINAL )
{
for ( i = 0; i <= Highest_segment_index; i++ )
PHYSFS_write(fp, Automap_visited, sizeof(ubyte), 1);
}
else
PHYSFS_write(fp, Automap_visited, sizeof(ubyte), MAX_SEGMENTS_ORIGINAL);
PHYSFS_write(fp, &state_game_id, sizeof(uint), 1);
i = 0;
@ -1352,7 +1358,14 @@ RetryObjectLoading:
ai_restore_state( fp, swap );
// Restore the automap visited info
PHYSFS_read(fp, Automap_visited, sizeof(ubyte), MAX_SEGMENTS);
if ( Highest_segment_index+1 > MAX_SEGMENTS_ORIGINAL )
{
memset(&Automap_visited, 0, MAX_SEGMENTS);
for ( i = 0; i <= Highest_segment_index; i++ )
PHYSFS_read(fp, Automap_visited, sizeof(ubyte), 1);
}
else
PHYSFS_read(fp, Automap_visited, sizeof(ubyte), MAX_SEGMENTS_ORIGINAL);
// Restore hacked up weapon system stuff.
Auto_fire_fusion_cannon_time = 0;