mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- simplified the event management further and added a JSON serializer for it.
This commit is contained in:
parent
5f54eac297
commit
1535182577
6 changed files with 678 additions and 573 deletions
|
@ -71,6 +71,7 @@ struct GameInterface : ::GameInterface
|
|||
{
|
||||
const char* Name() override { return "Blood"; }
|
||||
void app_init() override;
|
||||
void SerializeGameState(FSerializer& arc) override;
|
||||
void loadPalette() override;
|
||||
void clearlocalinputstate() override;
|
||||
bool GenerateSavePic() override;
|
||||
|
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
kMaxXSprites = 16384,
|
||||
|
@ -31,6 +32,17 @@ enum
|
|||
kMaxXSectors = 512
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
kAttrMove = 0x0001, // is affected by movement physics
|
||||
kAttrGravity = 0x0002, // is affected by gravity
|
||||
kAttrFalling = 0x0004, // in z motion
|
||||
kAttrAiming = 0x0008,
|
||||
kAttrRespawn = 0x0010,
|
||||
kAttrFree = 0x0020,
|
||||
kAttrSmoke = 0x0100, // receives tsprite smoke/steam
|
||||
};
|
||||
|
||||
|
||||
// by NoOne: functions to quckly check range of specifical arrays
|
||||
inline bool xspriRangeIsFine(int nXindex) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,48 +27,48 @@ BEGIN_BLD_NS
|
|||
|
||||
|
||||
enum {
|
||||
kChannelZero = 0,
|
||||
kChannelSetTotalSecrets,
|
||||
kChannelSecretFound,
|
||||
kChannelTextOver,
|
||||
kChannelLevelExitNormal,
|
||||
kChannelLevelExitSecret,
|
||||
kChannelModernEndLevelCustom, // custom level end
|
||||
kChannelLevelStart,
|
||||
kChannelLevelStartMatch, // DM and TEAMS
|
||||
kChannelLevelStartCoop,
|
||||
kChannelLevelStartTeamsOnly,
|
||||
kChannelPlayerDeathTeamA = 15,
|
||||
kChannelPlayerDeathTeamB,
|
||||
/////////////////////////////
|
||||
// channels of players to send commands on
|
||||
kChannelPlayer0 = 30,
|
||||
kChannelPlayer1,
|
||||
kChannelPlayer2,
|
||||
kChannelPlayer3,
|
||||
kChannelPlayer4,
|
||||
kChannelPlayer5,
|
||||
kChannelPlayer6,
|
||||
kChannelPlayer7,
|
||||
kChannelAllPlayers = kChannelPlayer0 + kMaxPlayers,
|
||||
// channel of event causer
|
||||
kChannelEventCauser = 50,
|
||||
// map requires modern features to work properly
|
||||
kChannelMapModernize = 60,
|
||||
/////////////////////////////
|
||||
kChannelTeamAFlagCaptured = 80,
|
||||
kChannelTeamBFlagCaptured,
|
||||
kChannelRemoteBomb0 = 90,
|
||||
kChannelRemoteBomb1,
|
||||
kChannelRemoteBomb2,
|
||||
kChannelRemoteBomb3,
|
||||
kChannelRemoteBomb4,
|
||||
kChannelRemoteBomb5,
|
||||
kChannelRemoteBomb6,
|
||||
kChannelRemoteBomb7,
|
||||
kChannelUser = 100,
|
||||
kChannelUserMax = 1024,
|
||||
kChannelMax = 4096,
|
||||
kChannelZero = 0,
|
||||
kChannelSetTotalSecrets,
|
||||
kChannelSecretFound,
|
||||
kChannelTextOver,
|
||||
kChannelLevelExitNormal,
|
||||
kChannelLevelExitSecret,
|
||||
kChannelModernEndLevelCustom, // custom level end
|
||||
kChannelLevelStart,
|
||||
kChannelLevelStartMatch, // DM and TEAMS
|
||||
kChannelLevelStartCoop,
|
||||
kChannelLevelStartTeamsOnly,
|
||||
kChannelPlayerDeathTeamA = 15,
|
||||
kChannelPlayerDeathTeamB,
|
||||
/////////////////////////////
|
||||
// channels of players to send commands on
|
||||
kChannelPlayer0 = 30,
|
||||
kChannelPlayer1,
|
||||
kChannelPlayer2,
|
||||
kChannelPlayer3,
|
||||
kChannelPlayer4,
|
||||
kChannelPlayer5,
|
||||
kChannelPlayer6,
|
||||
kChannelPlayer7,
|
||||
kChannelAllPlayers = kChannelPlayer0 + kMaxPlayers,
|
||||
// channel of event causer
|
||||
kChannelEventCauser = 50,
|
||||
// map requires modern features to work properly
|
||||
kChannelMapModernize = 60,
|
||||
/////////////////////////////
|
||||
kChannelTeamAFlagCaptured = 80,
|
||||
kChannelTeamBFlagCaptured,
|
||||
kChannelRemoteBomb0 = 90,
|
||||
kChannelRemoteBomb1,
|
||||
kChannelRemoteBomb2,
|
||||
kChannelRemoteBomb3,
|
||||
kChannelRemoteBomb4,
|
||||
kChannelRemoteBomb5,
|
||||
kChannelRemoteBomb6,
|
||||
kChannelRemoteBomb7,
|
||||
kChannelUser = 100,
|
||||
kChannelUserMax = 1024,
|
||||
kChannelMax = 4096,
|
||||
};
|
||||
|
||||
struct RXBUCKET
|
||||
|
@ -76,6 +76,7 @@ struct RXBUCKET
|
|||
uint16_t index;
|
||||
uint8_t type;
|
||||
};
|
||||
extern void (*gCallback[])(int);
|
||||
extern RXBUCKET rxBucket[];
|
||||
extern unsigned short bucketHead[];
|
||||
|
||||
|
@ -120,6 +121,17 @@ kCmdModernFeaturesDisable = 200, // must be in object with kChannelMapModerniz
|
|||
kCmdNumbericMax = 255,
|
||||
};
|
||||
|
||||
enum SSType
|
||||
{
|
||||
SS_WALL = 0,
|
||||
SS_CEILING = 1,
|
||||
SS_FLOOR = 2,
|
||||
SS_SPRITE = 3,
|
||||
SS_MASKED = 4,
|
||||
|
||||
SS_SECTOR = 6,
|
||||
};
|
||||
|
||||
inline bool playerRXRngIsFine(int rx) {
|
||||
return (rx >= kChannelPlayer0 && rx < kChannelPlayer7);
|
||||
}
|
||||
|
@ -128,15 +140,21 @@ inline bool channelRangeIsFine(int channel) {
|
|||
return (channel >= kChannelUser && channel < kChannelUserMax);
|
||||
}
|
||||
|
||||
struct EVENT {
|
||||
unsigned int index: 14; // index
|
||||
unsigned int type: 3; // type
|
||||
unsigned int cmd: 8; // cmd
|
||||
unsigned int funcID: 8; // callback
|
||||
struct EVENT
|
||||
{
|
||||
int16_t index;
|
||||
int8_t type;
|
||||
int8_t cmd;
|
||||
int16_t funcID;
|
||||
int priority;
|
||||
|
||||
bool operator<(const EVENT& other) const
|
||||
{
|
||||
return priority < other.priority;
|
||||
}
|
||||
};
|
||||
|
||||
void evInit(void);
|
||||
char evGetSourceState(int nType, int nIndex);
|
||||
void evSend(int nIndex, int nType, int rxId, COMMAND_ID command);
|
||||
void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command);
|
||||
void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback);
|
||||
|
|
|
@ -731,7 +731,6 @@ void MyLoadSave::Save(void)
|
|||
void ActorLoadSaveConstruct(void);
|
||||
void AILoadSaveConstruct(void);
|
||||
void EndGameLoadSaveConstruct(void);
|
||||
void EventQLoadSaveConstruct(void);
|
||||
void LevelsLoadSaveConstruct(void);
|
||||
void MessagesLoadSaveConstruct(void);
|
||||
void MirrorLoadSaveConstruct(void);
|
||||
|
@ -751,7 +750,6 @@ void LoadSaveSetup(void)
|
|||
ActorLoadSaveConstruct();
|
||||
AILoadSaveConstruct();
|
||||
EndGameLoadSaveConstruct();
|
||||
EventQLoadSaveConstruct();
|
||||
LevelsLoadSaveConstruct();
|
||||
MessagesLoadSaveConstruct();
|
||||
MirrorLoadSaveConstruct();
|
||||
|
@ -765,4 +763,14 @@ void LoadSaveSetup(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SerializeEvents(FSerializer& arc);
|
||||
|
||||
void GameInterface::SerializeGameState(FSerializer& arc)
|
||||
{
|
||||
SerializeEvents(arc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -101,6 +101,7 @@ static void SerializeSession(FSerializer& arc)
|
|||
SerializeAutomap(arc);
|
||||
SerializeHud(arc);
|
||||
SerializeGlobals(arc);
|
||||
gi->SerializeGameState(arc);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -156,7 +157,6 @@ bool OpenSaveGameForRead(const char *name)
|
|||
// Load system-side data from savegames.
|
||||
loadMapBackup(currentLevel->fileName);
|
||||
SerializeSession(arc);
|
||||
gi->SerializeGameState(arc);
|
||||
}
|
||||
return savereader != nullptr;
|
||||
}
|
||||
|
@ -250,7 +250,6 @@ bool OpenSaveGameForWrite(const char* filename, const char *name)
|
|||
// Handle system-side modules that need to persist data in savegames here, in a central place.
|
||||
savegamesession.OpenWriter(save_formatted);
|
||||
SerializeSession(savegamesession);
|
||||
gi->SerializeGameState(savegamesession);
|
||||
buff = savegamesession.GetCompressedOutput();
|
||||
AddCompressedSavegameChunk("session.json", buff);
|
||||
|
||||
|
|
Loading…
Reference in a new issue