mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
save floor/ceiling offsets, fix interpolation (#2226)
This commit is contained in:
parent
1885278d4d
commit
472cc85b62
38
src/g_game.c
38
src/g_game.c
@ -2199,7 +2199,16 @@ static void G_DoPlayDemo(void)
|
|||||||
// killough 2/22/98: version id string format for savegames
|
// killough 2/22/98: version id string format for savegames
|
||||||
#define VERSIONID "MBF %d"
|
#define VERSIONID "MBF %d"
|
||||||
|
|
||||||
#define CURRENT_SAVE_VERSION "Woof 15.0.0"
|
#define CURRENT_SAVE_VERSION "Woof 16.0.0"
|
||||||
|
|
||||||
|
static const char *saveg_versions[] =
|
||||||
|
{
|
||||||
|
[saveg_woof510] = "Woof 5.1.0",
|
||||||
|
[saveg_woof600] = "Woof 6.0.0",
|
||||||
|
[saveg_woof1300] = "Woof 13.0.0",
|
||||||
|
[saveg_woof1500] = "Woof 15.0.0",
|
||||||
|
[saveg_current] = CURRENT_SAVE_VERSION
|
||||||
|
};
|
||||||
|
|
||||||
static char *savename = NULL;
|
static char *savename = NULL;
|
||||||
|
|
||||||
@ -2511,14 +2520,6 @@ static void G_DoSaveAutoSave(void)
|
|||||||
DoSaveGame(name);
|
DoSaveGame(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CheckSaveVersion(const char *str, saveg_compat_t ver)
|
|
||||||
{
|
|
||||||
if (strncmp((char *) save_p, str, strlen(str)) == 0)
|
|
||||||
{
|
|
||||||
saveg_compat = ver;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean DoLoadGame(boolean do_load_autosave)
|
static boolean DoLoadGame(boolean do_load_autosave)
|
||||||
{
|
{
|
||||||
int length, i;
|
int length, i;
|
||||||
@ -2549,10 +2550,21 @@ static boolean DoLoadGame(boolean do_load_autosave)
|
|||||||
// killough 2/22/98: "proprietary" version string :-)
|
// killough 2/22/98: "proprietary" version string :-)
|
||||||
sprintf (vcheck,VERSIONID,MBFVERSION);
|
sprintf (vcheck,VERSIONID,MBFVERSION);
|
||||||
|
|
||||||
CheckSaveVersion(vcheck, saveg_mbf);
|
if (strncmp((char *)save_p, vcheck, VERSIONSIZE) == 0)
|
||||||
CheckSaveVersion("Woof 6.0.0", saveg_woof600);
|
{
|
||||||
CheckSaveVersion("Woof 13.0.0", saveg_woof1300);
|
saveg_compat = saveg_mbf;
|
||||||
CheckSaveVersion(CURRENT_SAVE_VERSION, saveg_current);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = saveg_woof510; i < arrlen(saveg_versions); ++i)
|
||||||
|
{
|
||||||
|
if (strncmp((char *)save_p, saveg_versions[i], VERSIONSIZE) == 0)
|
||||||
|
{
|
||||||
|
saveg_compat = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// killough 2/22/98: Friendly savegame version difference message
|
// killough 2/22/98: Friendly savegame version difference message
|
||||||
if (!forced_loadgame && saveg_compat != saveg_mbf && saveg_compat < saveg_woof600)
|
if (!forced_loadgame && saveg_compat != saveg_mbf && saveg_compat < saveg_woof600)
|
||||||
|
@ -2119,6 +2119,11 @@ void P_ArchiveWorld (void)
|
|||||||
saveg_write16(sec->lightlevel);
|
saveg_write16(sec->lightlevel);
|
||||||
saveg_write16(sec->special); // needed? yes -- transfer types
|
saveg_write16(sec->special); // needed? yes -- transfer types
|
||||||
saveg_write16(sec->tag); // needed? need them -- killough
|
saveg_write16(sec->tag); // needed? need them -- killough
|
||||||
|
|
||||||
|
saveg_write32(sec->floor_xoffs);
|
||||||
|
saveg_write32(sec->floor_yoffs);
|
||||||
|
saveg_write32(sec->ceiling_xoffs);
|
||||||
|
saveg_write32(sec->ceiling_yoffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do lines
|
// do lines
|
||||||
@ -2182,6 +2187,18 @@ void P_UnArchiveWorld (void)
|
|||||||
sec->lightingdata = 0;
|
sec->lightingdata = 0;
|
||||||
sec->soundtarget = 0;
|
sec->soundtarget = 0;
|
||||||
|
|
||||||
|
if (saveg_compat > saveg_woof1500)
|
||||||
|
{
|
||||||
|
sec->floor_xoffs = saveg_read32();
|
||||||
|
sec->floor_yoffs = saveg_read32();
|
||||||
|
sec->ceiling_xoffs = saveg_read32();
|
||||||
|
sec->ceiling_yoffs = saveg_read32();
|
||||||
|
sec->base_floor_xoffs = sec->old_floor_xoffs = sec->floor_xoffs;
|
||||||
|
sec->base_floor_yoffs = sec->old_floor_yoffs = sec->floor_yoffs;
|
||||||
|
sec->base_ceiling_xoffs = sec->old_ceiling_xoffs = sec->ceiling_xoffs;
|
||||||
|
sec->base_ceiling_yoffs = sec->old_ceiling_yoffs = sec->ceiling_yoffs;
|
||||||
|
}
|
||||||
|
|
||||||
// [crispy] add overflow guard for the flattranslation[] array
|
// [crispy] add overflow guard for the flattranslation[] array
|
||||||
if (floorpic >= 0 && floorpic < numflats &&
|
if (floorpic >= 0 && floorpic < numflats &&
|
||||||
W_LumpLength(firstflat + floorpic) >= 64*64)
|
W_LumpLength(firstflat + floorpic) >= 64*64)
|
||||||
|
@ -51,13 +51,14 @@ void saveg_write32(int value);
|
|||||||
int64_t saveg_read64(void);
|
int64_t saveg_read64(void);
|
||||||
void saveg_write64(int64_t value);
|
void saveg_write64(int64_t value);
|
||||||
|
|
||||||
typedef enum saveg_compat_e
|
typedef enum
|
||||||
{
|
{
|
||||||
saveg_mbf,
|
saveg_mbf,
|
||||||
saveg_woof510,
|
saveg_woof510,
|
||||||
saveg_woof600,
|
saveg_woof600,
|
||||||
saveg_woof1300,
|
saveg_woof1300,
|
||||||
saveg_current, // saveg_woof1500
|
saveg_woof1500,
|
||||||
|
saveg_current, // saveg_woof1600
|
||||||
} saveg_compat_t;
|
} saveg_compat_t;
|
||||||
|
|
||||||
extern saveg_compat_t saveg_compat;
|
extern saveg_compat_t saveg_compat;
|
||||||
|
@ -2696,8 +2696,6 @@ void T_Scroll(scroll_t *s)
|
|||||||
}
|
}
|
||||||
side->basetextureoffset += dx;
|
side->basetextureoffset += dx;
|
||||||
side->baserowoffset += dy;
|
side->baserowoffset += dy;
|
||||||
side->textureoffset = side->basetextureoffset;
|
|
||||||
side->rowoffset = side->baserowoffset;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case sc_floor: // killough 3/7/98: Scroll floor texture
|
case sc_floor: // killough 3/7/98: Scroll floor texture
|
||||||
@ -2710,8 +2708,6 @@ void T_Scroll(scroll_t *s)
|
|||||||
}
|
}
|
||||||
sec->base_floor_xoffs += dx;
|
sec->base_floor_xoffs += dx;
|
||||||
sec->base_floor_yoffs += dy;
|
sec->base_floor_yoffs += dy;
|
||||||
sec->floor_xoffs = sec->base_floor_xoffs;
|
|
||||||
sec->floor_yoffs = sec->base_floor_yoffs;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case sc_ceiling: // killough 3/7/98: Scroll ceiling texture
|
case sc_ceiling: // killough 3/7/98: Scroll ceiling texture
|
||||||
@ -2724,8 +2720,6 @@ void T_Scroll(scroll_t *s)
|
|||||||
}
|
}
|
||||||
sec->base_ceiling_xoffs += dx;
|
sec->base_ceiling_xoffs += dx;
|
||||||
sec->base_ceiling_yoffs += dy;
|
sec->base_ceiling_yoffs += dy;
|
||||||
sec->ceiling_xoffs = sec->base_ceiling_xoffs;
|
|
||||||
sec->ceiling_yoffs = sec->base_ceiling_yoffs;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case sc_carry:
|
case sc_carry:
|
||||||
|
20
src/r_bsp.c
20
src/r_bsp.c
@ -311,16 +311,31 @@ static void R_MaybeInterpolateSector(sector_t* sector)
|
|||||||
sector->floor_xoffs = LerpFixed(sector->old_floor_xoffs, sector->base_floor_xoffs);
|
sector->floor_xoffs = LerpFixed(sector->old_floor_xoffs, sector->base_floor_xoffs);
|
||||||
sector->floor_yoffs = LerpFixed(sector->old_floor_yoffs, sector->base_floor_yoffs);
|
sector->floor_yoffs = LerpFixed(sector->old_floor_yoffs, sector->base_floor_yoffs);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sector->floor_xoffs = sector->base_floor_xoffs;
|
||||||
|
sector->floor_yoffs = sector->base_floor_yoffs;
|
||||||
|
}
|
||||||
|
|
||||||
if (sector->old_ceil_offs_gametic == gametic - 1)
|
if (sector->old_ceil_offs_gametic == gametic - 1)
|
||||||
{
|
{
|
||||||
sector->ceiling_xoffs = LerpFixed(sector->old_ceiling_xoffs, sector->base_ceiling_xoffs);
|
sector->ceiling_xoffs = LerpFixed(sector->old_ceiling_xoffs, sector->base_ceiling_xoffs);
|
||||||
sector->ceiling_yoffs = LerpFixed(sector->old_ceiling_yoffs, sector->base_ceiling_yoffs);
|
sector->ceiling_yoffs = LerpFixed(sector->old_ceiling_yoffs, sector->base_ceiling_yoffs);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sector->ceiling_xoffs = sector->base_ceiling_xoffs;
|
||||||
|
sector->ceiling_yoffs = sector->base_ceiling_yoffs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sector->interpfloorheight = sector->floorheight;
|
sector->interpfloorheight = sector->floorheight;
|
||||||
sector->interpceilingheight = sector->ceilingheight;
|
sector->interpceilingheight = sector->ceilingheight;
|
||||||
|
sector->floor_xoffs = sector->base_floor_xoffs;
|
||||||
|
sector->floor_yoffs = sector->base_floor_yoffs;
|
||||||
|
sector->ceiling_xoffs = sector->base_ceiling_xoffs;
|
||||||
|
sector->ceiling_yoffs = sector->base_ceiling_yoffs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,6 +346,11 @@ static void R_MaybeInterpolateTextureOffsets(side_t *side)
|
|||||||
side->textureoffset = LerpFixed(side->oldtextureoffset, side->basetextureoffset);
|
side->textureoffset = LerpFixed(side->oldtextureoffset, side->basetextureoffset);
|
||||||
side->rowoffset = LerpFixed(side->oldrowoffset, side->baserowoffset);
|
side->rowoffset = LerpFixed(side->oldrowoffset, side->baserowoffset);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
side->textureoffset = side->basetextureoffset;
|
||||||
|
side->rowoffset = side->baserowoffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user