2019-09-19 22:42:45 +00:00
//-------------------------------------------------------------------------
/*
2023-09-26 19:09:35 +00:00
Copyright ( C ) 2020 - 2022 Christoph Oelckers
2019-09-19 22:42:45 +00:00
2020-11-22 15:47:08 +00:00
This file is part of Raze
2019-09-19 22:42:45 +00:00
2020-11-22 15:47:08 +00:00
Raze is free software ; you can redistribute it and / or
2019-09-19 22:42:45 +00:00
modify it under the terms of the GNU General Public License version 2
2020-11-22 15:47:08 +00:00
of the License , or ( at your option ) any later version .
2019-09-19 22:42:45 +00:00
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 .
*/
//-------------------------------------------------------------------------
2020-11-22 15:47:08 +00:00
2019-09-21 18:59:54 +00:00
# include "ns.h" // Must come before everything else!
2019-09-19 22:42:45 +00:00
# include <stdio.h>
# include "build.h"
2020-12-09 14:56:32 +00:00
2019-09-19 22:42:45 +00:00
# include "blood.h"
2019-11-01 23:38:30 +00:00
# include "i_specialpaths.h"
2019-11-14 20:07:43 +00:00
# include "savegamehelp.h"
2020-04-12 06:07:48 +00:00
# include "raze_music.h"
2019-12-10 21:22:59 +00:00
# include "mapinfo.h"
2020-07-29 21:18:08 +00:00
# include "gamestate.h"
2020-09-01 21:34:04 +00:00
# include "d_net.h"
2020-02-11 23:22:11 +00:00
2019-09-22 06:39:22 +00:00
BEGIN_BLD_NS
2021-12-16 10:52:19 +00:00
void validateLinks ( ) ;
2020-02-11 23:22:11 +00:00
// All AI states for assigning an index.
2021-12-29 21:56:21 +00:00
static AISTATE * const allAIStates [ ] =
2020-02-11 23:22:11 +00:00
{
2020-11-22 15:47:08 +00:00
nullptr ,
& genIdle ,
& genRecoil ,
& batIdle ,
& batFlyIdle ,
& batChase ,
& batPonder ,
& batGoto ,
& batBite ,
& batRecoil ,
& batSearch ,
& batSwoop ,
& batFly ,
& batTurn ,
& batHide ,
& batDodgeUp ,
& batDodgeUpRight ,
& batDodgeUpLeft ,
& batDodgeDown ,
& batDodgeDownRight ,
& batDodgeDownLeft ,
& beastIdle ,
& beastChase ,
& beastDodge ,
& beastGoto ,
& beastSlash ,
& beastStomp ,
& beastSearch ,
& beastRecoil ,
& beastTeslaRecoil ,
& beastSwimIdle ,
& beastSwimChase ,
& beastSwimDodge ,
& beastSwimGoto ,
& beastSwimSearch ,
& beastSwimSlash ,
& beastSwimRecoil ,
& beastMorphToBeast ,
& beastMorphFromCultist ,
& beast138FB4 ,
& beast138FD0 ,
& beast138FEC ,
& eelIdle ,
& eelFlyIdle ,
& eelChase ,
& eelPonder ,
& eelGoto ,
& eelBite ,
& eelRecoil ,
& eelSearch ,
& eelSwoop ,
& eelFly ,
& eelTurn ,
& eelHide ,
& eelDodgeUp ,
& eelDodgeUpRight ,
& eelDodgeUpLeft ,
& eelDodgeDown ,
& eelDodgeDownRight ,
& eelDodgeDownLeft ,
& cultistBurnIdle ,
& cultistBurnChase ,
& cultistBurnGoto ,
& cultistBurnSearch ,
& cultistBurnAttack ,
& zombieABurnChase ,
& zombieABurnGoto ,
& zombieABurnSearch ,
& zombieABurnAttack ,
& zombieFBurnChase ,
& zombieFBurnGoto ,
& zombieFBurnSearch ,
& zombieFBurnAttack ,
& innocentBurnChase ,
& innocentBurnGoto ,
& innocentBurnSearch ,
& innocentBurnAttack ,
& beastBurnChase ,
& beastBurnGoto ,
& beastBurnSearch ,
& beastBurnAttack ,
& tinycalebBurnChase ,
& tinycalebBurnGoto ,
& tinycalebBurnSearch ,
& tinycalebBurnAttack ,
& genDudeBurnIdle ,
& genDudeBurnChase ,
& genDudeBurnGoto ,
& genDudeBurnSearch ,
& genDudeBurnAttack ,
& tinycalebIdle ,
& tinycalebChase ,
& tinycalebDodge ,
& tinycalebGoto ,
& tinycalebAttack ,
& tinycalebSearch ,
& tinycalebRecoil ,
& tinycalebTeslaRecoil ,
& tinycalebSwimIdle ,
& tinycalebSwimChase ,
& tinycalebSwimDodge ,
& tinycalebSwimGoto ,
& tinycalebSwimSearch ,
& tinycalebSwimAttack ,
& tinycalebSwimRecoil ,
& tinycaleb139660 ,
& tinycaleb13967C ,
& tinycaleb139698 ,
& cerberusIdle ,
& cerberusSearch ,
& cerberusChase ,
& cerberusRecoil ,
& cerberusTeslaRecoil ,
& cerberusGoto ,
& cerberusBite ,
& cerberusBurn ,
& cerberus3Burn ,
& cerberus2Idle ,
& cerberus2Search ,
& cerberus2Chase ,
& cerberus2Recoil ,
& cerberus2Goto ,
& cerberus2Bite ,
& cerberus2Burn ,
& cerberus4Burn ,
& cerberus139890 ,
& cerberus1398AC ,
& cultistIdle ,
& cultistProneIdle ,
& fanaticProneIdle ,
& cultistProneIdle3 ,
& cultistChase ,
& fanaticChase ,
& cultistDodge ,
& cultistGoto ,
& cultistProneChase ,
& cultistProneDodge ,
& cultistTThrow ,
& cultistSThrow ,
& cultistTsThrow ,
& cultistDThrow ,
& cultist139A78 ,
& cultist139A94 ,
& cultist139AB0 ,
& cultist139ACC ,
& cultist139AE8 ,
& cultistSearch ,
& cultistSFire ,
& cultistTFire ,
& cultistTsFire ,
& cultistSProneFire ,
& cultistTProneFire ,
& cultistTsProneFire ,
& cultistRecoil ,
& cultistProneRecoil ,
& cultistTeslaRecoil ,
& cultistSwimIdle ,
& cultistSwimChase ,
& cultistSwimDodge ,
& cultistSwimGoto ,
& cultistSwimSearch ,
& cultistSSwimFire ,
& cultistTSwimFire ,
& cultistTsSwimFire ,
& cultistSwimRecoil ,
& gargoyleFIdle ,
& gargoyleStatueIdle ,
& gargoyleFChase ,
& gargoyleFGoto ,
& gargoyleFSlash ,
& gargoyleFThrow ,
& gargoyleSThrow ,
& gargoyleSBlast ,
& gargoyleFRecoil ,
& gargoyleFSearch ,
& gargoyleFMorph2 ,
& gargoyleFMorph ,
& gargoyleSMorph2 ,
& gargoyleSMorph ,
& gargoyleSwoop ,
& gargoyleFly ,
& gargoyleTurn ,
& gargoyleDodgeUp ,
& gargoyleFDodgeUpRight ,
& gargoyleFDodgeUpLeft ,
& gargoyleDodgeDown ,
& gargoyleFDodgeDownRight ,
& gargoyleFDodgeDownLeft ,
& statueFBreakSEQ ,
& statueSBreakSEQ ,
& ghostIdle ,
& ghostChase ,
& ghostGoto ,
& ghostSlash ,
& ghostThrow ,
& ghostBlast ,
& ghostRecoil ,
& ghostTeslaRecoil ,
& ghostSearch ,
& ghostSwoop ,
& ghostFly ,
& ghostTurn ,
& ghostDodgeUp ,
& ghostDodgeUpRight ,
& ghostDodgeUpLeft ,
& ghostDodgeDown ,
& ghostDodgeDownRight ,
& ghostDodgeDownLeft ,
& gillBeastIdle ,
& gillBeastChase ,
& gillBeastDodge ,
& gillBeastGoto ,
& gillBeastBite ,
& gillBeastSearch ,
& gillBeastRecoil ,
& gillBeastSwimIdle ,
& gillBeastSwimChase ,
& gillBeastSwimDodge ,
& gillBeastSwimGoto ,
& gillBeastSwimSearch ,
& gillBeastSwimBite ,
& gillBeastSwimRecoil ,
& gillBeast13A138 ,
& gillBeast13A154 ,
& gillBeast13A170 ,
& handIdle ,
& hand13A3B4 ,
& handSearch ,
& handChase ,
& handRecoil ,
& handGoto ,
& handJump ,
& houndIdle ,
& houndSearch ,
& houndChase ,
& houndRecoil ,
& houndTeslaRecoil ,
& houndGoto ,
& houndBite ,
& houndBurn ,
& innocentIdle ,
& innocentSearch ,
& innocentChase ,
& innocentRecoil ,
& innocentTeslaRecoil ,
& innocentGoto ,
& podIdle ,
& podMove ,
& podSearch ,
& podStartChase ,
& podRecoil ,
& podChase ,
& tentacleIdle ,
& tentacle13A6A8 ,
& tentacle13A6C4 ,
& tentacle13A6E0 ,
& tentacle13A6FC ,
& tentacleMove ,
& tentacleSearch ,
& tentacleStartChase ,
& tentacleRecoil ,
& tentacleChase ,
& ratIdle ,
& ratSearch ,
& ratChase ,
& ratDodge ,
& ratRecoil ,
& ratGoto ,
& ratBite ,
& spidIdle ,
& spidChase ,
& spidDodge ,
& spidGoto ,
& spidSearch ,
& spidBite ,
& spidJump ,
2021-08-21 09:52:24 +00:00
& spidBirth ,
2020-11-22 15:47:08 +00:00
& tchernobogIdle ,
& tchernobogSearch ,
& tchernobogChase ,
& tchernobogRecoil ,
& tcherno13A9B8 ,
& tcherno13A9D4 ,
& tcherno13A9F0 ,
& tcherno13AA0C ,
& tcherno13AA28 ,
& genDudeIdleL ,
& genDudeIdleW ,
& genDudeSearchL ,
& genDudeSearchW ,
& genDudeSearchShortL ,
& genDudeSearchShortW ,
& genDudeSearchNoWalkL ,
& genDudeSearchNoWalkW ,
& genDudeGotoL ,
& genDudeGotoW ,
& genDudeDodgeL ,
& genDudeDodgeD ,
& genDudeDodgeW ,
& genDudeDodgeShortL ,
& genDudeDodgeShortD ,
& genDudeDodgeShortW ,
& genDudeDodgeShorterL ,
& genDudeDodgeShorterD ,
& genDudeDodgeShorterW ,
& genDudeChaseL ,
& genDudeChaseD ,
& genDudeChaseW ,
& genDudeChaseNoWalkL ,
& genDudeChaseNoWalkD ,
& genDudeChaseNoWalkW ,
& genDudeFireL ,
& genDudeFireD ,
& genDudeFireW ,
& genDudeRecoilL ,
& genDudeRecoilD ,
& genDudeRecoilW ,
& genDudeRecoilTesla ,
& genDudeThrow ,
& genDudeThrow2 ,
& genDudePunch ,
& zombieAIdle ,
& zombieAChase ,
& zombieAPonder ,
& zombieAGoto ,
& zombieAHack ,
& zombieASearch ,
& zombieARecoil ,
& zombieATeslaRecoil ,
& zombieARecoil2 ,
& zombieAStand ,
& zombieEIdle ,
& zombieEUp2 ,
& zombieEUp ,
& zombie2Idle ,
& zombie2Search ,
& zombieSIdle ,
& zombie13AC2C ,
& zombieFIdle ,
& zombieFChase ,
& zombieFGoto ,
& zombieFDodge ,
& zombieFHack ,
& zombieFPuke ,
& zombieFThrow ,
& zombieFSearch ,
& zombieFRecoil ,
& zombieFTeslaRecoil ,
2020-02-11 23:22:11 +00:00
} ;
2021-12-29 21:56:21 +00:00
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
2020-11-22 15:47:08 +00:00
FSerializer & Serialize ( FSerializer & arc , const char * keyname , AISTATE * & w , AISTATE * * def )
2020-02-11 23:22:11 +00:00
{
2021-10-08 17:09:26 +00:00
unsigned i = 0 ;
2020-11-22 15:47:08 +00:00
if ( arc . isWriting ( ) )
{
2020-11-23 09:18:47 +00:00
if ( def & & w = = * def ) return arc ;
2020-11-22 15:47:08 +00:00
for ( auto cstate : allAIStates )
{
if ( w = = cstate )
{
arc ( keyname , i ) ;
2021-09-10 21:52:05 +00:00
return arc ;
2020-11-22 15:47:08 +00:00
}
i + + ;
}
2021-09-10 21:52:05 +00:00
if ( w > = genPatrolStates & & w < genPatrolStates + kPatrolStateSize )
{
i = int ( w - genPatrolStates ) + 1000 ;
arc ( keyname , i ) ;
}
2020-11-22 15:47:08 +00:00
}
2020-02-13 23:00:35 +00:00
else
{
2020-11-22 15:47:08 +00:00
arc ( keyname , i ) ;
2021-10-08 17:09:26 +00:00
if ( i < countof ( allAIStates ) )
2020-11-22 15:47:08 +00:00
{
w = allAIStates [ i ] ;
}
2021-09-10 21:52:05 +00:00
else if ( i > = 1000 & & i < 1000 + kPatrolStateSize )
{
2021-11-28 15:35:56 +00:00
w = genPatrolStates + ( i - 1000 ) ;
2021-09-10 21:52:05 +00:00
}
2020-11-22 15:47:08 +00:00
else
{
w = nullptr ;
}
2020-02-13 23:00:35 +00:00
}
2020-11-22 15:47:08 +00:00
return arc ;
2020-02-11 23:22:11 +00:00
}
2020-12-04 22:21:42 +00:00
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
FSerializer & Serialize ( FSerializer & arc , const char * keyname , DUDEEXTRA & w , DUDEEXTRA * def )
{
int empty = 0 ;
2021-11-16 17:30:23 +00:00
uint8_t empty2 = 0 ;
2020-12-04 22:21:42 +00:00
if ( arc . isReading ( ) ) w = { } ;
if ( arc . BeginObject ( keyname ) )
{
2021-10-07 06:32:19 +00:00
// Note: birthCounter/thinkTime are a union and share the same value (this is used for savefile backwards compatibility - see correct implementation below)
arc ( " time " , w . time , & empty )
( " teslaHit " , w . teslaHit , & empty2 )
( " prio " , w . prio , & empty )
( " thinkTime " , w . stats . thinkTime , & empty )
2021-12-20 18:01:16 +00:00
( " active " , w . stats . active , & empty2 )
. EndObject ( ) ;
2020-12-04 22:21:42 +00:00
}
return arc ;
}
2021-12-29 21:56:21 +00:00
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
2021-12-05 08:20:41 +00:00
void DBloodActor : : Serialize ( FSerializer & arc )
2020-11-07 15:26:14 +00:00
{
2021-12-05 08:20:41 +00:00
Super : : Serialize ( arc ) ;
2022-09-01 18:33:22 +00:00
arc
2022-01-01 14:52:05 +00:00
( " hasx " , hasx )
( " basepoint " , basePoint ) ;
2021-09-04 10:52:02 +00:00
2021-12-29 21:56:21 +00:00
// The rest is only relevant if the actor has an xsprite.
2021-12-05 08:20:41 +00:00
if ( hasX ( ) )
2021-12-29 21:56:21 +00:00
{
2021-12-22 08:49:00 +00:00
arc ( " xsprite " , xspr )
2022-09-28 16:20:26 +00:00
( " dudeslope " , dudeSlope )
2021-12-05 08:20:41 +00:00
( " dudeextra " , dudeExtra )
( " explosionflag " , explosionhackflag )
( " spritehit " , hit )
( " owneractor " , ownerActor ) ;
2021-09-01 19:53:33 +00:00
2022-01-01 14:52:05 +00:00
}
2021-09-05 08:09:59 +00:00
# ifdef NOONE_EXTENSIONS
2022-01-01 14:52:05 +00:00
if ( gModernMap )
{
arc ( " spritemass " , spriteMass )
( " prevmarker " , prevmarker )
. Array ( " conditions " , condition , 2 ) ;
2021-08-29 07:27:03 +00:00
2021-12-29 21:56:21 +00:00
2022-01-01 14:52:05 +00:00
// GenDudeExtra only contains valid info for kDudeModernCustom and kDudeModernCustomBurning so only save when needed as these are not small.
if ( spr . type = = kDudeModernCustom | | spr . type = = kDudeModernCustomBurning )
{
arc ( " gendudeextra " , genDudeExtra ) ;
2021-12-29 21:56:21 +00:00
}
}
2022-01-01 14:52:05 +00:00
# endif
2020-11-07 15:26:14 +00:00
}
2021-12-29 21:56:21 +00:00
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
2020-11-22 15:47:08 +00:00
FSerializer & Serialize ( FSerializer & arc , const char * keyname , XWALL & w , XWALL * def )
2019-09-19 22:42:45 +00:00
{
2020-11-23 10:32:54 +00:00
static XWALL nul ;
if ( ! def )
{
def = & nul ;
if ( arc . isReading ( ) ) w = { } ;
}
2020-11-22 15:47:08 +00:00
if ( arc . BeginObject ( keyname ) )
{
arc ( " flags " , w . flags , def - > flags )
( " busy " , w . busy , def - > busy )
( " data " , w . data , def - > data )
( " txid " , w . txID , def - > txID )
( " rxid " , w . rxID , def - > rxID )
( " busytime " , w . busyTime , def - > busyTime )
( " waittime " , w . waitTime , def - > waitTime )
( " command " , w . command , def - > command )
2021-12-30 10:26:39 +00:00
( " panxvel " , w . panVel . X , def - > panVel . X )
2021-12-30 10:27:28 +00:00
( " panyvel " , w . panVel . Y , def - > panVel . Y )
2020-11-22 15:47:08 +00:00
( " key " , w . key , def - > key )
. EndObject ( ) ;
}
return arc ;
2019-09-19 22:42:45 +00:00
}
2021-12-29 21:56:21 +00:00
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
2020-11-22 15:47:08 +00:00
FSerializer & Serialize ( FSerializer & arc , const char * keyname , XSECTOR & w , XSECTOR * def )
2019-09-19 22:42:45 +00:00
{
2020-11-23 10:32:54 +00:00
static XSECTOR nul ;
if ( ! def )
{
def = & nul ;
if ( arc . isReading ( ) ) w = { } ;
}
2020-11-22 15:47:08 +00:00
if ( arc . BeginObject ( keyname ) )
{
arc ( " flags " , w . flags , def - > flags )
( " busy " , w . busy , def - > busy )
( " data " , w . data , def - > data )
( " txid " , w . txID , def - > txID )
( " rxid " , w . rxID , def - > rxID )
2022-09-27 18:26:53 +00:00
( " offceilz " , w . offCeilZ , def - > offCeilZ )
( " onceilz " , w . onCeilZ , def - > onCeilZ )
( " offloorz " , w . offFloorZ , def - > offFloorZ )
( " onloorz " , w . onFloorZ , def - > onFloorZ )
2020-11-22 15:47:08 +00:00
( " windvel " , w . windVel , def - > windVel )
( " busytimea " , w . busyTimeA , def - > busyTimeA )
( " busytimeb " , w . busyTimeB , def - > busyTimeB )
( " waittimea " , w . waitTimeA , def - > waitTimeA )
( " waittimeb " , w . waitTimeB , def - > waitTimeB )
( " panangle " , w . panAngle , def - > panAngle )
( " marker0 " , w . marker0 , def - > marker0 )
( " marker1 " , w . marker1 , def - > marker1 )
2021-09-04 17:53:31 +00:00
( " basepath " , w . basePath , def - > basePath )
2021-09-05 06:41:44 +00:00
( " actordata " , w . actordata , def - > actordata )
2020-11-22 15:47:08 +00:00
( " windang " , w . windAng , def - > windAng )
( " bobtheta " , w . bobTheta , def - > bobTheta )
( " bobspeed " , w . bobSpeed , def - > bobSpeed )
( " busywavea " , w . busyWaveA , def - > busyWaveA )
( " busywaveb " , w . busyWaveB , def - > busyWaveB )
( " command " , w . command , def - > command )
( " amplitude " , w . amplitude , def - > amplitude )
( " freq " , w . freq , def - > freq )
( " phase " , w . phase , def - > phase )
( " wave " , w . wave , def - > wave )
( " shade " , w . shade , def - > shade )
( " panvel " , w . panVel , def - > panVel )
( " depth " , w . Depth , def - > Depth )
( " key " , w . Key , def - > Key )
( " ceilpal " , w . ceilpal , def - > ceilpal )
( " floorpal " , w . floorpal , def - > floorpal )
( " damagetype " , w . damageType , def - > damageType )
( " bobzrange " , w . bobZRange , def - > bobZRange )
. EndObject ( ) ;
}
return arc ;
2019-09-19 22:42:45 +00:00
}
2021-12-29 21:56:21 +00:00
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
2020-11-22 15:47:08 +00:00
FSerializer & Serialize ( FSerializer & arc , const char * keyname , XSPRITE & w , XSPRITE * def )
2019-09-19 22:42:45 +00:00
{
2020-11-23 09:18:47 +00:00
static XSPRITE nul ;
if ( ! def )
{
def = & nul ;
if ( arc . isReading ( ) ) w = { } ;
}
2020-11-22 15:47:08 +00:00
if ( arc . BeginObject ( keyname ) )
{
arc ( " flags " , w . flags , def - > flags )
2020-11-23 09:18:47 +00:00
( " aistate " , w . aiState , def - > aiState )
2020-11-22 15:47:08 +00:00
( " busy " , w . busy , def - > busy )
( " txid " , w . txID , def - > txID )
( " rxid " , w . rxID , def - > rxID )
( " command " , w . command , def - > command )
( " data1 " , w . data1 , def - > data1 )
( " data2 " , w . data2 , def - > data2 )
( " data3 " , w . data3 , def - > data3 )
( " data4 " , w . data4 , def - > data4 )
2021-12-30 10:22:43 +00:00
( " targetX " , w . TargetPos . X , def - > TargetPos . X )
2021-12-30 10:23:31 +00:00
( " targetY " , w . TargetPos . Y , def - > TargetPos . Y )
2021-12-30 10:24:43 +00:00
( " targetZ " , w . TargetPos . Z , def - > TargetPos . Z )
2021-11-19 19:54:13 +00:00
( " target " , w . target , def - > target )
2020-11-22 15:47:08 +00:00
( " sysdata1 " , w . sysData1 , def - > sysData1 )
( " sysdata2 " , w . sysData2 , def - > sysData2 )
( " scale " , w . scale , def - > scale )
( " physattr " , w . physAttr , def - > physAttr )
( " health " , w . health , def - > health )
( " burnsource " , w . burnSource , def - > burnSource )
( " busytime " , w . busyTime , def - > busyTime )
( " waittime " , w . waitTime , def - > waitTime )
2022-09-03 22:38:26 +00:00
( " goalang " , w . goalAng , def - > goalAng )
2020-11-22 15:47:08 +00:00
( " burntime " , w . burnTime , def - > burnTime )
( " height " , w . height , def - > height )
( " statetimer " , w . stateTimer , def - > stateTimer )
( " respawnpending " , w . respawnPending , def - > respawnPending )
( " dropmsg " , w . dropMsg , def - > dropMsg )
( " key " , w . key , def - > key )
( " lskill " , w . lSkill , def - > lSkill )
( " lockmsg " , w . lockMsg , def - > lockMsg )
( " dodgedir " , w . dodgeDir , def - > dodgeDir )
2021-05-03 22:22:35 +00:00
( " modernflags " , w . unused1 , def - > unused1 )
2021-07-25 08:29:50 +00:00
( " sightstuff " , w . unused3 , def - > unused3 )
( " patrolturndelay " , w . unused4 , def - > unused4 )
2020-11-22 15:47:08 +00:00
. EndObject ( ) ;
}
return arc ;
2019-09-19 22:42:45 +00:00
}
2021-12-29 21:56:21 +00:00
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
2020-11-22 15:47:08 +00:00
FSerializer & Serialize ( FSerializer & arc , const char * keyname , GAMEOPTIONS & w , GAMEOPTIONS * def )
2019-09-19 22:42:45 +00:00
{
2020-11-22 15:47:08 +00:00
if ( arc . BeginObject ( keyname ) )
{
arc ( " type " , w . nGameType )
( " difficulty " , w . nDifficulty )
( " monster " , w . nMonsterSettings )
( " flags " , w . uGameFlags )
( " netflags " , w . uNetGameFlags )
( " weapons " , w . nWeaponSettings )
( " items " , w . nItemSettings )
( " respawn " , w . nRespawnSettings )
( " team " , w . nTeamSettings )
( " monsterrespawntime " , w . nMonsterRespawnTime )
( " itemrespawntime " , w . nItemRespawnTime )
( " specialrespawntime " , w . nSpecialRespawnTime )
( " weaponsv10x " , w . weaponsV10x )
( " friendlyfire " , w . bFriendlyFire )
( " keepkeys " , w . bKeepKeysOnRespawn )
. EndObject ( ) ;
}
return arc ;
2019-09-19 22:42:45 +00:00
}
2021-12-29 21:56:21 +00:00
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
2020-11-22 15:47:08 +00:00
void SerializeState ( FSerializer & arc )
2019-09-19 22:42:45 +00:00
{
2020-11-22 15:47:08 +00:00
if ( arc . isReading ( ) )
2019-12-01 21:54:52 +00:00
{
2020-11-22 15:47:08 +00:00
cheatReset ( ) ;
2019-12-01 21:54:52 +00:00
}
2020-11-22 15:47:08 +00:00
if ( arc . BeginObject ( " state " ) )
2019-12-01 21:54:52 +00:00
{
2021-11-20 18:10:02 +00:00
arc ( " visibility " , gVisibility )
2021-02-18 10:46:36 +00:00
( " frameclock " , PlayClock )
2020-11-22 15:47:08 +00:00
( " framecount " , gFrameCount )
( " hitinfo " , gHitInfo )
( " fogmode " , gFogMode )
2020-01-26 11:19:01 +00:00
# ifdef NOONE_EXTENSIONS
2020-11-22 15:47:08 +00:00
( " modern " , gModernMap )
2020-02-16 13:54:24 +00:00
# endif
2020-11-22 15:47:08 +00:00
( " cheating " , bPlayerCheated )
2021-12-05 08:20:41 +00:00
( " gameoptions " , gGameOptions ) ;
2021-09-04 10:23:36 +00:00
arc . EndObject ( ) ;
2020-11-22 15:47:08 +00:00
}
2019-09-22 06:39:22 +00:00
}
2020-11-21 14:09:38 +00:00
void SerializeEvents ( FSerializer & arc ) ;
2020-11-21 17:12:51 +00:00
void SerializeSequences ( FSerializer & arc ) ;
2020-11-21 18:39:24 +00:00
void SerializeWarp ( FSerializer & arc ) ;
2020-11-21 19:25:06 +00:00
void SerializeTriggers ( FSerializer & arc ) ;
2020-11-21 20:31:50 +00:00
void SerializeActor ( FSerializer & arc ) ;
2020-11-22 13:24:55 +00:00
void SerializePlayers ( FSerializer & arc ) ;
2020-11-22 15:47:08 +00:00
void SerializeView ( FSerializer & arc ) ;
void SerializeNNExts ( FSerializer & arc ) ;
2020-11-21 14:09:38 +00:00
2021-12-29 21:56:21 +00:00
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
2020-11-21 14:09:38 +00:00
void GameInterface : : SerializeGameState ( FSerializer & arc )
{
2020-11-22 15:47:08 +00:00
if ( arc . isWriting ( ) )
{
2021-12-29 21:56:21 +00:00
}
2020-11-22 15:47:08 +00:00
else
{
2020-11-27 23:20:12 +00:00
sndKillAllSounds ( ) ;
sfxKillAllSounds ( ) ;
ambKillAll ( ) ;
seqKillAll ( ) ;
2021-12-29 21:56:21 +00:00
}
2020-11-22 15:47:08 +00:00
SerializeState ( arc ) ;
SerializeActor ( arc ) ;
SerializePlayers ( arc ) ;
SerializeEvents ( arc ) ;
SerializeSequences ( arc ) ;
SerializeWarp ( arc ) ;
SerializeTriggers ( arc ) ;
SerializeView ( arc ) ;
# ifdef NOONE_EXTENSIONS
SerializeNNExts ( arc ) ;
# endif
if ( arc . isReading ( ) )
{
InitSectorFX ( ) ;
viewInitializePrediction ( ) ;
PreloadCache ( ) ;
2023-10-02 02:27:16 +00:00
if ( ! getPlayer ( myconnectindex ) - > packSlots [ 1 ] . isActive ) // if diving suit is not active, turn off reverb sound effect
2020-11-22 15:47:08 +00:00
sfxSetReverb ( 0 ) ;
ambInit ( ) ;
for ( int i = 0 ; i < gNetPlayers ; i + + )
2023-10-02 02:27:16 +00:00
playerSetRace ( getPlayer ( i ) , getPlayer ( i ) - > lifeMode ) ;
2020-11-22 15:47:08 +00:00
viewSetErrorMessage ( " " ) ;
paused = 0 ;
Mus_ResumeSaved ( ) ;
}
2021-12-16 10:52:19 +00:00
validateLinks ( ) ;
2020-11-21 14:09:38 +00:00
}
2019-09-22 06:39:22 +00:00
END_BLD_NS