From 7a3748fd12f76b2c84d087f4ccec7c281cb830cb Mon Sep 17 00:00:00 2001 From: James Haley Date: Sun, 3 Oct 2010 16:45:53 +0000 Subject: Added beginnings of Strife hub save code. ATTN fraggle: please add m_saves.c to other platform builds. See also email regarding opendir etc. Subversion-branch: /branches/strife-branch Subversion-revision: 2151 --- msvc/strife.vcproj | 8 +++ src/m_config.c | 2 +- src/strife/m_saves.c | 117 +++++++++++++++++++++++++++++++++ src/strife/m_saves.h | 40 ++++++++++++ src/strife/p_saveg.c | 180 +++++++++++++++++++++++++++------------------------ src/strife/r_draw.c | 8 +-- 6 files changed, 263 insertions(+), 92 deletions(-) create mode 100644 src/strife/m_saves.c create mode 100644 src/strife/m_saves.h diff --git a/msvc/strife.vcproj b/msvc/strife.vcproj index e7bc4612..2caf71a1 100644 --- a/msvc/strife.vcproj +++ b/msvc/strife.vcproj @@ -496,6 +496,10 @@ RelativePath="..\src\strife\m_random.h" > + + @@ -904,6 +908,10 @@ RelativePath="..\src\strife\m_random.c" > + + diff --git a/src/m_config.c b/src/m_config.c index d3085b05..8332750b 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -1198,7 +1198,7 @@ static default_t extra_defaults_list[] = // Key to send a message to player 8 during multiplayer games. // - CONFIG_VARIABLE_KEY(key_multi_msgplayer8) + CONFIG_VARIABLE_KEY(key_multi_msgplayer8), }; static default_collection_t extra_defaults = diff --git a/src/strife/m_saves.c b/src/strife/m_saves.c new file mode 100644 index 00000000..bec0fede --- /dev/null +++ b/src/strife/m_saves.c @@ -0,0 +1,117 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 1993-1996 Id Software, Inc. +// Copyright(C) 1996 Rogue Entertainment / Velocity, Inc. +// Copyright(C) 2010 James Haley, Samuel Villareal +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +// DESCRIPTION: +// +// [STRIFE] New Module +// +// Strife Hub Saving Code +// +//----------------------------------------------------------------------------- + +#include "z_zone.h" +#include "i_system.h" +#include "d_player.h" +#include "deh_str.h" +#include "m_misc.h" +#include "p_dialog.h" + +// +// ClearTmp +// +// Clear the temporary save directory +// +void ClearTmp(void) +{ +} + +// +// ClearSlot +// +// Clear a single save slot folder +// +void ClearSlot(void) +{ +} + +// +// FromCurr +// +// Moving files from one directory to another... +// STRIFE-TODO: figure out exactly what this is for. +// +void FromCurr(void) +{ +} + +// +// ????? +// +// More file moving; don't even know what to call it yet. +// +void sub_1B2F4(void) +{ +} + +// +// M_SaveMoveMapToHere +// +// Moves a map to the "HERE" save. +// +void M_SaveMoveMapToHere(void) +{ +} + +// +// M_SaveMoveHereToMap +// +// Moves the "HERE" save to a map. +// +void M_SaveMoveHereToMap(void) +{ +} + +// +// M_SaveMisObj +// +// Writes the mission objective into the MIS_OBJ file. +// +boolean M_SaveMisObj(const char *path) +{ + char destpath[100]; // WARNING: not large enough for modern file paths! + + DEH_snprintf(destpath, sizeof(destpath), "%smis_obj", path); + return M_WriteFile(destpath, mission_objective, OBJECTIVE_LEN); +} + +// +// M_ReadMisObj +// +// Reads the mission objective from the MIS_OBJ file. +// +void M_ReadMisObj(void) +{ +} + +// EOF + + diff --git a/src/strife/m_saves.h b/src/strife/m_saves.h new file mode 100644 index 00000000..9b587c81 --- /dev/null +++ b/src/strife/m_saves.h @@ -0,0 +1,40 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 1993-1996 Id Software, Inc. +// Copyright(C) 1996 Rogue Entertainment / Velocity, Inc. +// Copyright(C) 2010 James Haley, Samuel Villareal +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +// DESCRIPTION: +// +// [STRIFE] New Module +// +// Strife Hub Saving Code +// +//----------------------------------------------------------------------------- + +#ifndef M_SAVES_H__ +#define M_SAVES_H__ + +boolean M_SaveMisObj(const char *path); + +#endif + +// EOF + + diff --git a/src/strife/p_saveg.c b/src/strife/p_saveg.c index f7b8477b..a5bdd3d5 100644 --- a/src/strife/p_saveg.c +++ b/src/strife/p_saveg.c @@ -1991,7 +1991,7 @@ enum // // T_MoveCeiling, (ceiling_t: sector_t * swizzle), - active list // T_VerticalDoor, (vldoor_t: sector_t * swizzle), -// T_SlidingDoor, (slidedoor_t: sector_t *, line_t * x 2 swizzle) +// T_SlidingDoor, (slidedoor_t: sector_t *, line_t * x 2 swizzle) [STRIFE] // T_MoveFloor, (floormove_t: sector_t * swizzle), // T_LightFlash, (lightflash_t: sector_t * swizzle), // T_StrobeFlash, (strobe_t: sector_t *), @@ -2041,6 +2041,7 @@ void P_ArchiveSpecials (void) { saveg_write8(tc_slidingdoor); saveg_write_pad(); + saveg_write_slidedoor_t((slidedoor_t *)th); continue; } @@ -2095,100 +2096,109 @@ void P_ArchiveSpecials (void) // void P_UnArchiveSpecials (void) { - byte tclass; - ceiling_t* ceiling; - vldoor_t* door; - floormove_t* floor; - plat_t* plat; - lightflash_t* flash; - strobe_t* strobe; - glow_t* glow; - - + byte tclass; + ceiling_t* ceiling; + vldoor_t* door; + slidedoor_t* slidedoor; // haleyjd [STRIFE] + floormove_t* floor; + plat_t* plat; + lightflash_t* flash; + strobe_t* strobe; + glow_t* glow; + + // read in saved thinkers while (1) { - tclass = saveg_read8(); - - switch (tclass) - { - case tc_endspecials: - return; // end of list - - case tc_ceiling: - saveg_read_pad(); - ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVEL, NULL); + tclass = saveg_read8(); + + switch (tclass) + { + case tc_endspecials: + return; // end of list + + case tc_ceiling: + saveg_read_pad(); + ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVEL, NULL); saveg_read_ceiling_t(ceiling); - ceiling->sector->specialdata = ceiling; - - if (ceiling->thinker.function.acp1) - ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling; - - P_AddThinker (&ceiling->thinker); - P_AddActiveCeiling(ceiling); - break; - - case tc_door: - saveg_read_pad(); - door = Z_Malloc (sizeof(*door), PU_LEVEL, NULL); + ceiling->sector->specialdata = ceiling; + + if (ceiling->thinker.function.acp1) + ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling; + + P_AddThinker (&ceiling->thinker); + P_AddActiveCeiling(ceiling); + break; + + case tc_door: + saveg_read_pad(); + door = Z_Malloc (sizeof(*door), PU_LEVEL, NULL); saveg_read_vldoor_t(door); - door->sector->specialdata = door; - door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor; - P_AddThinker (&door->thinker); - break; - - case tc_floor: - saveg_read_pad(); - floor = Z_Malloc (sizeof(*floor), PU_LEVEL, NULL); + door->sector->specialdata = door; + door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor; + P_AddThinker (&door->thinker); + break; + + case tc_slidingdoor: + // haleyjd 09/29/10: [STRIFE] New thinker type for sliding doors + saveg_read_pad(); + slidedoor = Z_Malloc(sizeof(*slidedoor), PU_LEVEL, NULL); + saveg_read_slidedoor_t(slidedoor); + slidedoor->frontsector->specialdata = slidedoor; + slidedoor->thinker.function.acp1 = (actionf_p1)T_SlidingDoor; + P_AddThinker(&slidedoor->thinker); + break; + + case tc_floor: + saveg_read_pad(); + floor = Z_Malloc (sizeof(*floor), PU_LEVEL, NULL); saveg_read_floormove_t(floor); - floor->sector->specialdata = floor; - floor->thinker.function.acp1 = (actionf_p1)T_MoveFloor; - P_AddThinker (&floor->thinker); - break; - - case tc_plat: - saveg_read_pad(); - plat = Z_Malloc (sizeof(*plat), PU_LEVEL, NULL); + floor->sector->specialdata = floor; + floor->thinker.function.acp1 = (actionf_p1)T_MoveFloor; + P_AddThinker (&floor->thinker); + break; + + case tc_plat: + saveg_read_pad(); + plat = Z_Malloc (sizeof(*plat), PU_LEVEL, NULL); saveg_read_plat_t(plat); - plat->sector->specialdata = plat; - - if (plat->thinker.function.acp1) - plat->thinker.function.acp1 = (actionf_p1)T_PlatRaise; - - P_AddThinker (&plat->thinker); - P_AddActivePlat(plat); - break; - - case tc_flash: - saveg_read_pad(); - flash = Z_Malloc (sizeof(*flash), PU_LEVEL, NULL); + plat->sector->specialdata = plat; + + if (plat->thinker.function.acp1) + plat->thinker.function.acp1 = (actionf_p1)T_PlatRaise; + + P_AddThinker (&plat->thinker); + P_AddActivePlat(plat); + break; + + case tc_flash: + saveg_read_pad(); + flash = Z_Malloc (sizeof(*flash), PU_LEVEL, NULL); saveg_read_lightflash_t(flash); - flash->thinker.function.acp1 = (actionf_p1)T_LightFlash; - P_AddThinker (&flash->thinker); - break; - - case tc_strobe: - saveg_read_pad(); - strobe = Z_Malloc (sizeof(*strobe), PU_LEVEL, NULL); + flash->thinker.function.acp1 = (actionf_p1)T_LightFlash; + P_AddThinker (&flash->thinker); + break; + + case tc_strobe: + saveg_read_pad(); + strobe = Z_Malloc (sizeof(*strobe), PU_LEVEL, NULL); saveg_read_strobe_t(strobe); - strobe->thinker.function.acp1 = (actionf_p1)T_StrobeFlash; - P_AddThinker (&strobe->thinker); - break; - - case tc_glow: - saveg_read_pad(); - glow = Z_Malloc (sizeof(*glow), PU_LEVEL, NULL); + strobe->thinker.function.acp1 = (actionf_p1)T_StrobeFlash; + P_AddThinker (&strobe->thinker); + break; + + case tc_glow: + saveg_read_pad(); + glow = Z_Malloc (sizeof(*glow), PU_LEVEL, NULL); saveg_read_glow_t(glow); - glow->thinker.function.acp1 = (actionf_p1)T_Glow; - P_AddThinker (&glow->thinker); - break; - - default: - I_Error ("P_UnarchiveSpecials:Unknown tclass %i " - "in savegame",tclass); - } - - } + glow->thinker.function.acp1 = (actionf_p1)T_Glow; + P_AddThinker (&glow->thinker); + break; + default: + I_Error ("P_UnarchiveSpecials:Unknown tclass %i " + "in savegame",tclass); + } + } } diff --git a/src/strife/r_draw.c b/src/strife/r_draw.c index bfe3470f..d6c6b6f9 100644 --- a/src/strife/r_draw.c +++ b/src/strife/r_draw.c @@ -458,13 +458,9 @@ void R_InitTranslationTables (void) // LOWORD(v8) = 0; // aligning to a 64K boundary, as if this is Wolf3D. // xlatab = v8; // memcpy(v8, v7, 65536); - // memcpy(v8+65536, v7+65536, 0); // 0 bytes, does nothing! // As you can see, they copypasta'd id's unnecessary 64K boundary alignment - // from the colormap code, and then evidently at some point dropped the high - // side of the presumably 128KB lump (because it is redundant data), but - // just set the 2nd memset call's length to 0 bytes... Terrible. Since none - // of this accomplishes anything, and isn't strictly portable, all we need - // to do is this: + // from the colormap code. Since this doesn't accomplish anything, and isn't + // strictly portable, all we need to do is this: // villsa [STRIFE] 09/26/10: load table through this function instead V_LoadXlaTable(); -- cgit v1.2.3