Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doom: add weapon selection, add game saving, change boolean to boolean32 for C/C++ compatible 32-bit bool sizes #94

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions firmware/doom/lib/doomgeneric/src/am_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static int grid = 0;

static int leveljuststarted = 1; // kluge until AM_LevelInit() is called

boolean automapactive = false;
boolean32 automapactive = false;
static int finit_width = SCREENWIDTH;
static int finit_height = SCREENHEIGHT - 32;

Expand Down Expand Up @@ -265,7 +265,7 @@ static int followplayer = 1; // specifies whether to follow the player around

cheatseq_t cheat_amap = CHEAT("iddt", 0);

static boolean stopped = true;
static boolean32 stopped = true;

// Calculates the slope and slope according to the x-axis of a line
// segment in map coordinates (with the upright y-axis n' all) so
Expand Down Expand Up @@ -591,7 +591,7 @@ void AM_maxOutWindowScale(void)
//
// Handle events (user inputs) in automap mode
//
boolean
boolean32
AM_Responder
( event_t* ev )
{
Expand Down Expand Up @@ -844,7 +844,7 @@ void AM_clearFB(int color)
// faster reject and precalculated slopes. If the speed is needed,
// use a hash algorithm to handle the common cases.
//
boolean
boolean32
AM_clipMline
( mline_t* ml,
fline_t* fl )
Expand Down
2 changes: 1 addition & 1 deletion firmware/doom/lib/doomgeneric/src/am_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


// Called by main loop.
boolean AM_Responder (event_t* ev);
boolean32 AM_Responder (event_t* ev);

// Called by main loop.
void AM_Ticker (void);
Expand Down
4 changes: 2 additions & 2 deletions firmware/doom/lib/doomgeneric/src/d_iwad.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static const iwad_t iwads[] =

#define MAX_IWAD_DIRS 128

static boolean iwad_dirs_built = false;
static boolean32 iwad_dirs_built = false;
static char *iwad_dirs[MAX_IWAD_DIRS];
static int num_iwad_dirs = 0;

Expand Down Expand Up @@ -388,7 +388,7 @@ static void CheckDOSDefaults(void)
// Returns true if the specified path is a path to a file
// of the specified name.

static boolean DirIsFile(char *path, char *filename)
static boolean32 DirIsFile(char *path, char *filename)
{
size_t path_len;
size_t filename_len;
Expand Down
20 changes: 10 additions & 10 deletions firmware/doom/lib/doomgeneric/src/d_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
typedef struct
{
ticcmd_t cmds[NET_MAXPLAYERS];
boolean ingame[NET_MAXPLAYERS];
boolean32 ingame[NET_MAXPLAYERS];
} ticcmd_set_t;

//
Expand Down Expand Up @@ -74,7 +74,7 @@ int gametic;
// When set to true, a single tic is run each time TryRunTics() is called.
// This is used for -timedemo mode.

boolean singletics = false;
boolean32 singletics = false;

// Index of the local player.

Expand All @@ -95,7 +95,7 @@ fixed_t offsetms;

// Use new client syncronisation code

static boolean new_sync = true;
static boolean32 new_sync = true;

// Callback functions for loop code.

Expand All @@ -105,7 +105,7 @@ static loop_interface_t *loop_interface = NULL;
// This is distinct from playeringame[] used by the game code, which may
// modify playeringame[] when playing back multiplayer demos.

static boolean local_playeringame[NET_MAXPLAYERS];
static boolean32 local_playeringame[NET_MAXPLAYERS];

// Requested player class "sent" to the server on connect.
// If we are only doing a single player game then this needs to be remembered
Expand Down Expand Up @@ -133,7 +133,7 @@ static int GetAdjustedTime(void)
return (time_ms * TICRATE) / 1000;
}

static boolean BuildNewTic(void)
static boolean32 BuildNewTic(void)
{
int gameticdiv;
ticcmd_t cmd;
Expand Down Expand Up @@ -268,7 +268,7 @@ static void D_Disconnected(void)
// available.
//

void D_ReceiveTic(ticcmd_t *ticcmds, boolean *players_mask)
void D_ReceiveTic(ticcmd_t *ticcmds, boolean32 *players_mask)
{
int i;

Expand Down Expand Up @@ -449,9 +449,9 @@ void D_StartNetGame(net_gamesettings_t *settings,
#endif
}

boolean D_InitNetGame(net_connect_data_t *connect_data)
boolean32 D_InitNetGame(net_connect_data_t *connect_data)
{
boolean result = false;
boolean32 result = false;
#ifdef FEATURE_MULTIPLAYER
net_addr_t *addr = NULL;
int i;
Expand Down Expand Up @@ -639,9 +639,9 @@ static void OldNetSync(void)

// Returns true if there are players in the game:

static boolean PlayersInGame(void)
static boolean32 PlayersInGame(void)
{
boolean result = false;
boolean32 result = false;
unsigned int i;

// If we are connected to a server, check if there are any players
Expand Down
8 changes: 4 additions & 4 deletions firmware/doom/lib/doomgeneric/src/d_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// The callback is invoked when new players are ready. The callback
// should return true, or return false to abort startup.

typedef boolean (*netgame_startup_callback_t)(int ready_players,
typedef boolean32 (*netgame_startup_callback_t)(int ready_players,
int num_players);

typedef struct
Expand All @@ -42,7 +42,7 @@ typedef struct

// Advance the game forward one tic, using the specified player input.

void (*RunTic)(ticcmd_t *cmds, boolean *ingame);
void (*RunTic)(ticcmd_t *cmds, boolean32 *ingame);

// Run the menu (runs independently of the game).

Expand All @@ -67,15 +67,15 @@ void D_StartGameLoop(void);

// Initialize networking code and connect to server.

boolean D_InitNetGame(net_connect_data_t *connect_data);
boolean32 D_InitNetGame(net_connect_data_t *connect_data);

// Start game with specified settings. The structure will be updated
// with the actual settings for the game.

void D_StartNetGame(net_gamesettings_t *settings,
netgame_startup_callback_t callback);

extern boolean singletics;
extern boolean32 singletics;
extern int gametic, ticdup;

#endif
Expand Down
42 changes: 21 additions & 21 deletions firmware/doom/lib/doomgeneric/src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,33 +94,33 @@ char * savegamedir;
char * iwadfile;


boolean devparm; // started game with -devparm
boolean nomonsters; // checkparm of -nomonsters
boolean respawnparm; // checkparm of -respawn
boolean fastparm; // checkparm of -fast
boolean32 devparm; // started game with -devparm
boolean32 nomonsters; // checkparm of -nomonsters
boolean32 respawnparm; // checkparm of -respawn
boolean32 fastparm; // checkparm of -fast

//extern int soundVolume;
//extern int sfxVolume;
//extern int musicVolume;

extern boolean inhelpscreens;
extern boolean32 inhelpscreens;

skill_t startskill;
int startepisode;
int startmap;
boolean autostart;
boolean32 autostart;
int startloadgame;

boolean advancedemo;
boolean32 advancedemo;

// Store demo, do not accept any inputs
boolean storedemo;
boolean32 storedemo;

// "BFG Edition" version of doom2.wad does not include TITLEPIC.
boolean bfgedition;
boolean32 bfgedition;

// If true, the main game loop has started.
boolean main_loop_started = false;
boolean32 main_loop_started = false;

char wadfile[1024]; // primary wad file
char mapdir[1024]; // directory of development maps
Expand Down Expand Up @@ -162,25 +162,25 @@ void D_ProcessEvents (void)

// wipegamestate can be set to -1 to force a wipe on the next draw
gamestate_t wipegamestate = GS_DEMOSCREEN;
extern boolean setsizeneeded;
extern boolean32 setsizeneeded;
extern int showMessages;
void R_ExecuteSetViewSize (void);

void D_Display (void)
{
static boolean viewactivestate = false;
static boolean menuactivestate = false;
static boolean inhelpscreensstate = false;
static boolean fullscreen = false;
static boolean32 viewactivestate = false;
static boolean32 menuactivestate = false;
static boolean32 inhelpscreensstate = false;
static boolean32 fullscreen = false;
static gamestate_t oldgamestate = -1;
static int borderdrawcount;
int nowtime;
int tics;
int wipestart;
int y;
boolean done;
boolean wipe;
boolean redrawsbar;
boolean32 done;
boolean32 wipe;
boolean32 redrawsbar;

if (nodrawers)
return; // for comparative timing / profiling
Expand Down Expand Up @@ -385,7 +385,7 @@ void D_BindVariables(void)
// Called to determine whether to grab the mouse pointer
//

boolean D_GrabMouseCallback(void)
boolean32 D_GrabMouseCallback(void)
{
// Drone players don't need mouse focus

Expand Down Expand Up @@ -804,7 +804,7 @@ void D_IdentifyVersion(void)

void D_SetGameDescription(void)
{
boolean is_freedoom = W_CheckNumForName("FREEDOOM") >= 0,
boolean32 is_freedoom = W_CheckNumForName("FREEDOOM") >= 0,
is_freedm = W_CheckNumForName("FREEDM") >= 0;

gamedescription = "Unknown";
Expand Down Expand Up @@ -865,7 +865,7 @@ void D_SetGameDescription(void)
// print title for every printed line
char title[128];

static boolean D_AddFile(char *filename)
static boolean32 D_AddFile(char *filename)
{
wad_file_t *handle;

Expand Down
8 changes: 4 additions & 4 deletions firmware/doom/lib/doomgeneric/src/d_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static struct

// Check that a gamemode+gamemission received over the network is valid.

boolean D_ValidGameMode(GameMission_t mission, GameMode_t mode)
boolean32 D_ValidGameMode(GameMission_t mission, GameMode_t mode)
{
int i;

Expand All @@ -62,7 +62,7 @@ boolean D_ValidGameMode(GameMission_t mission, GameMode_t mode)
return false;
}

boolean D_ValidEpisodeMap(GameMission_t mission, GameMode_t mode,
boolean32 D_ValidEpisodeMap(GameMission_t mission, GameMode_t mode,
int episode, int map)
{
int i;
Expand Down Expand Up @@ -132,7 +132,7 @@ static struct {
{ strife, exe_strife_1_31 },
};

boolean D_ValidGameVersion(GameMission_t mission, GameVersion_t version)
boolean32 D_ValidGameVersion(GameMission_t mission, GameVersion_t version)
{
int i;

Expand All @@ -158,7 +158,7 @@ boolean D_ValidGameVersion(GameMission_t mission, GameVersion_t version)

// Does this mission type use ExMy form, rather than MAPxy form?

boolean D_IsEpisodeMap(GameMission_t mission)
boolean32 D_IsEpisodeMap(GameMission_t mission)
{
switch (mission)
{
Expand Down
8 changes: 4 additions & 4 deletions firmware/doom/lib/doomgeneric/src/d_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ typedef enum
sk_nightmare
} skill_t;

boolean D_ValidGameMode(GameMission_t mission, GameMode_t mode);
boolean D_ValidGameVersion(GameMission_t mission, GameVersion_t version);
boolean D_ValidEpisodeMap(GameMission_t mission, GameMode_t mode,
boolean32 D_ValidGameMode(GameMission_t mission, GameMode_t mode);
boolean32 D_ValidGameVersion(GameMission_t mission, GameVersion_t version);
boolean32 D_ValidEpisodeMap(GameMission_t mission, GameMode_t mode,
int episode, int map);
int D_GetNumEpisodes(GameMission_t mission, GameMode_t mode);
boolean D_IsEpisodeMap(GameMission_t mission);
boolean32 D_IsEpisodeMap(GameMission_t mission);
char *D_GameMissionString(GameMission_t mission);

#endif /* #ifndef __D_MODE__ */
Expand Down
4 changes: 2 additions & 2 deletions firmware/doom/lib/doomgeneric/src/d_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ static void PlayerQuitGame(player_t *player)
}
}

static void RunTic(ticcmd_t *cmds, boolean *ingame)
static void RunTic(ticcmd_t *cmds, boolean32 *ingame)
{
extern boolean advancedemo;
extern boolean32 advancedemo;
unsigned int i;

// Check for player quits.
Expand Down
12 changes: 6 additions & 6 deletions firmware/doom/lib/doomgeneric/src/d_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ typedef struct player_s

// Power ups. invinc and invis are tic counters.
int powers[NUMPOWERS];
boolean cards[NUMCARDS];
boolean backpack;
boolean32 cards[NUMCARDS];
boolean32 backpack;

// Frags, kills of other players.
int frags[MAXPLAYERS];
Expand All @@ -111,7 +111,7 @@ typedef struct player_s
// Is wp_nochange if not changing.
weapontype_t pendingweapon;

boolean weaponowned[NUMWEAPONS];
boolean32 weaponowned[NUMWEAPONS];
int ammo[NUMAMMO];
int maxammo[NUMAMMO];

Expand Down Expand Up @@ -156,7 +156,7 @@ typedef struct player_s
pspdef_t psprites[NUMPSPRITES];

// True if secret level has been done.
boolean didsecret;
boolean32 didsecret;

} player_t;

Expand All @@ -167,7 +167,7 @@ typedef struct player_s
//
typedef struct
{
boolean in; // whether the player is in game
boolean32 in; // whether the player is in game

// Player stats, kills, collected items etc.
int skills;
Expand All @@ -184,7 +184,7 @@ typedef struct
int epsd; // episode # (0-2)

// if true, splash the secret level
boolean didsecret;
boolean32 didsecret;

// previous and next levels, origin 0
int last;
Expand Down
Loading
Loading