From 73a1d4580e49eab8c5293679391afe543a719572 Mon Sep 17 00:00:00 2001 From: Andrew Dunai Date: Thu, 4 Apr 2024 00:10:56 +0300 Subject: [PATCH 1/3] doom: add weapon selection, change boolean to boolean32 for C/C++ compatible 32-bit bool sizes --- firmware/doom/lib/doomgeneric/src/am_map.c | 8 +- firmware/doom/lib/doomgeneric/src/am_map.h | 2 +- firmware/doom/lib/doomgeneric/src/d_iwad.c | 4 +- firmware/doom/lib/doomgeneric/src/d_loop.c | 20 +-- firmware/doom/lib/doomgeneric/src/d_loop.h | 8 +- firmware/doom/lib/doomgeneric/src/d_main.c | 42 ++--- firmware/doom/lib/doomgeneric/src/d_mode.c | 8 +- firmware/doom/lib/doomgeneric/src/d_mode.h | 8 +- firmware/doom/lib/doomgeneric/src/d_net.c | 4 +- firmware/doom/lib/doomgeneric/src/d_player.h | 12 +- firmware/doom/lib/doomgeneric/src/deh_main.h | 14 +- firmware/doom/lib/doomgeneric/src/doomstat.c | 2 +- firmware/doom/lib/doomgeneric/src/doomstat.h | 46 +++--- firmware/doom/lib/doomgeneric/src/doomtype.h | 43 +++-- firmware/doom/lib/doomgeneric/src/dummy.c | 4 +- firmware/doom/lib/doomgeneric/src/f_finale.c | 14 +- firmware/doom/lib/doomgeneric/src/f_finale.h | 2 +- firmware/doom/lib/doomgeneric/src/f_wipe.c | 6 +- firmware/doom/lib/doomgeneric/src/g_game.c | 68 ++++---- firmware/doom/lib/doomgeneric/src/g_game.h | 4 +- firmware/doom/lib/doomgeneric/src/gusconf.c | 6 +- firmware/doom/lib/doomgeneric/src/gusconf.h | 2 +- firmware/doom/lib/doomgeneric/src/hu_lib.c | 16 +- firmware/doom/lib/doomgeneric/src/hu_lib.h | 24 +-- firmware/doom/lib/doomgeneric/src/hu_stuff.c | 18 +-- firmware/doom/lib/doomgeneric/src/hu_stuff.h | 2 +- .../doom/lib/doomgeneric/src/i_joystick.c | 4 +- firmware/doom/lib/doomgeneric/src/i_scale.c | 30 ++-- firmware/doom/lib/doomgeneric/src/i_sound.c | 14 +- firmware/doom/lib/doomgeneric/src/i_sound.h | 18 +-- firmware/doom/lib/doomgeneric/src/i_system.c | 14 +- firmware/doom/lib/doomgeneric/src/i_system.h | 6 +- firmware/doom/lib/doomgeneric/src/i_video.c | 6 +- firmware/doom/lib/doomgeneric/src/i_video.h | 12 +- firmware/doom/lib/doomgeneric/src/m_argv.c | 2 +- firmware/doom/lib/doomgeneric/src/m_argv.h | 2 +- firmware/doom/lib/doomgeneric/src/m_config.c | 4 +- firmware/doom/lib/doomgeneric/src/m_config.h | 2 +- firmware/doom/lib/doomgeneric/src/m_menu.c | 22 +-- firmware/doom/lib/doomgeneric/src/m_menu.h | 2 +- firmware/doom/lib/doomgeneric/src/m_misc.c | 14 +- firmware/doom/lib/doomgeneric/src/m_misc.h | 14 +- firmware/doom/lib/doomgeneric/src/mus2mid.c | 22 +-- firmware/doom/lib/doomgeneric/src/mus2mid.h | 2 +- .../doom/lib/doomgeneric/src/net_client.h | 12 +- firmware/doom/lib/doomgeneric/src/net_defs.h | 8 +- firmware/doom/lib/doomgeneric/src/net_io.h | 2 +- .../doom/lib/doomgeneric/src/net_packet.h | 12 +- firmware/doom/lib/doomgeneric/src/net_query.h | 2 +- firmware/doom/lib/doomgeneric/src/p_enemy.c | 22 +-- firmware/doom/lib/doomgeneric/src/p_floor.c | 4 +- firmware/doom/lib/doomgeneric/src/p_inter.c | 16 +- firmware/doom/lib/doomgeneric/src/p_inter.h | 2 +- firmware/doom/lib/doomgeneric/src/p_local.h | 26 +-- firmware/doom/lib/doomgeneric/src/p_map.c | 40 ++--- firmware/doom/lib/doomgeneric/src/p_maputl.c | 24 +-- firmware/doom/lib/doomgeneric/src/p_mobj.c | 2 +- firmware/doom/lib/doomgeneric/src/p_pspr.c | 152 +++++++++--------- firmware/doom/lib/doomgeneric/src/p_saveg.c | 34 ++-- firmware/doom/lib/doomgeneric/src/p_saveg.h | 6 +- firmware/doom/lib/doomgeneric/src/p_setup.c | 4 +- firmware/doom/lib/doomgeneric/src/p_sight.c | 6 +- firmware/doom/lib/doomgeneric/src/p_spec.c | 4 +- firmware/doom/lib/doomgeneric/src/p_spec.h | 12 +- firmware/doom/lib/doomgeneric/src/p_switch.c | 2 +- firmware/doom/lib/doomgeneric/src/p_user.c | 2 +- firmware/doom/lib/doomgeneric/src/r_bsp.c | 2 +- firmware/doom/lib/doomgeneric/src/r_bsp.h | 8 +- firmware/doom/lib/doomgeneric/src/r_defs.h | 2 +- firmware/doom/lib/doomgeneric/src/r_main.c | 2 +- firmware/doom/lib/doomgeneric/src/r_segs.c | 8 +- firmware/doom/lib/doomgeneric/src/r_things.c | 12 +- firmware/doom/lib/doomgeneric/src/s_sound.c | 4 +- firmware/doom/lib/doomgeneric/src/s_sound.h | 2 +- firmware/doom/lib/doomgeneric/src/st_lib.c | 20 +-- firmware/doom/lib/doomgeneric/src/st_lib.h | 32 ++-- firmware/doom/lib/doomgeneric/src/st_stuff.c | 28 ++-- firmware/doom/lib/doomgeneric/src/st_stuff.h | 4 +- firmware/doom/lib/doomgeneric/src/v_video.h | 2 +- firmware/doom/lib/doomgeneric/src/w_main.c | 4 +- firmware/doom/lib/doomgeneric/src/w_main.h | 2 +- firmware/doom/lib/doomgeneric/src/wi_stuff.c | 10 +- firmware/doom/src/i_buzzersound.cpp | 6 +- firmware/doom/src/i_defaultmusic.cpp | 6 +- firmware/doom/src/i_i2ssound.cpp | 6 +- firmware/doom/src/i_nosound.cpp | 2 +- firmware/doom/src/main.cpp | 62 ++++++- 87 files changed, 622 insertions(+), 573 deletions(-) diff --git a/firmware/doom/lib/doomgeneric/src/am_map.c b/firmware/doom/lib/doomgeneric/src/am_map.c index d3d504e3..e5b06561 100644 --- a/firmware/doom/lib/doomgeneric/src/am_map.c +++ b/firmware/doom/lib/doomgeneric/src/am_map.c @@ -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; @@ -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 @@ -591,7 +591,7 @@ void AM_maxOutWindowScale(void) // // Handle events (user inputs) in automap mode // -boolean +boolean32 AM_Responder ( event_t* ev ) { @@ -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 ) diff --git a/firmware/doom/lib/doomgeneric/src/am_map.h b/firmware/doom/lib/doomgeneric/src/am_map.h index 572d2389..0e238a0b 100644 --- a/firmware/doom/lib/doomgeneric/src/am_map.h +++ b/firmware/doom/lib/doomgeneric/src/am_map.h @@ -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); diff --git a/firmware/doom/lib/doomgeneric/src/d_iwad.c b/firmware/doom/lib/doomgeneric/src/d_iwad.c index ebfa0b1a..410b5166 100644 --- a/firmware/doom/lib/doomgeneric/src/d_iwad.c +++ b/firmware/doom/lib/doomgeneric/src/d_iwad.c @@ -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; @@ -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; diff --git a/firmware/doom/lib/doomgeneric/src/d_loop.c b/firmware/doom/lib/doomgeneric/src/d_loop.c index b8cadccf..85c9c664 100644 --- a/firmware/doom/lib/doomgeneric/src/d_loop.c +++ b/firmware/doom/lib/doomgeneric/src/d_loop.c @@ -45,7 +45,7 @@ typedef struct { ticcmd_t cmds[NET_MAXPLAYERS]; - boolean ingame[NET_MAXPLAYERS]; + boolean32 ingame[NET_MAXPLAYERS]; } ticcmd_set_t; // @@ -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. @@ -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. @@ -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 @@ -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; @@ -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; @@ -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; @@ -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 diff --git a/firmware/doom/lib/doomgeneric/src/d_loop.h b/firmware/doom/lib/doomgeneric/src/d_loop.h index dcec1329..620e0d17 100644 --- a/firmware/doom/lib/doomgeneric/src/d_loop.h +++ b/firmware/doom/lib/doomgeneric/src/d_loop.h @@ -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 @@ -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). @@ -67,7 +67,7 @@ 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. @@ -75,7 +75,7 @@ boolean D_InitNetGame(net_connect_data_t *connect_data); void D_StartNetGame(net_gamesettings_t *settings, netgame_startup_callback_t callback); -extern boolean singletics; +extern boolean32 singletics; extern int gametic, ticdup; #endif diff --git a/firmware/doom/lib/doomgeneric/src/d_main.c b/firmware/doom/lib/doomgeneric/src/d_main.c index a5839a57..cc35cf16 100644 --- a/firmware/doom/lib/doomgeneric/src/d_main.c +++ b/firmware/doom/lib/doomgeneric/src/d_main.c @@ -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 @@ -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 @@ -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 @@ -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"; @@ -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; diff --git a/firmware/doom/lib/doomgeneric/src/d_mode.c b/firmware/doom/lib/doomgeneric/src/d_mode.c index afd84acb..5d8c0dc7 100644 --- a/firmware/doom/lib/doomgeneric/src/d_mode.c +++ b/firmware/doom/lib/doomgeneric/src/d_mode.c @@ -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; @@ -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; @@ -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; @@ -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) { diff --git a/firmware/doom/lib/doomgeneric/src/d_mode.h b/firmware/doom/lib/doomgeneric/src/d_mode.h index ebbd0e83..6ecc8151 100644 --- a/firmware/doom/lib/doomgeneric/src/d_mode.h +++ b/firmware/doom/lib/doomgeneric/src/d_mode.h @@ -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__ */ diff --git a/firmware/doom/lib/doomgeneric/src/d_net.c b/firmware/doom/lib/doomgeneric/src/d_net.c index 80d4d40a..3683edaa 100644 --- a/firmware/doom/lib/doomgeneric/src/d_net.c +++ b/firmware/doom/lib/doomgeneric/src/d_net.c @@ -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. diff --git a/firmware/doom/lib/doomgeneric/src/d_player.h b/firmware/doom/lib/doomgeneric/src/d_player.h index a72c2f5f..9acdc1f0 100644 --- a/firmware/doom/lib/doomgeneric/src/d_player.h +++ b/firmware/doom/lib/doomgeneric/src/d_player.h @@ -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]; @@ -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]; @@ -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; @@ -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; @@ -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; diff --git a/firmware/doom/lib/doomgeneric/src/deh_main.h b/firmware/doom/lib/doomgeneric/src/deh_main.h index 10ac2360..f32d5105 100644 --- a/firmware/doom/lib/doomgeneric/src/deh_main.h +++ b/firmware/doom/lib/doomgeneric/src/deh_main.h @@ -32,17 +32,17 @@ void DEH_ParseCommandLine(void); int DEH_LoadFile(char *filename); -int DEH_LoadLump(int lumpnum, boolean allow_long, boolean allow_error); -int DEH_LoadLumpByName(char *name, boolean allow_long, boolean allow_error); +int DEH_LoadLump(int lumpnum, boolean32 allow_long, boolean32 allow_error); +int DEH_LoadLumpByName(char *name, boolean32 allow_long, boolean32 allow_error); -boolean DEH_ParseAssignment(char *line, char **variable_name, char **value); +boolean32 DEH_ParseAssignment(char *line, char **variable_name, char **value); void DEH_Checksum(sha1_digest_t digest); -extern boolean deh_allow_extended_strings; -extern boolean deh_allow_long_strings; -extern boolean deh_allow_long_cheats; -extern boolean deh_apply_cheats; +extern boolean32 deh_allow_extended_strings; +extern boolean32 deh_allow_long_strings; +extern boolean32 deh_allow_long_cheats; +extern boolean32 deh_apply_cheats; #endif /* #ifndef DEH_MAIN_H */ diff --git a/firmware/doom/lib/doomgeneric/src/doomstat.c b/firmware/doom/lib/doomgeneric/src/doomstat.c index ed4c6ccc..7d9cca3a 100644 --- a/firmware/doom/lib/doomgeneric/src/doomstat.c +++ b/firmware/doom/lib/doomgeneric/src/doomstat.c @@ -28,7 +28,7 @@ GameVersion_t gameversion = exe_final2; char *gamedescription; // Set if homebrew PWAD stuff has been added. -boolean modifiedgame; +boolean32 modifiedgame; diff --git a/firmware/doom/lib/doomgeneric/src/doomstat.h b/firmware/doom/lib/doomgeneric/src/doomstat.h index acd65dcc..83b69c8a 100644 --- a/firmware/doom/lib/doomgeneric/src/doomstat.h +++ b/firmware/doom/lib/doomgeneric/src/doomstat.h @@ -43,11 +43,11 @@ // ------------------------ // Command line parameters. // -extern boolean nomonsters; // checkparm of -nomonsters -extern boolean respawnparm; // checkparm of -respawn -extern boolean fastparm; // checkparm of -fast +extern boolean32 nomonsters; // checkparm of -nomonsters +extern boolean32 respawnparm; // checkparm of -respawn +extern boolean32 fastparm; // checkparm of -fast -extern boolean devparm; // DEBUG: launched with -devparm +extern boolean32 devparm; // DEBUG: launched with -devparm // ----------------------------------------------------- @@ -59,7 +59,7 @@ extern GameVersion_t gameversion; extern char *gamedescription; // If true, we're using one of the mangled BFG edition IWADs. -extern boolean bfgedition; +extern boolean32 bfgedition; // Convenience macro. // 'gamemission' can be equal to pack_chex or pack_hacx, but these are @@ -71,7 +71,7 @@ extern boolean bfgedition; gamemission == pack_hacx ? doom2 : gamemission) // Set if homebrew PWAD stuff has been added. -extern boolean modifiedgame; +extern boolean32 modifiedgame; // ------------------------------------------- @@ -88,7 +88,7 @@ extern int startmap; extern int startloadgame; -extern boolean autostart; +extern boolean32 autostart; // Selected by user. extern skill_t gameskill; @@ -99,10 +99,10 @@ extern int gamemap; extern int timelimit; // Nightmare mode flag, single player. -extern boolean respawnmonsters; +extern boolean32 respawnmonsters; // Netgame? Only true if >1 player. -extern boolean netgame; +extern boolean32 netgame; // 0=Cooperative; 1=Deathmatch; 2=Altdeath extern int deathmatch; @@ -138,19 +138,19 @@ extern int snd_DesiredSfxDevice; // Depending on view size - no status bar? // Note that there is no way to disable the // status bar explicitely. -extern boolean statusbaractive; +extern boolean32 statusbaractive; -extern boolean automapactive; // In AutoMap mode? -extern boolean menuactive; // Menu overlayed? -extern boolean paused; // Game Pause? +extern boolean32 automapactive; // In AutoMap mode? +extern boolean32 menuactive; // Menu overlayed? +extern boolean32 paused; // Game Pause? -extern boolean viewactive; +extern boolean32 viewactive; -extern boolean nodrawers; +extern boolean32 nodrawers; -extern boolean testcontrols; +extern boolean32 testcontrols; extern int testcontrols_mousespeed; @@ -183,19 +183,19 @@ extern int leveltime; // tics in game play for par // DEMO playback/recording related stuff. // No demo, there is a human player in charge? // Disable save/end game? -extern boolean usergame; +extern boolean32 usergame; //? -extern boolean demoplayback; -extern boolean demorecording; +extern boolean32 demoplayback; +extern boolean32 demorecording; // Round angleturn in ticcmds to the nearest 256. This is used when // recording Vanilla demos in netgames. -extern boolean lowres_turn; +extern boolean32 lowres_turn; // Quit after playing a demo from cmdline. -extern boolean singledemo; +extern boolean32 singledemo; @@ -220,7 +220,7 @@ extern gamestate_t gamestate; extern player_t players[MAXPLAYERS]; // Alive? Disconnected? -extern boolean playeringame[MAXPLAYERS]; +extern boolean32 playeringame[MAXPLAYERS]; // Player spawn spots for deathmatch. @@ -250,7 +250,7 @@ extern char * savegamedir; extern char basedefault[1024]; // if true, load all graphics at level load -extern boolean precache; +extern boolean32 precache; // wipegamestate can be set to -1 diff --git a/firmware/doom/lib/doomgeneric/src/doomtype.h b/firmware/doom/lib/doomgeneric/src/doomtype.h index aab7cbee..acef2dca 100644 --- a/firmware/doom/lib/doomgeneric/src/doomtype.h +++ b/firmware/doom/lib/doomgeneric/src/doomtype.h @@ -15,7 +15,7 @@ // DESCRIPTION: // Simple basic typedefs, isolated here to make it easier // separating modules. -// +// #ifndef __DOOMTYPE__ @@ -38,7 +38,7 @@ // -// The packed attribute forces structures to be packed into the minimum +// The packed attribute forces structures to be packed into the minimum // space necessary. If this is not done, the compiler may align structure // fields differently to optimize memory access, inflating the overall // structure size. It is important to use the packed attribute on certain @@ -52,32 +52,31 @@ #define PACKEDATTR #endif -// C99 integer types; with gcc we just use this. Other compilers +// C99 integer types; with gcc we just use this. Other compilers // should add conditional statements that define the C99 types. // What is really wanted here is stdint.h; however, some old versions -// of Solaris don't have stdint.h and only have inttypes.h (the -// pre-standardisation version). inttypes.h is also in the C99 -// standard and defined to include stdint.h, so include this. +// of Solaris don't have stdint.h and only have inttypes.h (the +// pre-standardisation version). inttypes.h is also in the C99 +// standard and defined to include stdint.h, so include this. #include -#ifdef __cplusplus - -// Use builtin bool type with C++. - -typedef bool boolean; - -#else - -typedef enum -{ - false = 0, - true = 1, - undef = 0xFFFFFFFF -} boolean; - -#endif +// typedef enum +// { +// false = 0, +// true = 1, +// undef = 0xFFFFFFFF +// } boolean32; +// Use custom 32-bit integer for boolean for consistency between C and C++. +// Reason for this is that Doom uses boolean which is 8-bit in ESP32 C++ environment, and 32-bit in C environment. +// This messes up struct sizes when accessing C structs from C++ code. +// Defining boolean as 8-bit bool crashes game when shotgun is picked up, and I have no idea why. +// Thus I decided that the easiest solution is to define custom boolean32 type that will be 32 bit long everywhere. /AD +typedef int32_t boolean32; +#define false 0 +#define true 1 +#define undef 0xFFFFFFFF typedef uint8_t byte; diff --git a/firmware/doom/lib/doomgeneric/src/dummy.c b/firmware/doom/lib/doomgeneric/src/dummy.c index d78816b8..64f22844 100644 --- a/firmware/doom/lib/doomgeneric/src/dummy.c +++ b/firmware/doom/lib/doomgeneric/src/dummy.c @@ -24,9 +24,9 @@ * public data * *---------------------------------------------------------------------*/ -boolean net_client_connected = false; +boolean32 net_client_connected = false; -boolean drone = false; +boolean32 drone = false; /*---------------------------------------------------------------------* * private data * diff --git a/firmware/doom/lib/doomgeneric/src/f_finale.c b/firmware/doom/lib/doomgeneric/src/f_finale.c index ca6775ef..08bc6a2e 100644 --- a/firmware/doom/lib/doomgeneric/src/f_finale.c +++ b/firmware/doom/lib/doomgeneric/src/f_finale.c @@ -99,7 +99,7 @@ char* finaleflat; void F_StartCast (void); void F_CastTicker (void); -boolean F_CastResponder (event_t *ev); +boolean32 F_CastResponder (event_t *ev); void F_CastDrawer (void); // @@ -157,7 +157,7 @@ void F_StartFinale (void) -boolean F_Responder (event_t *event) +boolean32 F_Responder (event_t *event) { if (finalestage == F_STAGE_CAST) return F_CastResponder (event); @@ -328,10 +328,10 @@ castinfo_t castorder[] = { int castnum; int casttics; state_t* caststate; -boolean castdeath; +boolean32 castdeath; int castframes; int castonmelee; -boolean castattacking; +boolean32 castattacking; // @@ -462,7 +462,7 @@ void F_CastTicker (void) // F_CastResponder // -boolean F_CastResponder (event_t* ev) +boolean32 F_CastResponder (event_t* ev) { if (ev->type != ev_keydown) return false; @@ -543,7 +543,7 @@ void F_CastDrawer (void) spritedef_t* sprdef; spriteframe_t* sprframe; int lump; - boolean flip; + boolean32 flip; patch_t* patch; // erase the entire screen to a background @@ -555,7 +555,7 @@ void F_CastDrawer (void) sprdef = &sprites[caststate->sprite]; sprframe = &sprdef->spriteframes[ caststate->frame & FF_FRAMEMASK]; lump = sprframe->lump[0]; - flip = (boolean)sprframe->flip[0]; + flip = (boolean32)sprframe->flip[0]; patch = W_CacheLumpNum (lump+firstspritelump, PU_CACHE); if (flip) diff --git a/firmware/doom/lib/doomgeneric/src/f_finale.h b/firmware/doom/lib/doomgeneric/src/f_finale.h index daa71c32..fdebdb56 100644 --- a/firmware/doom/lib/doomgeneric/src/f_finale.h +++ b/firmware/doom/lib/doomgeneric/src/f_finale.h @@ -28,7 +28,7 @@ // // Called by main loop. -boolean F_Responder (event_t* ev); +boolean32 F_Responder (event_t* ev); // Called by main loop. void F_Ticker (void); diff --git a/firmware/doom/lib/doomgeneric/src/f_wipe.c b/firmware/doom/lib/doomgeneric/src/f_wipe.c index 05852fd2..010f42b4 100644 --- a/firmware/doom/lib/doomgeneric/src/f_wipe.c +++ b/firmware/doom/lib/doomgeneric/src/f_wipe.c @@ -32,7 +32,7 @@ // // when zero, stop the wipe -static boolean go = 0; +static boolean32 go = 0; static byte* wipe_scr_start; static byte* wipe_scr_end; @@ -77,7 +77,7 @@ wipe_doColorXForm int height, int ticks ) { - boolean changed; + boolean32 changed; byte* w; byte* e; int newval; @@ -173,7 +173,7 @@ wipe_doMelt short* s; short* d; - boolean done = true; + boolean32 done = true; width/=2; diff --git a/firmware/doom/lib/doomgeneric/src/g_game.c b/firmware/doom/lib/doomgeneric/src/g_game.c index 04eb1563..b7f4ec56 100644 --- a/firmware/doom/lib/doomgeneric/src/g_game.c +++ b/firmware/doom/lib/doomgeneric/src/g_game.c @@ -96,7 +96,7 @@ gamestate_t oldgamestate; gameaction_t gameaction; gamestate_t gamestate; skill_t gameskill; -boolean respawnmonsters; +boolean32 respawnmonsters; int gameepisode; int gamemap; @@ -104,23 +104,23 @@ int gamemap; int timelimit; -boolean paused; -boolean sendpause; // send a pause event next tic -boolean sendsave; // send a save event next tic -boolean usergame; // ok to save / end game +boolean32 paused; +boolean32 sendpause; // send a pause event next tic +boolean32 sendsave; // send a save event next tic +boolean32 usergame; // ok to save / end game -boolean timingdemo; // if true, exit with report on completion -boolean nodrawers; // for comparative timing purposes +boolean32 timingdemo; // if true, exit with report on completion +boolean32 nodrawers; // for comparative timing purposes int starttime; // for comparative timing purposes -boolean viewactive; +boolean32 viewactive; int deathmatch; // only if started as net death -boolean netgame; // only true if packets are broadcast -boolean playeringame[MAXPLAYERS]; +boolean32 netgame; // only true if packets are broadcast +boolean32 playeringame[MAXPLAYERS]; player_t players[MAXPLAYERS]; -boolean turbodetected[MAXPLAYERS]; +boolean32 turbodetected[MAXPLAYERS]; int consoleplayer; // player taking events and displaying int displayplayer; // view being displayed @@ -128,19 +128,19 @@ int levelstarttic; // gametic at level start int totalkills, totalitems, totalsecret; // for intermission char *demoname; -boolean demorecording; -boolean longtics; // cph's doom 1.91 longtics hack -boolean lowres_turn; // low resolution turning for longtics -boolean demoplayback; -boolean netdemo; +boolean32 demorecording; +boolean32 longtics; // cph's doom 1.91 longtics hack +boolean32 lowres_turn; // low resolution turning for longtics +boolean32 demoplayback; +boolean32 netdemo; byte* demobuffer; byte* demo_p; byte* demoend; -boolean singledemo; // quit after playing a demo from cmdline +boolean32 singledemo; // quit after playing a demo from cmdline -boolean precache = true; // if true, load all graphics at start +boolean32 precache = true; // if true, load all graphics at start -boolean testcontrols = false; // Invoked by setup to test controls +boolean32 testcontrols = false; // Invoked by setup to test controls int testcontrols_mousespeed; @@ -195,29 +195,29 @@ static const struct #define NUMKEYS 256 #define MAX_JOY_BUTTONS 20 -static boolean gamekeydown[NUMKEYS]; +static boolean32 gamekeydown[NUMKEYS]; static int turnheld; // for accelerative turning -static boolean mousearray[MAX_MOUSE_BUTTONS + 1]; -static boolean *mousebuttons = &mousearray[1]; // allow [-1] +static boolean32 mousearray[MAX_MOUSE_BUTTONS + 1]; +static boolean32 *mousebuttons = &mousearray[1]; // allow [-1] // mouse values are used once int mousex; int mousey; static int dclicktime; -static boolean dclickstate; +static boolean32 dclickstate; static int dclicks; static int dclicktime2; -static boolean dclickstate2; +static boolean32 dclickstate2; static int dclicks2; // joystick values are repeated static int joyxmove; static int joyymove; static int joystrafemove; -static boolean joyarray[MAX_JOY_BUTTONS + 1]; -static boolean *joybuttons = &joyarray[1]; // allow [-1] +static boolean32 joyarray[MAX_JOY_BUTTONS + 1]; +static boolean32 *joybuttons = &joyarray[1]; // allow [-1] static int savegameslot; static char savedescription[32]; @@ -241,7 +241,7 @@ int G_CmdChecksum (ticcmd_t* cmd) return sum; } -static boolean WeaponSelectable(weapontype_t weapon) +static boolean32 WeaponSelectable(weapontype_t weapon) { // Can't select the super shotgun in Doom 1. @@ -322,8 +322,8 @@ static int G_NextWeapon(int direction) void G_BuildTiccmd (ticcmd_t* cmd, int maketic) { int i; - boolean strafe; - boolean bstrafe; + boolean32 strafe; + boolean32 bstrafe; int speed; int tspeed; int forward; @@ -730,7 +730,7 @@ static void SetMouseButtons(unsigned int buttons_mask) // G_Responder // Get info needed to make ticcmd_ts for the players. // -boolean G_Responder (event_t* ev) +boolean32 G_Responder (event_t* ev) { // allow spy mode changes even during the demo if (gamestate == GS_LEVEL && ev->type == ev_keydown @@ -1112,7 +1112,7 @@ void G_PlayerReborn (int player) // void P_SpawnPlayer (mapthing_t* mthing); -boolean +boolean32 G_CheckSpot ( int playernum, mapthing_t* mthing ) @@ -1322,7 +1322,7 @@ int cpars[32] = // // G_DoCompleted // -boolean secretexit; +boolean32 secretexit; extern char* pagename; void G_ExitLevel (void) @@ -1531,7 +1531,7 @@ void G_DoWorldDone (void) // G_InitFromSavegame // Can be called by the startup code or the menu task. // -extern boolean setsizeneeded; +extern boolean32 setsizeneeded; void R_ExecuteSetViewSize (void); char savename[256]; @@ -2245,7 +2245,7 @@ void G_TimeDemo (char* name) =================== */ -boolean G_CheckDemoStatus (void) +boolean32 G_CheckDemoStatus (void) { int endtime; diff --git a/firmware/doom/lib/doomgeneric/src/g_game.h b/firmware/doom/lib/doomgeneric/src/g_game.h index da0df39b..eb493fd3 100644 --- a/firmware/doom/lib/doomgeneric/src/g_game.h +++ b/firmware/doom/lib/doomgeneric/src/g_game.h @@ -55,7 +55,7 @@ void G_BeginRecording (void); void G_PlayDemo (char* name); void G_TimeDemo (char* name); -boolean G_CheckDemoStatus (void); +boolean32 G_CheckDemoStatus (void); void G_ExitLevel (void); void G_SecretExitLevel (void); @@ -67,7 +67,7 @@ void G_WorldDone (void); void G_BuildTiccmd (ticcmd_t *cmd, int maketic); void G_Ticker (void); -boolean G_Responder (event_t* ev); +boolean32 G_Responder (event_t* ev); void G_ScreenShot (void); diff --git a/firmware/doom/lib/doomgeneric/src/gusconf.c b/firmware/doom/lib/doomgeneric/src/gusconf.c index 3855499c..65efc4d7 100644 --- a/firmware/doom/lib/doomgeneric/src/gusconf.c +++ b/firmware/doom/lib/doomgeneric/src/gusconf.c @@ -194,7 +194,7 @@ static char *ReadDMXConfig(void) return data; } -static boolean WriteTimidityConfig(char *path, gus_config_t *config) +static boolean32 WriteTimidityConfig(char *path, gus_config_t *config) { FILE *fstream; unsigned int i; @@ -241,9 +241,9 @@ static boolean WriteTimidityConfig(char *path, gus_config_t *config) return true; } -boolean GUS_WriteConfig(char *path) +boolean32 GUS_WriteConfig(char *path) { - boolean result; + boolean32 result; char *dmxconf; gus_config_t config; diff --git a/firmware/doom/lib/doomgeneric/src/gusconf.h b/firmware/doom/lib/doomgeneric/src/gusconf.h index e0124266..6dcc94bf 100644 --- a/firmware/doom/lib/doomgeneric/src/gusconf.h +++ b/firmware/doom/lib/doomgeneric/src/gusconf.h @@ -23,7 +23,7 @@ extern char *gus_patch_path; extern unsigned int gus_ram_kb; -boolean GUS_WriteConfig(char *path); +boolean32 GUS_WriteConfig(char *path); #endif /* #ifndef __GUSCONF_H__ */ diff --git a/firmware/doom/lib/doomgeneric/src/hu_lib.c b/firmware/doom/lib/doomgeneric/src/hu_lib.c index 47038a04..6ad15c79 100644 --- a/firmware/doom/lib/doomgeneric/src/hu_lib.c +++ b/firmware/doom/lib/doomgeneric/src/hu_lib.c @@ -28,10 +28,10 @@ #include "r_local.h" #include "r_draw.h" -// boolean : whether the screen is always erased +// boolean32 : whether the screen is always erased #define noterased viewwindowx -extern boolean automapactive; // in AM_map.c +extern boolean32 automapactive; // in AM_map.c void HUlib_init(void) { @@ -59,7 +59,7 @@ HUlib_initTextLine HUlib_clearTextLine(t); } -boolean +boolean32 HUlib_addCharToTextLine ( hu_textline_t* t, char ch ) @@ -77,7 +77,7 @@ HUlib_addCharToTextLine } -boolean HUlib_delCharFromTextLine(hu_textline_t* t) +boolean32 HUlib_delCharFromTextLine(hu_textline_t* t) { if (!t->len) return false; @@ -93,7 +93,7 @@ boolean HUlib_delCharFromTextLine(hu_textline_t* t) void HUlib_drawTextLine ( hu_textline_t* l, - boolean drawcursor ) + boolean32 drawcursor ) { int i; @@ -173,7 +173,7 @@ HUlib_initSText int h, patch_t** font, int startchar, - boolean* on ) + boolean32* on ) { int i; @@ -265,7 +265,7 @@ HUlib_initIText int y, patch_t** font, int startchar, - boolean* on ) + boolean32* on ) { it->lm = 0; // default left margin is start of text it->on = on; @@ -306,7 +306,7 @@ HUlib_addPrefixToIText // wrapper function for handling general keyed input. // returns true if it ate the key -boolean +boolean32 HUlib_keyInIText ( hu_itext_t* it, unsigned char ch ) diff --git a/firmware/doom/lib/doomgeneric/src/hu_lib.h b/firmware/doom/lib/doomgeneric/src/hu_lib.h index 8f0994e6..a1995e50 100644 --- a/firmware/doom/lib/doomgeneric/src/hu_lib.h +++ b/firmware/doom/lib/doomgeneric/src/hu_lib.h @@ -59,9 +59,9 @@ typedef struct int h; // height in lines int cl; // current line number - // pointer to boolean stating whether to update window - boolean* on; - boolean laston; // last value of *->on. + // pointer to boolean32 stating whether to update window + boolean32* on; + boolean32 laston; // last value of *->on. } hu_stext_t; @@ -76,9 +76,9 @@ typedef struct // left margin past which I am not to delete characters int lm; - // pointer to boolean stating whether to update window - boolean* on; - boolean laston; // last value of *->on; + // pointer to boolean32 stating whether to update window + boolean32* on; + boolean32 laston; // last value of *->on; } hu_itext_t; @@ -100,13 +100,13 @@ void HUlib_clearTextLine(hu_textline_t *t); void HUlib_initTextLine(hu_textline_t *t, int x, int y, patch_t **f, int sc); // returns success -boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch); +boolean32 HUlib_addCharToTextLine(hu_textline_t *t, char ch); // returns success -boolean HUlib_delCharFromTextLine(hu_textline_t *t); +boolean32 HUlib_delCharFromTextLine(hu_textline_t *t); // draws tline -void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor); +void HUlib_drawTextLine(hu_textline_t *l, boolean32 drawcursor); // erases text line void HUlib_eraseTextLine(hu_textline_t *l); @@ -125,7 +125,7 @@ HUlib_initSText int h, patch_t** font, int startchar, - boolean* on ); + boolean32* on ); // add a new line void HUlib_addLineToSText(hu_stext_t* s); @@ -151,7 +151,7 @@ HUlib_initIText int y, patch_t** font, int startchar, - boolean* on ); + boolean32* on ); // enforces left margin void HUlib_delCharFromIText(hu_itext_t* it); @@ -169,7 +169,7 @@ HUlib_addPrefixToIText char* str ); // whether eaten -boolean +boolean32 HUlib_keyInIText ( hu_itext_t* it, unsigned char ch ); diff --git a/firmware/doom/lib/doomgeneric/src/hu_stuff.c b/firmware/doom/lib/doomgeneric/src/hu_stuff.c index b63cac76..b8ce9cf9 100644 --- a/firmware/doom/lib/doomgeneric/src/hu_stuff.c +++ b/firmware/doom/lib/doomgeneric/src/hu_stuff.c @@ -87,22 +87,22 @@ char chat_char; // remove later. static player_t* plr; patch_t* hu_font[HU_FONTSIZE]; static hu_textline_t w_title; -boolean chat_on; +boolean32 chat_on; static hu_itext_t w_chat; -static boolean always_off = false; +static boolean32 always_off = false; static char chat_dest[MAXPLAYERS]; static hu_itext_t w_inputbuffer[MAXPLAYERS]; -static boolean message_on; -boolean message_dontfuckwithme; -static boolean message_nottobefuckedwith; +static boolean32 message_on; +boolean32 message_dontfuckwithme; +static boolean32 message_nottobefuckedwith; static hu_stext_t w_message; static int message_counter; extern int showMessages; -static boolean headsupactive = false; +static boolean32 headsupactive = false; // // Builtin map names. @@ -509,13 +509,13 @@ char HU_dequeueChatChar(void) return c; } -boolean HU_Responder(event_t *ev) +boolean32 HU_Responder(event_t *ev) { static char lastmessage[HU_MAXLINELENGTH+1]; char* macromessage; - boolean eatkey = false; - static boolean altdown = false; + boolean32 eatkey = false; + static boolean32 altdown = false; unsigned char c; int i; int numplayers; diff --git a/firmware/doom/lib/doomgeneric/src/hu_stuff.h b/firmware/doom/lib/doomgeneric/src/hu_stuff.h index a3affc5b..7325971d 100644 --- a/firmware/doom/lib/doomgeneric/src/hu_stuff.h +++ b/firmware/doom/lib/doomgeneric/src/hu_stuff.h @@ -46,7 +46,7 @@ void HU_Init(void); void HU_Start(void); -boolean HU_Responder(event_t* ev); +boolean32 HU_Responder(event_t* ev); void HU_Ticker(void); void HU_Drawer(void); diff --git a/firmware/doom/lib/doomgeneric/src/i_joystick.c b/firmware/doom/lib/doomgeneric/src/i_joystick.c index 11f2fd62..42db9770 100644 --- a/firmware/doom/lib/doomgeneric/src/i_joystick.c +++ b/firmware/doom/lib/doomgeneric/src/i_joystick.c @@ -87,7 +87,7 @@ void I_ShutdownJoystick(void) } #ifdef ORIGCODE -static boolean IsValidAxis(int axis) +static boolean32 IsValidAxis(int axis) { int num_axes; @@ -168,7 +168,7 @@ void I_InitJoystick(void) } #ifdef ORIGCODE -static boolean IsAxisButton(int physbutton) +static boolean32 IsAxisButton(int physbutton) { if (IS_BUTTON_AXIS(joystick_x_axis)) { diff --git a/firmware/doom/lib/doomgeneric/src/i_scale.c b/firmware/doom/lib/doomgeneric/src/i_scale.c index f15a71f6..b48427d2 100644 --- a/firmware/doom/lib/doomgeneric/src/i_scale.c +++ b/firmware/doom/lib/doomgeneric/src/i_scale.c @@ -72,7 +72,7 @@ void I_InitScale(byte *_src_buffer, byte *_dest_buffer, int _dest_pitch) // 1x scale doesn't really do any scaling: it just copies the buffer // a line at a time for when pitch != SCREENWIDTH (!native_surface) -static boolean I_Scale1x(int x1, int y1, int x2, int y2) +static boolean32 I_Scale1x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp; int y; @@ -102,7 +102,7 @@ screen_mode_t mode_scale_1x = { // 2x scale (640x400) -static boolean I_Scale2x(int x1, int y1, int x2, int y2) +static boolean32 I_Scale2x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp, *screenp2; int x, y; @@ -143,7 +143,7 @@ screen_mode_t mode_scale_2x = { // 3x scale (960x600) -static boolean I_Scale3x(int x1, int y1, int x2, int y2) +static boolean32 I_Scale3x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp, *screenp2, *screenp3; int x, y; @@ -188,7 +188,7 @@ screen_mode_t mode_scale_3x = { // 4x scale (1280x800) -static boolean I_Scale4x(int x1, int y1, int x2, int y2) +static boolean32 I_Scale4x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp, *screenp2, *screenp3, *screenp4; int x, y; @@ -237,7 +237,7 @@ screen_mode_t mode_scale_4x = { // 5x scale (1600x1000) -static boolean I_Scale5x(int x1, int y1, int x2, int y2) +static boolean32 I_Scale5x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp, *screenp2, *screenp3, *screenp4, *screenp5; int x, y; @@ -447,7 +447,7 @@ static inline void WriteBlendedLine1x(byte *dest, byte *src1, byte *src2, // 1x stretch (320x240) -static boolean I_Stretch1x(int x1, int y1, int x2, int y2) +static boolean32 I_Stretch1x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp; int y; @@ -536,7 +536,7 @@ static inline void WriteBlendedLine2x(byte *dest, byte *src1, byte *src2, // 2x stretch (640x480) -static boolean I_Stretch2x(int x1, int y1, int x2, int y2) +static boolean32 I_Stretch2x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp; int y; @@ -651,7 +651,7 @@ static inline void WriteBlendedLine3x(byte *dest, byte *src1, byte *src2, // 3x stretch (960x720) -static boolean I_Stretch3x(int x1, int y1, int x2, int y2) +static boolean32 I_Stretch3x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp; int y; @@ -792,7 +792,7 @@ static inline void WriteBlendedLine4x(byte *dest, byte *src1, byte *src2, // 4x stretch (1280x960) -static boolean I_Stretch4x(int x1, int y1, int x2, int y2) +static boolean32 I_Stretch4x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp; int y; @@ -939,7 +939,7 @@ static inline void WriteLine5x(byte *dest, byte *src) // 5x stretch (1600x1200) -static boolean I_Stretch5x(int x1, int y1, int x2, int y2) +static boolean32 I_Stretch5x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp; int y; @@ -1058,7 +1058,7 @@ static inline void WriteSquashedLine1x(byte *dest, byte *src) // 1x squashed (256x200) -static boolean I_Squash1x(int x1, int y1, int x2, int y2) +static boolean32 I_Squash1x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp; int y; @@ -1157,7 +1157,7 @@ static inline void WriteSquashedLine2x(byte *dest, byte *src) // 2x squash (512x400) -static boolean I_Squash2x(int x1, int y1, int x2, int y2) +static boolean32 I_Squash2x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp; int y; @@ -1240,7 +1240,7 @@ static inline void WriteSquashedLine3x(byte *dest, byte *src) // exactly. // -static boolean I_Squash3x(int x1, int y1, int x2, int y2) +static boolean32 I_Squash3x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp; int y; @@ -1351,7 +1351,7 @@ static inline void WriteSquashedLine4x(byte *dest, byte *src) // 4x squashed (1024x800) // -static boolean I_Squash4x(int x1, int y1, int x2, int y2) +static boolean32 I_Squash4x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp; int y; @@ -1416,7 +1416,7 @@ static inline void WriteSquashedLine5x(byte *dest, byte *src) // 5x squashed (1280x1000) // -static boolean I_Squash5x(int x1, int y1, int x2, int y2) +static boolean32 I_Squash5x(int x1, int y1, int x2, int y2) { byte *bufp, *screenp; int y; diff --git a/firmware/doom/lib/doomgeneric/src/i_sound.c b/firmware/doom/lib/doomgeneric/src/i_sound.c index 5e57b66e..0782770e 100644 --- a/firmware/doom/lib/doomgeneric/src/i_sound.c +++ b/firmware/doom/lib/doomgeneric/src/i_sound.c @@ -99,7 +99,7 @@ static sound_module_t *sound_modules[] = // Check if a sound device is in the given list of devices -static boolean SndDeviceInList(snddevice_t device, snddevice_t *list, +static boolean32 SndDeviceInList(snddevice_t device, snddevice_t *list, int len) { int i; @@ -118,7 +118,7 @@ static boolean SndDeviceInList(snddevice_t device, snddevice_t *list, // Find and initialize a sound_module_t appropriate for the setting // in snd_sfxdevice. -static void InitSfxModule(boolean use_sfx_prefix) +static void InitSfxModule(boolean32 use_sfx_prefix) { int i; @@ -159,9 +159,9 @@ static void InitMusicModule(void) // allocates channel buffer, sets S_sfx lookup. // -void I_InitSound(boolean use_sfx_prefix) +void I_InitSound(boolean32 use_sfx_prefix) { - boolean nosound, nosfx, nomusic; + boolean32 nosound, nosfx, nomusic; //! // @vanilla @@ -304,7 +304,7 @@ void I_StopSound(int channel) } } -boolean I_SoundIsPlaying(int channel) +boolean32 I_SoundIsPlaying(int channel) { if (sound_module != NULL) { @@ -381,7 +381,7 @@ void I_UnRegisterSong(void *handle) } } -void I_PlaySong(void *handle, boolean looping) +void I_PlaySong(void *handle, boolean32 looping) { if (music_module != NULL) { @@ -397,7 +397,7 @@ void I_StopSong(void) } } -boolean I_MusicIsPlaying(void) +boolean32 I_MusicIsPlaying(void) { if (music_module != NULL) { diff --git a/firmware/doom/lib/doomgeneric/src/i_sound.h b/firmware/doom/lib/doomgeneric/src/i_sound.h index e429e960..3334dc96 100644 --- a/firmware/doom/lib/doomgeneric/src/i_sound.h +++ b/firmware/doom/lib/doomgeneric/src/i_sound.h @@ -112,7 +112,7 @@ typedef struct // Initialise sound module // Returns true if successfully initialised - boolean (*Init)(boolean use_sfx_prefix); + boolean32 (*Init)(boolean32 use_sfx_prefix); // Shutdown sound module @@ -141,7 +141,7 @@ typedef struct // Query if a sound is playing on the given channel - boolean (*SoundIsPlaying)(int channel); + boolean32 (*SoundIsPlaying)(int channel); // Called on startup to precache sound effects (if necessary) @@ -149,14 +149,14 @@ typedef struct } sound_module_t; -void I_InitSound(boolean use_sfx_prefix); +void I_InitSound(boolean32 use_sfx_prefix); void I_ShutdownSound(void); int I_GetSfxLumpNum(sfxinfo_t *sfxinfo); void I_UpdateSound(void); void I_UpdateSoundParams(int channel, int vol, int sep); int I_StartSound(sfxinfo_t *sfxinfo, int channel, int vol, int sep); void I_StopSound(int channel); -boolean I_SoundIsPlaying(int channel); +boolean32 I_SoundIsPlaying(int channel); void I_PrecacheSounds(sfxinfo_t *sounds, int num_sounds); // Interface for music modules @@ -170,7 +170,7 @@ typedef struct // Initialise the music subsystem - boolean (*Init)(void); + boolean32 (*Init)(void); // Shutdown the music subsystem @@ -199,7 +199,7 @@ typedef struct // Play the song - void (*PlaySong)(void *handle, boolean looping); + void (*PlaySong)(void *handle, boolean32 looping); // Stop playing the current song. @@ -207,7 +207,7 @@ typedef struct // Query if music is playing. - boolean (*MusicIsPlaying)(void); + boolean32 (*MusicIsPlaying)(void); // Invoked periodically to poll. @@ -221,9 +221,9 @@ void I_PauseSong(void); void I_ResumeSong(void); void *I_RegisterSong(void *data, int len); void I_UnRegisterSong(void *handle); -void I_PlaySong(void *handle, boolean looping); +void I_PlaySong(void *handle, boolean32 looping); void I_StopSong(void); -boolean I_MusicIsPlaying(void); +boolean32 I_MusicIsPlaying(void); extern int snd_sfxdevice; extern int snd_musicdevice; diff --git a/firmware/doom/lib/doomgeneric/src/i_system.c b/firmware/doom/lib/doomgeneric/src/i_system.c index af0545fd..b9fda070 100644 --- a/firmware/doom/lib/doomgeneric/src/i_system.c +++ b/firmware/doom/lib/doomgeneric/src/i_system.c @@ -64,13 +64,13 @@ typedef struct atexit_listentry_s atexit_listentry_t; struct atexit_listentry_s { atexit_func_t func; - boolean run_on_error; + boolean32 run_on_error; atexit_listentry_t *next; }; static atexit_listentry_t *exit_funcs = NULL; -void I_AtExit(atexit_func_t func, boolean run_on_error) +void I_AtExit(atexit_func_t func, boolean32 run_on_error) { atexit_listentry_t *entry; @@ -208,7 +208,7 @@ void I_PrintStartupBanner(char *gamedescription) // Returns true if stdout is a real console, false if it is a file // -boolean I_ConsoleStdout(void) +boolean32 I_ConsoleStdout(void) { #ifdef _WIN32 // SDL "helpfully" always redirects stdout to a file. @@ -355,14 +355,14 @@ static int ZenityErrorBox(char *message) // I_Error // -static boolean already_quitting = false; +static boolean32 already_quitting = false; void I_Error (char *error, ...) { char msgbuf[512]; va_list argptr; atexit_listentry_t *entry; - boolean exit_gui_popup; + boolean32 exit_gui_popup; if (already_quitting) { @@ -497,9 +497,9 @@ static unsigned char mem_dump_custom[DOS_MEM_DUMP_SIZE]; static const unsigned char *dos_mem_dump = mem_dump_dos622; -boolean I_GetMemoryValue(unsigned int offset, void *value, int size) +boolean32 I_GetMemoryValue(unsigned int offset, void *value, int size) { - static boolean firsttime = true; + static boolean32 firsttime = true; if (firsttime) { diff --git a/firmware/doom/lib/doomgeneric/src/i_system.h b/firmware/doom/lib/doomgeneric/src/i_system.h index fe434828..ab5235b3 100644 --- a/firmware/doom/lib/doomgeneric/src/i_system.h +++ b/firmware/doom/lib/doomgeneric/src/i_system.h @@ -35,7 +35,7 @@ void I_Init (void); // for the zone management. byte* I_ZoneBase (int *size); -boolean I_ConsoleStdout(void); +boolean32 I_ConsoleStdout(void); // Asynchronous interrupt functions should maintain private queues @@ -57,13 +57,13 @@ void I_Error (char *error, ...); void I_Tactile (int on, int off, int total); -boolean I_GetMemoryValue(unsigned int offset, void *value, int size); +boolean32 I_GetMemoryValue(unsigned int offset, void *value, int size); // Schedule a function to be called when the program exits. // If run_if_error is true, the function is called if the exit // is due to an error (I_Error) -void I_AtExit(atexit_func_t func, boolean run_if_error); +void I_AtExit(atexit_func_t func, boolean32 run_if_error); // Add all system-specific config file variable bindings. diff --git a/firmware/doom/lib/doomgeneric/src/i_video.c b/firmware/doom/lib/doomgeneric/src/i_video.c index 2bf8ab32..25f2fdb7 100644 --- a/firmware/doom/lib/doomgeneric/src/i_video.c +++ b/firmware/doom/lib/doomgeneric/src/i_video.c @@ -92,12 +92,12 @@ byte *I_VideoBuffer = NULL; // If true, game is running as a screensaver -boolean screensaver_mode = false; +boolean32 screensaver_mode = false; // Flag indicating whether the screen is currently visible: // when the screen isnt visible, don't render the screen -boolean screenvisible; +boolean32 screenvisible; // Mouse acceleration // @@ -405,7 +405,7 @@ void I_BindVideoVariables (void) { } -void I_DisplayFPSDots (boolean dots_on) +void I_DisplayFPSDots (boolean32 dots_on) { } diff --git a/firmware/doom/lib/doomgeneric/src/i_video.h b/firmware/doom/lib/doomgeneric/src/i_video.h index d1e38ca2..880b522f 100644 --- a/firmware/doom/lib/doomgeneric/src/i_video.h +++ b/firmware/doom/lib/doomgeneric/src/i_video.h @@ -55,7 +55,7 @@ typedef struct // Function to call to draw the screen from the source buffer. // Return true if draw was successful. - boolean (*DrawScreen)(int x1, int y1, int x2, int y2); + boolean32 (*DrawScreen)(int x1, int y1, int x2, int y2); // If true, this is a "poor quality" mode. The autoadjust // code should always attempt to use a different mode to this @@ -87,10 +87,10 @@ typedef struct // that even higher resolutions would be needed before it would // look acceptable, but it turned out to be okay even at 640x480. - boolean poor_quality; + boolean32 poor_quality; } screen_mode_t; -typedef boolean (*grabmouse_callback_t)(void); +typedef boolean32 (*grabmouse_callback_t)(void); // Called by D_DoomMain, // determines the hardware configuration @@ -117,7 +117,7 @@ void I_SetWindowTitle(char *title); void I_CheckIsScreensaver(void); void I_SetGrabMouseCallback(grabmouse_callback_t func); -void I_DisplayFPSDots(boolean dots_on); +void I_DisplayFPSDots(boolean32 dots_on); void I_BindVideoVariables(void); void I_InitWindowTitle(void); @@ -140,12 +140,12 @@ void I_EnableLoadingDisk(void); void I_EndRead (void); extern char *video_driver; -extern boolean screenvisible; +extern boolean32 screenvisible; extern float mouse_acceleration; extern int mouse_threshold; extern int vanilla_keyboard_mapping; -extern boolean screensaver_mode; +extern boolean32 screensaver_mode; extern int usegamma; extern byte *I_VideoBuffer; diff --git a/firmware/doom/lib/doomgeneric/src/m_argv.c b/firmware/doom/lib/doomgeneric/src/m_argv.c index 2d17e09e..d9e86684 100644 --- a/firmware/doom/lib/doomgeneric/src/m_argv.c +++ b/firmware/doom/lib/doomgeneric/src/m_argv.c @@ -60,7 +60,7 @@ int M_CheckParmWithArgs(char *check, int num_args) // line arguments, false if not. // -boolean M_ParmExists(char *check) +boolean32 M_ParmExists(char *check) { return M_CheckParm(check) != 0; } diff --git a/firmware/doom/lib/doomgeneric/src/m_argv.h b/firmware/doom/lib/doomgeneric/src/m_argv.h index 99b7ef62..75070933 100644 --- a/firmware/doom/lib/doomgeneric/src/m_argv.h +++ b/firmware/doom/lib/doomgeneric/src/m_argv.h @@ -41,7 +41,7 @@ void M_FindResponseFile(void); // Parameter has been specified? -boolean M_ParmExists(char *check); +boolean32 M_ParmExists(char *check); // Get name of executable used to run this program: diff --git a/firmware/doom/lib/doomgeneric/src/m_config.c b/firmware/doom/lib/doomgeneric/src/m_config.c index 05477c81..c239dd2d 100644 --- a/firmware/doom/lib/doomgeneric/src/m_config.c +++ b/firmware/doom/lib/doomgeneric/src/m_config.c @@ -82,7 +82,7 @@ typedef struct // If true, this config variable has been bound to a variable // and is being used. - boolean bound; + boolean32 bound; } default_t; typedef struct @@ -1974,7 +1974,7 @@ void M_BindVariable(char *name, void *location) // Set the value of a particular variable; an API function for other // parts of the program to assign values to config variables by name. -boolean M_SetVariable(char *name, char *value) +boolean32 M_SetVariable(char *name, char *value) { default_t *variable; diff --git a/firmware/doom/lib/doomgeneric/src/m_config.h b/firmware/doom/lib/doomgeneric/src/m_config.h index cf402339..1c50d47d 100644 --- a/firmware/doom/lib/doomgeneric/src/m_config.h +++ b/firmware/doom/lib/doomgeneric/src/m_config.h @@ -28,7 +28,7 @@ void M_SaveDefaults(void); void M_SaveDefaultsAlternate(char *main, char *extra); void M_SetConfigDir(char *dir); void M_BindVariable(char *name, void *variable); -boolean M_SetVariable(char *name, char *value); +boolean32 M_SetVariable(char *name, char *value); int M_GetIntVariable(char *name); const char *M_GetStrVariable(char *name); float M_GetFloatVariable(char *name); diff --git a/firmware/doom/lib/doomgeneric/src/m_menu.c b/firmware/doom/lib/doomgeneric/src/m_menu.c index 6df96559..31f2c9a4 100644 --- a/firmware/doom/lib/doomgeneric/src/m_menu.c +++ b/firmware/doom/lib/doomgeneric/src/m_menu.c @@ -60,9 +60,9 @@ extern patch_t* hu_font[HU_FONTSIZE]; -extern boolean message_dontfuckwithme; +extern boolean32 message_dontfuckwithme; -extern boolean chat_on; // in heads-up code +extern boolean32 chat_on; // in heads-up code // // defaulted values @@ -94,7 +94,7 @@ int messy; int messageLastMenuActive; // timed message = no input from user -boolean messageNeedsInput; +boolean32 messageNeedsInput; void (*messageRoutine)(int response); @@ -114,18 +114,18 @@ int saveCharIndex; // which char we're editing // old save description before edit char saveOldString[SAVESTRINGSIZE]; -boolean inhelpscreens; -boolean menuactive; +boolean32 inhelpscreens; +boolean32 menuactive; #define SKULLXOFF -32 #define LINEHEIGHT 16 -extern boolean sendpause; +extern boolean32 sendpause; char savegamestrings[10][SAVESTRINGSIZE]; char endstring[160]; -//static boolean opldev; +//static boolean32 opldev; // // MENU TYPEDEFS @@ -218,7 +218,7 @@ void M_DrawSelCell(menu_t *menu,int item); void M_WriteText(int x, int y, char *string); int M_StringWidth(char *string); int M_StringHeight(char *string); -void M_StartMessage(char *string,void *routine,boolean input); +void M_StartMessage(char *string,void *routine,boolean32 input); void M_StopMessage(void); void M_ClearMenus (void); @@ -1289,7 +1289,7 @@ void M_StartMessage ( char* string, void* routine, - boolean input ) + boolean32 input ) { messageLastMenuActive = menuactive; messageToPrint = 1; @@ -1400,7 +1400,7 @@ M_WriteText // These keys evaluate to a "null" key in Vanilla Doom that allows weird // jumping in the menus. Preserve this behavior for accuracy. -static boolean IsNullKey(int key) +static boolean32 IsNullKey(int key) { return key == KEY_PAUSE || key == KEY_CAPSLOCK || key == KEY_SCRLCK || key == KEY_NUMLOCK; @@ -1413,7 +1413,7 @@ static boolean IsNullKey(int key) // // M_Responder // -boolean M_Responder (event_t* ev) +boolean32 M_Responder (event_t* ev) { int ch; int key; diff --git a/firmware/doom/lib/doomgeneric/src/m_menu.h b/firmware/doom/lib/doomgeneric/src/m_menu.h index ce41db39..a5373995 100644 --- a/firmware/doom/lib/doomgeneric/src/m_menu.h +++ b/firmware/doom/lib/doomgeneric/src/m_menu.h @@ -32,7 +32,7 @@ // Even when the menu is not displayed, // this can resize the view and change game parameters. // Does all the real work of the menu interaction. -boolean M_Responder (event_t *ev); +boolean32 M_Responder (event_t *ev); // Called by main loop, diff --git a/firmware/doom/lib/doomgeneric/src/m_misc.c b/firmware/doom/lib/doomgeneric/src/m_misc.c index 1a9489f4..81886e18 100644 --- a/firmware/doom/lib/doomgeneric/src/m_misc.c +++ b/firmware/doom/lib/doomgeneric/src/m_misc.c @@ -63,7 +63,7 @@ void M_MakeDirectory(char *path) // Check if a file exists -boolean M_FileExists(char *filename) +boolean32 M_FileExists(char *filename) { FILE *fstream; @@ -109,7 +109,7 @@ long M_FileLength(FILE *handle) // M_WriteFile // -boolean M_WriteFile(char *name, void *source, int length) +boolean32 M_WriteFile(char *name, void *source, int length) { FILE *handle; int count; @@ -187,7 +187,7 @@ char *M_TempFile(char *s) return M_StringJoin(tempdir, DIR_SEPARATOR_S, s, NULL); } -boolean M_StrToInt(const char *str, int *result) +boolean32 M_StrToInt(const char *str, int *result) { return sscanf(str, " 0x%x", result) == 1 || sscanf(str, " 0X%x", result) == 1 @@ -370,7 +370,7 @@ char *M_StringReplace(const char *haystack, const char *needle, // Safe string copy function that works like OpenBSD's strlcpy(). // Returns true if the string was not truncated. -boolean M_StringCopy(char *dest, const char *src, size_t dest_size) +boolean32 M_StringCopy(char *dest, const char *src, size_t dest_size) { size_t len; @@ -391,7 +391,7 @@ boolean M_StringCopy(char *dest, const char *src, size_t dest_size) // Safe string concat function that works like OpenBSD's strlcat(). // Returns true if string not truncated. -boolean M_StringConcat(char *dest, const char *src, size_t dest_size) +boolean32 M_StringConcat(char *dest, const char *src, size_t dest_size) { size_t offset; @@ -406,7 +406,7 @@ boolean M_StringConcat(char *dest, const char *src, size_t dest_size) // Returns true if 's' begins with the specified prefix. -boolean M_StringStartsWith(const char *s, const char *prefix) +boolean32 M_StringStartsWith(const char *s, const char *prefix) { return strlen(s) > strlen(prefix) && strncmp(s, prefix, strlen(prefix)) == 0; @@ -414,7 +414,7 @@ boolean M_StringStartsWith(const char *s, const char *prefix) // Returns true if 's' ends with the specified suffix. -boolean M_StringEndsWith(const char *s, const char *suffix) +boolean32 M_StringEndsWith(const char *s, const char *suffix) { return strlen(s) >= strlen(suffix) && strcmp(s + strlen(s) - strlen(suffix), suffix) == 0; diff --git a/firmware/doom/lib/doomgeneric/src/m_misc.h b/firmware/doom/lib/doomgeneric/src/m_misc.h index 0182a405..3049dbbe 100644 --- a/firmware/doom/lib/doomgeneric/src/m_misc.h +++ b/firmware/doom/lib/doomgeneric/src/m_misc.h @@ -26,24 +26,24 @@ #include "doomtype.h" #include "d_log.h" -boolean M_WriteFile(char *name, void *source, int length); +boolean32 M_WriteFile(char *name, void *source, int length); int M_ReadFile(char *name, byte **buffer); void M_MakeDirectory(char *dir); char *M_TempFile(char *s); -boolean M_FileExists(char *file); +boolean32 M_FileExists(char *file); long M_FileLength(FILE *handle); -boolean M_StrToInt(const char *str, int *result); +boolean32 M_StrToInt(const char *str, int *result); void M_ExtractFileBase(char *path, char *dest); void M_ForceUppercase(char *text); char *M_StrCaseStr(char *haystack, char *needle); char *M_StringDuplicate(const char *orig); -boolean M_StringCopy(char *dest, const char *src, size_t dest_size); -boolean M_StringConcat(char *dest, const char *src, size_t dest_size); +boolean32 M_StringCopy(char *dest, const char *src, size_t dest_size); +boolean32 M_StringConcat(char *dest, const char *src, size_t dest_size); char *M_StringReplace(const char *haystack, const char *needle, const char *replacement); char *M_StringJoin(const char *s, ...); -boolean M_StringStartsWith(const char *s, const char *prefix); -boolean M_StringEndsWith(const char *s, const char *suffix); +boolean32 M_StringStartsWith(const char *s, const char *prefix); +boolean32 M_StringEndsWith(const char *s, const char *suffix); int M_vsnprintf(char *buf, size_t buf_len, const char *s, va_list args); int M_snprintf(char *buf, size_t buf_len, const char *s, ...); char *M_OEMToUTF8(const char *ansi); diff --git a/firmware/doom/lib/doomgeneric/src/mus2mid.c b/firmware/doom/lib/doomgeneric/src/mus2mid.c index f73d02fd..27d8e9f3 100644 --- a/firmware/doom/lib/doomgeneric/src/mus2mid.c +++ b/firmware/doom/lib/doomgeneric/src/mus2mid.c @@ -100,7 +100,7 @@ static int channel_map[NUM_CHANNELS]; // Write timestamp to a MIDI file. -static boolean WriteTime(unsigned int time, MEMFILE *midioutput) +static boolean32 WriteTime(unsigned int time, MEMFILE *midioutput) { unsigned int buffer = time & 0x7F; byte writeval; @@ -136,7 +136,7 @@ static boolean WriteTime(unsigned int time, MEMFILE *midioutput) // Write the end of track marker -static boolean WriteEndTrack(MEMFILE *midioutput) +static boolean32 WriteEndTrack(MEMFILE *midioutput) { byte endtrack[] = {0xFF, 0x2F, 0x00}; @@ -155,7 +155,7 @@ static boolean WriteEndTrack(MEMFILE *midioutput) } // Write a key press event -static boolean WritePressKey(byte channel, byte key, +static boolean32 WritePressKey(byte channel, byte key, byte velocity, MEMFILE *midioutput) { byte working = midi_presskey | channel; @@ -190,7 +190,7 @@ static boolean WritePressKey(byte channel, byte key, } // Write a key release event -static boolean WriteReleaseKey(byte channel, byte key, +static boolean32 WriteReleaseKey(byte channel, byte key, MEMFILE *midioutput) { byte working = midi_releasekey | channel; @@ -225,7 +225,7 @@ static boolean WriteReleaseKey(byte channel, byte key, } // Write a pitch wheel/bend event -static boolean WritePitchWheel(byte channel, short wheel, +static boolean32 WritePitchWheel(byte channel, short wheel, MEMFILE *midioutput) { byte working = midi_pitchwheel | channel; @@ -259,7 +259,7 @@ static boolean WritePitchWheel(byte channel, short wheel, } // Write a patch change event -static boolean WriteChangePatch(byte channel, byte patch, +static boolean32 WriteChangePatch(byte channel, byte patch, MEMFILE *midioutput) { byte working = midi_changepatch | channel; @@ -288,7 +288,7 @@ static boolean WriteChangePatch(byte channel, byte patch, // Write a valued controller change event -static boolean WriteChangeController_Valued(byte channel, +static boolean32 WriteChangeController_Valued(byte channel, byte control, byte value, MEMFILE *midioutput) @@ -336,7 +336,7 @@ static boolean WriteChangeController_Valued(byte channel, } // Write a valueless controller change event -static boolean WriteChangeController_Valueless(byte channel, +static boolean32 WriteChangeController_Valueless(byte channel, byte control, MEMFILE *midioutput) { @@ -412,9 +412,9 @@ static int GetMIDIChannel(int mus_channel, MEMFILE *midioutput) } } -static boolean ReadMusHeader(MEMFILE *file, musheader *header) +static boolean32 ReadMusHeader(MEMFILE *file, musheader *header) { - boolean result; + boolean32 result; result = mem_fread(&header->id, sizeof(byte), 4, file) == 4 && mem_fread(&header->scorelength, sizeof(short), 1, file) == 1 @@ -441,7 +441,7 @@ static boolean ReadMusHeader(MEMFILE *file, musheader *header) // // Returns 0 on success or 1 on failure. -boolean mus2mid(MEMFILE *musinput, MEMFILE *midioutput) +boolean32 mus2mid(MEMFILE *musinput, MEMFILE *midioutput) { // Header for the MUS file musheader musfileheader; diff --git a/firmware/doom/lib/doomgeneric/src/mus2mid.h b/firmware/doom/lib/doomgeneric/src/mus2mid.h index d21516c7..afce5952 100644 --- a/firmware/doom/lib/doomgeneric/src/mus2mid.h +++ b/firmware/doom/lib/doomgeneric/src/mus2mid.h @@ -4,6 +4,6 @@ #include "doomtype.h" #include "memio.h" -boolean mus2mid(MEMFILE *musinput, MEMFILE *midioutput); +boolean32 mus2mid(MEMFILE *musinput, MEMFILE *midioutput); #endif /* #ifndef MUS2MID_H */ \ No newline at end of file diff --git a/firmware/doom/lib/doomgeneric/src/net_client.h b/firmware/doom/lib/doomgeneric/src/net_client.h index 31dc9e4a..5c210688 100644 --- a/firmware/doom/lib/doomgeneric/src/net_client.h +++ b/firmware/doom/lib/doomgeneric/src/net_client.h @@ -22,22 +22,22 @@ #include "sha1.h" #include "net_defs.h" -boolean NET_CL_Connect(net_addr_t *addr, net_connect_data_t *data); +boolean32 NET_CL_Connect(net_addr_t *addr, net_connect_data_t *data); void NET_CL_Disconnect(void); void NET_CL_Run(void); void NET_CL_Init(void); void NET_CL_LaunchGame(void); void NET_CL_StartGame(net_gamesettings_t *settings); void NET_CL_SendTiccmd(ticcmd_t *ticcmd, int maketic); -boolean NET_CL_GetSettings(net_gamesettings_t *_settings); +boolean32 NET_CL_GetSettings(net_gamesettings_t *_settings); void NET_Init(void); void NET_BindVariables(void); -extern boolean net_client_connected; -extern boolean net_client_received_wait_data; +extern boolean32 net_client_connected; +extern boolean32 net_client_received_wait_data; extern net_waitdata_t net_client_wait_data; -extern boolean net_waiting_for_launch; +extern boolean32 net_waiting_for_launch; extern char *net_player_name; extern sha1_digest_t net_server_wad_sha1sum; @@ -47,6 +47,6 @@ extern sha1_digest_t net_local_wad_sha1sum; extern sha1_digest_t net_local_deh_sha1sum; extern unsigned int net_local_is_freedoom; -extern boolean drone; +extern boolean32 drone; #endif /* #ifndef NET_CLIENT_H */ diff --git a/firmware/doom/lib/doomgeneric/src/net_defs.h b/firmware/doom/lib/doomgeneric/src/net_defs.h index bedfb95b..26b15842 100644 --- a/firmware/doom/lib/doomgeneric/src/net_defs.h +++ b/firmware/doom/lib/doomgeneric/src/net_defs.h @@ -61,11 +61,11 @@ struct _net_module_s { // Initialize this module for use as a client - boolean (*InitClient)(void); + boolean32 (*InitClient)(void); // Initialize this module for use as a server - boolean (*InitServer)(void); + boolean32 (*InitServer)(void); // Send a packet @@ -75,7 +75,7 @@ struct _net_module_s // // Returns true if packet received - boolean (*RecvPacket)(net_addr_t **addr, net_packet_t **packet); + boolean32 (*RecvPacket)(net_addr_t **addr, net_packet_t **packet); // Converts an address to a string @@ -211,7 +211,7 @@ typedef struct { signed int latency; unsigned int seq; - boolean playeringame[NET_MAXPLAYERS]; + boolean32 playeringame[NET_MAXPLAYERS]; net_ticdiff_t cmds[NET_MAXPLAYERS]; } net_full_ticcmd_t; diff --git a/firmware/doom/lib/doomgeneric/src/net_io.h b/firmware/doom/lib/doomgeneric/src/net_io.h index 53502223..e0056ad7 100644 --- a/firmware/doom/lib/doomgeneric/src/net_io.h +++ b/firmware/doom/lib/doomgeneric/src/net_io.h @@ -26,7 +26,7 @@ net_context_t *NET_NewContext(void); void NET_AddModule(net_context_t *context, net_module_t *module); void NET_SendPacket(net_addr_t *addr, net_packet_t *packet); void NET_SendBroadcast(net_context_t *context, net_packet_t *packet); -boolean NET_RecvPacket(net_context_t *context, net_addr_t **addr, +boolean32 NET_RecvPacket(net_context_t *context, net_addr_t **addr, net_packet_t **packet); char *NET_AddrToString(net_addr_t *addr); void NET_FreeAddress(net_addr_t *addr); diff --git a/firmware/doom/lib/doomgeneric/src/net_packet.h b/firmware/doom/lib/doomgeneric/src/net_packet.h index ced4e435..752fb7d7 100644 --- a/firmware/doom/lib/doomgeneric/src/net_packet.h +++ b/firmware/doom/lib/doomgeneric/src/net_packet.h @@ -24,13 +24,13 @@ net_packet_t *NET_NewPacket(int initial_size); net_packet_t *NET_PacketDup(net_packet_t *packet); void NET_FreePacket(net_packet_t *packet); -boolean NET_ReadInt8(net_packet_t *packet, unsigned int *data); -boolean NET_ReadInt16(net_packet_t *packet, unsigned int *data); -boolean NET_ReadInt32(net_packet_t *packet, unsigned int *data); +boolean32 NET_ReadInt8(net_packet_t *packet, unsigned int *data); +boolean32 NET_ReadInt16(net_packet_t *packet, unsigned int *data); +boolean32 NET_ReadInt32(net_packet_t *packet, unsigned int *data); -boolean NET_ReadSInt8(net_packet_t *packet, signed int *data); -boolean NET_ReadSInt16(net_packet_t *packet, signed int *data); -boolean NET_ReadSInt32(net_packet_t *packet, signed int *data); +boolean32 NET_ReadSInt8(net_packet_t *packet, signed int *data); +boolean32 NET_ReadSInt16(net_packet_t *packet, signed int *data); +boolean32 NET_ReadSInt32(net_packet_t *packet, signed int *data); char *NET_ReadString(net_packet_t *packet); diff --git a/firmware/doom/lib/doomgeneric/src/net_query.h b/firmware/doom/lib/doomgeneric/src/net_query.h index 563a055b..17efb3a7 100644 --- a/firmware/doom/lib/doomgeneric/src/net_query.h +++ b/firmware/doom/lib/doomgeneric/src/net_query.h @@ -37,7 +37,7 @@ extern int NET_Query_Poll(net_query_callback_t callback, void *user_data); extern net_addr_t *NET_Query_ResolveMaster(net_context_t *context); extern void NET_Query_AddToMaster(net_addr_t *master_addr); -extern boolean NET_Query_CheckAddedToMaster(boolean *result); +extern boolean32 NET_Query_CheckAddedToMaster(boolean32 *result); extern void NET_Query_MasterResponse(net_packet_t *packet); #endif /* #ifndef NET_QUERY_H */ diff --git a/firmware/doom/lib/doomgeneric/src/p_enemy.c b/firmware/doom/lib/doomgeneric/src/p_enemy.c index f2b44d13..03c9b110 100644 --- a/firmware/doom/lib/doomgeneric/src/p_enemy.c +++ b/firmware/doom/lib/doomgeneric/src/p_enemy.c @@ -164,7 +164,7 @@ P_NoiseAlert // // P_CheckMeleeRange // -boolean P_CheckMeleeRange (mobj_t* actor) +boolean32 P_CheckMeleeRange (mobj_t* actor) { mobj_t* pl; fixed_t dist; @@ -187,7 +187,7 @@ boolean P_CheckMeleeRange (mobj_t* actor) // // P_CheckMissileRange // -boolean P_CheckMissileRange (mobj_t* actor) +boolean32 P_CheckMissileRange (mobj_t* actor) { fixed_t dist; @@ -257,7 +257,7 @@ boolean P_CheckMissileRange (mobj_t* actor) fixed_t xspeed[8] = {FRACUNIT,47000,0,-47000,-FRACUNIT,-47000,0,47000}; fixed_t yspeed[8] = {0,47000,FRACUNIT,47000,0,-47000,-FRACUNIT,-47000}; -boolean P_Move (mobj_t* actor) +boolean32 P_Move (mobj_t* actor) { fixed_t tryx; fixed_t tryy; @@ -266,8 +266,8 @@ boolean P_Move (mobj_t* actor) // warning: 'catch', 'throw', and 'try' // are all C++ reserved words - boolean try_ok; - boolean good; + boolean32 try_ok; + boolean32 good; if (actor->movedir == DI_NODIR) return false; @@ -334,7 +334,7 @@ boolean P_Move (mobj_t* actor) // If a door is in the way, // an OpenDoor call is made to start it opening. // -boolean P_TryWalk (mobj_t* actor) +boolean32 P_TryWalk (mobj_t* actor) { if (!P_Move (actor)) { @@ -483,10 +483,10 @@ void P_NewChaseDir (mobj_t* actor) // If allaround is false, only look 180 degrees in front. // Returns true if a player is targeted. // -boolean +boolean32 P_LookForPlayers ( mobj_t* actor, - boolean allaround ) + boolean32 allaround ) { int c; int stop; @@ -1111,10 +1111,10 @@ mobj_t* vileobj; fixed_t viletryx; fixed_t viletryy; -boolean PIT_VileCheck (mobj_t* thing) +boolean32 PIT_VileCheck (mobj_t* thing) { int maxdist; - boolean check; + boolean32 check; if (!(thing->flags & MF_CORPSE) ) return true; // not a monster @@ -1602,7 +1602,7 @@ void A_Explode (mobj_t* thingy) // This behavior changed in v1.9, the most notable effect of which // was to break uac_dead.wad -static boolean CheckBossEnd(mobjtype_t motype) +static boolean32 CheckBossEnd(mobjtype_t motype) { if (gameversion < exe_ultimate) { diff --git a/firmware/doom/lib/doomgeneric/src/p_floor.c b/firmware/doom/lib/doomgeneric/src/p_floor.c index 1384ee6b..92e1360e 100644 --- a/firmware/doom/lib/doomgeneric/src/p_floor.c +++ b/firmware/doom/lib/doomgeneric/src/p_floor.c @@ -43,11 +43,11 @@ T_MovePlane ( sector_t* sector, fixed_t speed, fixed_t dest, - boolean crush, + boolean32 crush, int floorOrCeiling, int direction ) { - boolean flag; + boolean32 flag; fixed_t lastpos; switch(floorOrCeiling) diff --git a/firmware/doom/lib/doomgeneric/src/p_inter.c b/firmware/doom/lib/doomgeneric/src/p_inter.c index 1eb58cfc..f15b330f 100644 --- a/firmware/doom/lib/doomgeneric/src/p_inter.c +++ b/firmware/doom/lib/doomgeneric/src/p_inter.c @@ -62,7 +62,7 @@ int clipammo[NUMAMMO] = {10, 4, 20, 1}; // Returns false if the ammo can't be picked up at all // -boolean +boolean32 P_GiveAmmo ( player_t* player, ammotype_t ammo, @@ -156,14 +156,14 @@ P_GiveAmmo // P_GiveWeapon // The weapon name may have a MF_DROPPED flag ored in. // -boolean +boolean32 P_GiveWeapon ( player_t* player, weapontype_t weapon, - boolean dropped ) + boolean32 dropped ) { - boolean gaveammo; - boolean gaveweapon; + boolean32 gaveammo; + boolean32 gaveweapon; if (netgame && (deathmatch!=2) && !dropped ) { @@ -219,7 +219,7 @@ P_GiveWeapon // P_GiveBody // Returns false if the body isn't needed at all // -boolean +boolean32 P_GiveBody ( player_t* player, int num ) @@ -242,7 +242,7 @@ P_GiveBody // Returns false if the armor is worse // than the current armor. // -boolean +boolean32 P_GiveArmor ( player_t* player, int armortype ) @@ -280,7 +280,7 @@ P_GiveCard // // P_GivePower // -boolean +boolean32 P_GivePower ( player_t* player, int /*powertype_t*/ power ) diff --git a/firmware/doom/lib/doomgeneric/src/p_inter.h b/firmware/doom/lib/doomgeneric/src/p_inter.h index 5764d5da..c03d3df1 100644 --- a/firmware/doom/lib/doomgeneric/src/p_inter.h +++ b/firmware/doom/lib/doomgeneric/src/p_inter.h @@ -23,7 +23,7 @@ -boolean P_GivePower(player_t*, int); +boolean32 P_GivePower(player_t*, int); diff --git a/firmware/doom/lib/doomgeneric/src/p_local.h b/firmware/doom/lib/doomgeneric/src/p_local.h index 95fa4053..a350836f 100644 --- a/firmware/doom/lib/doomgeneric/src/p_local.h +++ b/firmware/doom/lib/doomgeneric/src/p_local.h @@ -112,7 +112,7 @@ P_SpawnMobj void P_RemoveMobj (mobj_t* th); mobj_t* P_SubstNullMobj (mobj_t* th); -boolean P_SetMobjState (mobj_t* mobj, statenum_t state); +boolean32 P_SetMobjState (mobj_t* mobj, statenum_t state); void P_MobjThinker (mobj_t* mobj); void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z); @@ -142,7 +142,7 @@ typedef struct typedef struct { fixed_t frac; // along trace line - boolean isaline; + boolean32 isaline; union { mobj_t* thing; line_t* line; @@ -157,7 +157,7 @@ typedef struct extern intercept_t intercepts[MAXINTERCEPTS]; extern intercept_t* intercept_p; -typedef boolean (*traverser_t) (intercept_t *in); +typedef boolean32 (*traverser_t) (intercept_t *in); fixed_t P_AproxDistance (fixed_t dx, fixed_t dy); int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line); @@ -173,8 +173,8 @@ extern fixed_t lowfloor; void P_LineOpening (line_t* linedef); -boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) ); -boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) ); +boolean32 P_BlockLinesIterator (int x, int y, boolean32(*func)(line_t*) ); +boolean32 P_BlockThingsIterator (int x, int y, boolean32(*func)(mobj_t*) ); #define PT_ADDLINES 1 #define PT_ADDTHINGS 2 @@ -182,14 +182,14 @@ boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) ); extern divline_t trace; -boolean +boolean32 P_PathTraverse ( fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags, - boolean (*trav) (intercept_t *)); + boolean32 (*trav) (intercept_t *)); void P_UnsetThingPosition (mobj_t* thing); void P_SetThingPosition (mobj_t* thing); @@ -201,7 +201,7 @@ void P_SetThingPosition (mobj_t* thing); // If "floatok" true, move would be ok // if within "tmfloorz - tmceilingz". -extern boolean floatok; +extern boolean32 floatok; extern fixed_t tmfloorz; extern fixed_t tmceilingz; @@ -222,14 +222,14 @@ extern line_t* ceilingline; extern line_t* spechit[MAXSPECIALCROSS]; extern int numspechit; -boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y); -boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y); -boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y); +boolean32 P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y); +boolean32 P_TryMove (mobj_t* thing, fixed_t x, fixed_t y); +boolean32 P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y); void P_SlideMove (mobj_t* mo); -boolean P_CheckSight (mobj_t* t1, mobj_t* t2); +boolean32 P_CheckSight (mobj_t* t1, mobj_t* t2); void P_UseLines (player_t* player); -boolean P_ChangeSector (sector_t* sector, boolean crunch); +boolean32 P_ChangeSector (sector_t* sector, boolean32 crunch); extern mobj_t* linetarget; // who got hit (or NULL) diff --git a/firmware/doom/lib/doomgeneric/src/p_map.c b/firmware/doom/lib/doomgeneric/src/p_map.c index e371869a..1bd7da3e 100644 --- a/firmware/doom/lib/doomgeneric/src/p_map.c +++ b/firmware/doom/lib/doomgeneric/src/p_map.c @@ -69,7 +69,7 @@ fixed_t tmy; // If "floatok" true, move would be ok // if within "tmfloorz - tmceilingz". -boolean floatok; +boolean32 floatok; fixed_t tmfloorz; fixed_t tmceilingz; @@ -94,7 +94,7 @@ int numspechit; // // PIT_StompThing // -boolean PIT_StompThing (mobj_t* thing) +boolean32 PIT_StompThing (mobj_t* thing) { fixed_t blockdist; @@ -127,7 +127,7 @@ boolean PIT_StompThing (mobj_t* thing) // // P_TeleportMove // -boolean +boolean32 P_TeleportMove ( mobj_t* thing, fixed_t x, @@ -203,7 +203,7 @@ static void SpechitOverrun(line_t *ld); // PIT_CheckLine // Adjusts tmfloorz and tmceilingz as lines are contacted // -boolean PIT_CheckLine (line_t* ld) +boolean32 PIT_CheckLine (line_t* ld) { if (tmbbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || tmbbox[BOXLEFT] >= ld->bbox[BOXRIGHT] @@ -272,10 +272,10 @@ boolean PIT_CheckLine (line_t* ld) // // PIT_CheckThing // -boolean PIT_CheckThing (mobj_t* thing) +boolean32 PIT_CheckThing (mobj_t* thing) { fixed_t blockdist; - boolean solid; + boolean32 solid; int damage; if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_SHOOTABLE) )) @@ -398,7 +398,7 @@ boolean PIT_CheckThing (mobj_t* thing) // speciallines[] // numspeciallines // -boolean +boolean32 P_CheckPosition ( mobj_t* thing, fixed_t x, @@ -474,7 +474,7 @@ P_CheckPosition // Attempt to move to a new position, // crossing special lines unless MF_TELEPORT is set. // -boolean +boolean32 P_TryMove ( mobj_t* thing, fixed_t x, @@ -554,9 +554,9 @@ P_TryMove // the z will be set to the lowest value // and false will be returned. // -boolean P_ThingHeightClip (mobj_t* thing) +boolean32 P_ThingHeightClip (mobj_t* thing) { - boolean onfloor; + boolean32 onfloor; onfloor = (thing->z == thing->floorz); @@ -660,7 +660,7 @@ void P_HitSlideLine (line_t* ld) // // PTR_SlideTraverse // -boolean PTR_SlideTraverse (intercept_t* in) +boolean32 PTR_SlideTraverse (intercept_t* in) { line_t* li; @@ -839,7 +839,7 @@ extern fixed_t bottomslope; // PTR_AimTraverse // Sets linetaget and aimslope when a target is aimed at. // -boolean +boolean32 PTR_AimTraverse (intercept_t* in) { line_t* li; @@ -925,7 +925,7 @@ PTR_AimTraverse (intercept_t* in) // // PTR_ShootTraverse // -boolean PTR_ShootTraverse (intercept_t* in) +boolean32 PTR_ShootTraverse (intercept_t* in) { fixed_t x; fixed_t y; @@ -1139,7 +1139,7 @@ P_LineAttack // mobj_t* usething; -boolean PTR_UseTraverse (intercept_t* in) +boolean32 PTR_UseTraverse (intercept_t* in) { int side; @@ -1208,7 +1208,7 @@ int bombdamage; // "bombsource" is the creature // that caused the explosion at "bombspot". // -boolean PIT_RadiusAttack (mobj_t* thing) +boolean32 PIT_RadiusAttack (mobj_t* thing) { fixed_t dx; fixed_t dy; @@ -1294,14 +1294,14 @@ P_RadiusAttack // the way it was and call P_ChangeSector again // to undo the changes. // -boolean crushchange; -boolean nofit; +boolean32 crushchange; +boolean32 nofit; // // PIT_ChangeSector // -boolean PIT_ChangeSector (mobj_t* thing) +boolean32 PIT_ChangeSector (mobj_t* thing) { mobj_t* mo; @@ -1364,10 +1364,10 @@ boolean PIT_ChangeSector (mobj_t* thing) // // P_ChangeSector // -boolean +boolean32 P_ChangeSector ( sector_t* sector, - boolean crunch ) + boolean32 crunch ) { int x; int y; diff --git a/firmware/doom/lib/doomgeneric/src/p_maputl.c b/firmware/doom/lib/doomgeneric/src/p_maputl.c index 916f2b64..192d7942 100644 --- a/firmware/doom/lib/doomgeneric/src/p_maputl.c +++ b/firmware/doom/lib/doomgeneric/src/p_maputl.c @@ -463,11 +463,11 @@ P_SetThingPosition (mobj_t* thing) // to P_BlockLinesIterator, then make one or more calls // to it. // -boolean +boolean32 P_BlockLinesIterator ( int x, int y, - boolean(*func)(line_t*) ) + boolean32(*func)(line_t*) ) { int offset; short* list; @@ -504,11 +504,11 @@ P_BlockLinesIterator // // P_BlockThingsIterator // -boolean +boolean32 P_BlockThingsIterator ( int x, int y, - boolean(*func)(mobj_t*) ) + boolean32(*func)(mobj_t*) ) { mobj_t* mobj; @@ -540,7 +540,7 @@ intercept_t intercepts[MAXINTERCEPTS]; intercept_t* intercept_p; divline_t trace; -boolean earlyout; +boolean32 earlyout; int ptflags; static void InterceptsOverrun(int num_intercepts, intercept_t *intercept); @@ -555,7 +555,7 @@ static void InterceptsOverrun(int num_intercepts, intercept_t *intercept); // are on opposite sides of the trace. // Returns true if earlyout and a solid line hit. // -boolean +boolean32 PIT_AddLineIntercepts (line_t* ld) { int s1; @@ -611,7 +611,7 @@ PIT_AddLineIntercepts (line_t* ld) // // PIT_AddThingIntercepts // -boolean PIT_AddThingIntercepts (mobj_t* thing) +boolean32 PIT_AddThingIntercepts (mobj_t* thing) { fixed_t x1; fixed_t y1; @@ -621,7 +621,7 @@ boolean PIT_AddThingIntercepts (mobj_t* thing) int s1; int s2; - boolean tracepositive; + boolean32 tracepositive; divline_t dl; @@ -678,7 +678,7 @@ boolean PIT_AddThingIntercepts (mobj_t* thing) // Returns true if the traverser function returns true // for all lines. // -boolean +boolean32 P_TraverseIntercepts ( traverser_t func, fixed_t maxfrac ) @@ -739,7 +739,7 @@ typedef struct { int len; void *addr; - boolean int16_array; + boolean32 int16_array; } intercepts_overrun_t; // Intercepts memory table. This is where various variables are located @@ -857,14 +857,14 @@ static void InterceptsOverrun(int num_intercepts, intercept_t *intercept) // Returns true if the traverser function returns true // for all lines. // -boolean +boolean32 P_PathTraverse ( fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags, - boolean (*trav) (intercept_t *)) + boolean32 (*trav) (intercept_t *)) { fixed_t xt1; fixed_t yt1; diff --git a/firmware/doom/lib/doomgeneric/src/p_mobj.c b/firmware/doom/lib/doomgeneric/src/p_mobj.c index a3b9c432..e0d7d04c 100644 --- a/firmware/doom/lib/doomgeneric/src/p_mobj.c +++ b/firmware/doom/lib/doomgeneric/src/p_mobj.c @@ -44,7 +44,7 @@ void P_SpawnMapThing (mapthing_t* mthing); // int test; -boolean +boolean32 P_SetMobjState ( mobj_t* mobj, statenum_t state ) diff --git a/firmware/doom/lib/doomgeneric/src/p_pspr.c b/firmware/doom/lib/doomgeneric/src/p_pspr.c index e4774c70..57a1d1fd 100644 --- a/firmware/doom/lib/doomgeneric/src/p_pspr.c +++ b/firmware/doom/lib/doomgeneric/src/p_pspr.c @@ -50,22 +50,22 @@ void P_SetPsprite ( player_t* player, int position, - statenum_t stnum ) + statenum_t stnum ) { pspdef_t* psp; state_t* state; - + psp = &player->psprites[position]; - + do { if (!stnum) { // object removed itself psp->state = NULL; - break; + break; } - + state = &states[stnum]; psp->state = state; psp->tics = state->tics; // could be 0 @@ -76,7 +76,7 @@ P_SetPsprite psp->sx = state->misc1 << FRACBITS; psp->sy = state->misc2 << FRACBITS; } - + // Call action routine. // Modified handling. if (state->action.acp2) @@ -85,9 +85,9 @@ P_SetPsprite if (!psp->state) break; } - + stnum = psp->state->nextstate; - + } while (!psp->tics); // an initial state of 0 could cycle through } @@ -96,7 +96,7 @@ P_SetPsprite // // P_CalcSwing -// +// fixed_t swingx; fixed_t swingy; @@ -104,7 +104,7 @@ void P_CalcSwing (player_t* player) { fixed_t swing; int angle; - + // OPTIMIZE: tablify this. // A LUT would allow for different modes, // and add flexibility. @@ -129,13 +129,13 @@ void P_CalcSwing (player_t* player) void P_BringUpWeapon (player_t* player) { statenum_t newstate; - + if (player->pendingweapon == wp_nochange) player->pendingweapon = player->readyweapon; - + if (player->pendingweapon == wp_chainsaw) S_StartSound (player->mo, sfx_sawup); - + newstate = weaponinfo[player->pendingweapon].upstate; player->pendingweapon = wp_nochange; @@ -149,7 +149,7 @@ void P_BringUpWeapon (player_t* player) // Returns true if there is enough ammo to shoot. // If not, selects the next weapon to use. // -boolean P_CheckAmmo (player_t* player) +boolean32 P_CheckAmmo (player_t* player) { ammotype_t ammo; int count; @@ -168,7 +168,7 @@ boolean P_CheckAmmo (player_t* player) // Return if current ammunition sufficient. if (ammo == am_noammo || player->ammo[ammo] >= count) return true; - + // Out of ammo, pick a weapon to change to. // Preferences are set here. do @@ -179,7 +179,7 @@ boolean P_CheckAmmo (player_t* player) { player->pendingweapon = wp_plasma; } - else if (player->weaponowned[wp_supershotgun] + else if (player->weaponowned[wp_supershotgun] && player->ammo[am_shell]>2 && (gamemode == commercial) ) { @@ -219,7 +219,7 @@ boolean P_CheckAmmo (player_t* player) // If everything fails. player->pendingweapon = wp_fist; } - + } while (player->pendingweapon == wp_nochange); // Now set appropriate weapon overlay. @@ -227,7 +227,7 @@ boolean P_CheckAmmo (player_t* player) ps_weapon, weaponinfo[player->readyweapon].downstate); - return false; + return false; } @@ -237,10 +237,10 @@ boolean P_CheckAmmo (player_t* player) void P_FireWeapon (player_t* player) { statenum_t newstate; - + if (!P_CheckAmmo (player)) return; - + P_SetMobjState (player->mo, S_PLAY_ATK1); newstate = weaponinfo[player->readyweapon].atkstate; P_SetPsprite (player, ps_weapon, newstate); @@ -273,23 +273,23 @@ void A_WeaponReady ( player_t* player, pspdef_t* psp ) -{ +{ statenum_t newstate; int angle; - + // get out of attack state if (player->mo->state == &states[S_PLAY_ATK1] || player->mo->state == &states[S_PLAY_ATK2] ) { P_SetMobjState (player->mo, S_PLAY); } - + if (player->readyweapon == wp_chainsaw && psp->state == &states[S_SAW]) { S_StartSound (player->mo, sfx_sawidl); } - + // check for change // if player is dead, put the weapon away if (player->pendingweapon != wp_nochange || !player->health) @@ -298,9 +298,9 @@ A_WeaponReady // (pending weapon should allready be validated) newstate = weaponinfo[player->readyweapon].downstate; P_SetPsprite (player, ps_weapon, newstate); - return; + return; } - + // check for fire // the missile launcher and bfg do not auto fire if (player->cmd.buttons & BT_ATTACK) @@ -310,13 +310,13 @@ A_WeaponReady && player->readyweapon != wp_bfg) ) { player->attackdown = true; - P_FireWeapon (player); + P_FireWeapon (player); return; } } else player->attackdown = false; - + // bob the weapon based on movement speed angle = (128*leveltime)&FINEMASK; psp->sx = FRACUNIT + FixedMul (player->bob, finecosine[angle]); @@ -335,10 +335,10 @@ void A_ReFire ( player_t* player, pspdef_t* psp ) { - + // check for fire // (if a weaponchange is pending, let it go through instead) - if ( (player->cmd.buttons & BT_ATTACK) + if ( (player->cmd.buttons & BT_ATTACK) && player->pendingweapon == wp_nochange && player->health) { @@ -376,7 +376,7 @@ void A_Lower ( player_t* player, pspdef_t* psp ) -{ +{ psp->sy += LOWERSPEED; // Is already down. @@ -389,19 +389,19 @@ A_Lower psp->sy = WEAPONBOTTOM; // don't bring weapon back up - return; + return; } - + // The old weapon has been lowered off the screen, // so change the weapon and start raising it if (!player->health) { // Player is dead, so keep the weapon off screen. P_SetPsprite (player, ps_weapon, S_NULL); - return; + return; } - - player->readyweapon = player->pendingweapon; + + player->readyweapon = player->pendingweapon; P_BringUpWeapon (player); } @@ -416,14 +416,14 @@ A_Raise pspdef_t* psp ) { statenum_t newstate; - + psp->sy -= RAISESPEED; if (psp->sy > WEAPONTOP ) return; - + psp->sy = WEAPONTOP; - + // The weapon has been raised all the way, // so change to the ready state. newstate = weaponinfo[player->readyweapon].readystate; @@ -439,7 +439,7 @@ A_Raise void A_GunFlash ( player_t* player, - pspdef_t* psp ) + pspdef_t* psp ) { P_SetMobjState (player->mo, S_PLAY_ATK2); P_SetPsprite (player,ps_flash,weaponinfo[player->readyweapon].flashstate); @@ -458,15 +458,15 @@ A_GunFlash void A_Punch ( player_t* player, - pspdef_t* psp ) + pspdef_t* psp ) { angle_t angle; int damage; int slope; - + damage = (P_Random ()%10+1)<<1; - if (player->powers[pw_strength]) + if (player->powers[pw_strength]) damage *= 10; angle = player->mo->angle; @@ -492,7 +492,7 @@ A_Punch void A_Saw ( player_t* player, - pspdef_t* psp ) + pspdef_t* psp ) { angle_t angle; int damage; @@ -501,7 +501,7 @@ A_Saw damage = 2*(P_Random ()%10+1); angle = player->mo->angle; angle += (P_Random()-P_Random())<<18; - + // use meleerange + 1 se the puff doesn't skip the flash slope = P_AimLineAttack (player->mo, angle, MELEERANGE+1); P_LineAttack (player->mo, angle, MELEERANGE+1, slope, damage); @@ -512,7 +512,7 @@ A_Saw return; } S_StartSound (player->mo, sfx_sawhit); - + // turn to face target angle = R_PointToAngle2 (player->mo->x, player->mo->y, linetarget->x, linetarget->y); @@ -558,7 +558,7 @@ static void DecreaseAmmo(player_t *player, int ammonum, int amount) void A_FireMissile ( player_t* player, - pspdef_t* psp ) + pspdef_t* psp ) { DecreaseAmmo(player, weaponinfo[player->readyweapon].ammo, 1); P_SpawnPlayerMissile (player->mo, MT_ROCKET); @@ -571,9 +571,9 @@ A_FireMissile void A_FireBFG ( player_t* player, - pspdef_t* psp ) + pspdef_t* psp ) { - DecreaseAmmo(player, weaponinfo[player->readyweapon].ammo, + DecreaseAmmo(player, weaponinfo[player->readyweapon].ammo, deh_bfg_cells_per_shot); P_SpawnPlayerMissile (player->mo, MT_BFG); } @@ -586,7 +586,7 @@ A_FireBFG void A_FirePlasma ( player_t* player, - pspdef_t* psp ) + pspdef_t* psp ) { DecreaseAmmo(player, weaponinfo[player->readyweapon].ammo, 1); @@ -610,7 +610,7 @@ fixed_t bulletslope; void P_BulletSlope (mobj_t* mo) { angle_t an; - + // see which target is to be aimed at an = mo->angle; bulletslope = P_AimLineAttack (mo, an, 16*64*FRACUNIT); @@ -634,11 +634,11 @@ void P_BulletSlope (mobj_t* mo) void P_GunShot ( mobj_t* mo, - boolean accurate ) + boolean32 accurate ) { angle_t angle; int damage; - + damage = 5*(P_Random ()%3+1); angle = mo->angle; @@ -655,7 +655,7 @@ P_GunShot void A_FirePistol ( player_t* player, - pspdef_t* psp ) + pspdef_t* psp ) { S_StartSound (player->mo, sfx_pistol); @@ -677,10 +677,10 @@ A_FirePistol void A_FireShotgun ( player_t* player, - pspdef_t* psp ) + pspdef_t* psp ) { int i; - + S_StartSound (player->mo, sfx_shotgn); P_SetMobjState (player->mo, S_PLAY_ATK2); @@ -691,7 +691,7 @@ A_FireShotgun weaponinfo[player->readyweapon].flashstate); P_BulletSlope (player->mo); - + for (i=0 ; i<7 ; i++) P_GunShot (player->mo, false); } @@ -704,13 +704,13 @@ A_FireShotgun void A_FireShotgun2 ( player_t* player, - pspdef_t* psp ) + pspdef_t* psp ) { int i; angle_t angle; int damage; - - + + S_StartSound (player->mo, sfx_dshtgn); P_SetMobjState (player->mo, S_PLAY_ATK2); @@ -721,7 +721,7 @@ A_FireShotgun2 weaponinfo[player->readyweapon].flashstate); P_BulletSlope (player->mo); - + for (i=0 ; i<20 ; i++) { damage = 5*(P_Random ()%3+1); @@ -741,13 +741,13 @@ A_FireShotgun2 void A_FireCGun ( player_t* player, - pspdef_t* psp ) + pspdef_t* psp ) { S_StartSound (player->mo, sfx_pistol); if (!player->ammo[weaponinfo[player->readyweapon].ammo]) return; - + P_SetMobjState (player->mo, S_PLAY_ATK2); DecreaseAmmo(player, weaponinfo[player->readyweapon].ammo, 1); @@ -758,7 +758,7 @@ A_FireCGun - &states[S_CHAIN1] ); P_BulletSlope (player->mo); - + P_GunShot (player->mo, !player->refire); } @@ -787,13 +787,13 @@ void A_Light2 (player_t *player, pspdef_t *psp) // A_BFGSpray // Spawn a BFG explosion on every monster in view // -void A_BFGSpray (mobj_t* mo) +void A_BFGSpray (mobj_t* mo) { int i; int j; int damage; angle_t an; - + // offset angles from its attack angle for (i=0 ; i<40 ; i++) { @@ -810,7 +810,7 @@ void A_BFGSpray (mobj_t* mo) linetarget->y, linetarget->z + (linetarget->height>>2), MT_EXTRABFG); - + damage = 0; for (j=0;j<15;j++) damage += (P_Random()&7) + 1; @@ -837,14 +837,14 @@ A_BFGsound // P_SetupPsprites // Called at start of level for each player. // -void P_SetupPsprites (player_t* player) +void P_SetupPsprites (player_t* player) { int i; - + // remove all psprites for (i=0 ; ipsprites[i].state = NULL; - + // spawn the gun player->pendingweapon = player->readyweapon; P_BringUpWeapon (player); @@ -857,30 +857,30 @@ void P_SetupPsprites (player_t* player) // P_MovePsprites // Called every tic by player thinking routine. // -void P_MovePsprites (player_t* player) +void P_MovePsprites (player_t* player) { int i; pspdef_t* psp; state_t* state; - + psp = &player->psprites[0]; for (i=0 ; istate) ) + if ( (state = psp->state) ) { // drop tic count and possibly change state // a -1 tic count never changes - if (psp->tics != -1) + if (psp->tics != -1) { psp->tics--; if (!psp->tics) P_SetPsprite (player, i, psp->state->nextstate); - } + } } } - + player->psprites[ps_flash].sx = player->psprites[ps_weapon].sx; player->psprites[ps_flash].sy = player->psprites[ps_weapon].sy; } diff --git a/firmware/doom/lib/doomgeneric/src/p_saveg.c b/firmware/doom/lib/doomgeneric/src/p_saveg.c index 5cb81967..8d02b01f 100644 --- a/firmware/doom/lib/doomgeneric/src/p_saveg.c +++ b/firmware/doom/lib/doomgeneric/src/p_saveg.c @@ -38,7 +38,7 @@ FILE *save_stream; int savegamelength; -boolean savegame_error; +boolean32 savegame_error; // Get the filename of a temporary file to write the savegame to. After // the file has been successfully saved, it will be renamed to the @@ -678,13 +678,13 @@ static void saveg_read_player_t(player_t *str) str->powers[i] = saveg_read32(); } - // boolean cards[NUMCARDS]; + // boolean32 cards[NUMCARDS]; for (i=0; icards[i] = saveg_read32(); } - // boolean backpack; + // boolean32 backpack; str->backpack = saveg_read32(); // int frags[MAXPLAYERS]; @@ -699,7 +699,7 @@ static void saveg_read_player_t(player_t *str) // weapontype_t pendingweapon; str->pendingweapon = saveg_read_enum(); - // boolean weaponowned[NUMWEAPONS]; + // boolean32 weaponowned[NUMWEAPONS]; for (i=0; iweaponowned[i] = saveg_read32(); @@ -765,7 +765,7 @@ static void saveg_read_player_t(player_t *str) saveg_read_pspdef_t(&str->psprites[i]); } - // boolean didsecret; + // boolean32 didsecret; str->didsecret = saveg_read32(); } @@ -809,13 +809,13 @@ static void saveg_write_player_t(player_t *str) saveg_write32(str->powers[i]); } - // boolean cards[NUMCARDS]; + // boolean32 cards[NUMCARDS]; for (i=0; icards[i]); } - // boolean backpack; + // boolean32 backpack; saveg_write32(str->backpack); // int frags[MAXPLAYERS]; @@ -830,7 +830,7 @@ static void saveg_write_player_t(player_t *str) // weapontype_t pendingweapon; saveg_write_enum(str->pendingweapon); - // boolean weaponowned[NUMWEAPONS]; + // boolean32 weaponowned[NUMWEAPONS]; for (i=0; iweaponowned[i]); @@ -896,7 +896,7 @@ static void saveg_write_player_t(player_t *str) saveg_write_pspdef_t(&str->psprites[i]); } - // boolean didsecret; + // boolean32 didsecret; saveg_write32(str->didsecret); } @@ -928,7 +928,7 @@ static void saveg_read_ceiling_t(ceiling_t *str) // fixed_t speed; str->speed = saveg_read32(); - // boolean crush; + // boolean32 crush; str->crush = saveg_read32(); // int direction; @@ -961,7 +961,7 @@ static void saveg_write_ceiling_t(ceiling_t *str) // fixed_t speed; saveg_write32(str->speed); - // boolean crush; + // boolean32 crush; saveg_write32(str->crush); // int direction; @@ -1049,7 +1049,7 @@ static void saveg_read_floormove_t(floormove_t *str) // floor_e type; str->type = saveg_read_enum(); - // boolean crush; + // boolean32 crush; str->crush = saveg_read32(); // sector_t* sector; @@ -1080,7 +1080,7 @@ static void saveg_write_floormove_t(floormove_t *str) // floor_e type; saveg_write_enum(str->type); - // boolean crush; + // boolean32 crush; saveg_write32(str->crush); // sector_t* sector; @@ -1138,7 +1138,7 @@ static void saveg_read_plat_t(plat_t *str) // plat_e oldstatus; str->oldstatus = saveg_read_enum(); - // boolean crush; + // boolean32 crush; str->crush = saveg_read32(); // int tag; @@ -1177,7 +1177,7 @@ static void saveg_write_plat_t(plat_t *str) // plat_e oldstatus; saveg_write_enum(str->oldstatus); - // boolean crush; + // boolean32 crush; saveg_write32(str->crush); // int tag; @@ -1376,7 +1376,7 @@ void P_WriteSaveGameHeader(char *description) // Read the header for a savegame // -boolean P_ReadSaveGameHeader(void) +boolean32 P_ReadSaveGameHeader(void) { int i; byte a, b, c; @@ -1416,7 +1416,7 @@ boolean P_ReadSaveGameHeader(void) // Read the end of file marker. Returns true if read successfully. // -boolean P_ReadSaveGameEOF(void) +boolean32 P_ReadSaveGameEOF(void) { int value; diff --git a/firmware/doom/lib/doomgeneric/src/p_saveg.h b/firmware/doom/lib/doomgeneric/src/p_saveg.h index 2d7beba3..8a32a6cc 100644 --- a/firmware/doom/lib/doomgeneric/src/p_saveg.h +++ b/firmware/doom/lib/doomgeneric/src/p_saveg.h @@ -36,12 +36,12 @@ char *P_SaveGameFile(int slot); // Savegame file header read/write functions -boolean P_ReadSaveGameHeader(void); +boolean32 P_ReadSaveGameHeader(void); void P_WriteSaveGameHeader(char *description); // Savegame end-of-file read/write functions -boolean P_ReadSaveGameEOF(void); +boolean32 P_ReadSaveGameEOF(void); void P_WriteSaveGameEOF(void); // Persistent storage/archiving. @@ -56,7 +56,7 @@ void P_ArchiveSpecials (void); void P_UnArchiveSpecials (void); extern FILE *save_stream; -extern boolean savegame_error; +extern boolean32 savegame_error; #endif diff --git a/firmware/doom/lib/doomgeneric/src/p_setup.c b/firmware/doom/lib/doomgeneric/src/p_setup.c index 00306e84..f3a8f4c1 100644 --- a/firmware/doom/lib/doomgeneric/src/p_setup.c +++ b/firmware/doom/lib/doomgeneric/src/p_setup.c @@ -152,7 +152,7 @@ void P_LoadVertexes (int lump) // sector_t* GetSectorAtNullAddress(void) { - static boolean null_sector_is_initialized = false; + static boolean32 null_sector_is_initialized = false; static sector_t null_sector; if (!null_sector_is_initialized) @@ -339,7 +339,7 @@ void P_LoadThings (int lump) mapthing_t *mt; mapthing_t spawnthing; int numthings; - boolean spawn; + boolean32 spawn; data = W_CacheLumpNum (lump,PU_STATIC); numthings = W_LumpLength (lump) / sizeof(mapthing_t); diff --git a/firmware/doom/lib/doomgeneric/src/p_sight.c b/firmware/doom/lib/doomgeneric/src/p_sight.c index 48ba6838..9875874c 100644 --- a/firmware/doom/lib/doomgeneric/src/p_sight.c +++ b/firmware/doom/lib/doomgeneric/src/p_sight.c @@ -125,7 +125,7 @@ P_InterceptVector2 // Returns true // if strace crosses the given subsector successfully. // -boolean P_CrossSubsector (int num) +boolean32 P_CrossSubsector (int num) { seg_t* seg; line_t* line; @@ -255,7 +255,7 @@ boolean P_CrossSubsector (int num) // Returns true // if strace crosses the given node successfully. // -boolean P_CrossBSPNode (int bspnum) +boolean32 P_CrossBSPNode (int bspnum) { node_t* bsp; int side; @@ -297,7 +297,7 @@ boolean P_CrossBSPNode (int bspnum) // if a straight line between t1 and t2 is unobstructed. // Uses REJECT. // -boolean +boolean32 P_CheckSight ( mobj_t* t1, mobj_t* t2 ) diff --git a/firmware/doom/lib/doomgeneric/src/p_spec.c b/firmware/doom/lib/doomgeneric/src/p_spec.c index 17446b5d..9c7ef694 100644 --- a/firmware/doom/lib/doomgeneric/src/p_spec.c +++ b/firmware/doom/lib/doomgeneric/src/p_spec.c @@ -54,7 +54,7 @@ // typedef struct { - boolean istexture; + boolean32 istexture; int picnum; int basepic; int numpics; @@ -1087,7 +1087,7 @@ void P_PlayerInSpecialSector (player_t* player) // P_UpdateSpecials // Animate planes, scroll walls, etc. // -boolean levelTimer; +boolean32 levelTimer; int levelTimeCount; void P_UpdateSpecials (void) diff --git a/firmware/doom/lib/doomgeneric/src/p_spec.h b/firmware/doom/lib/doomgeneric/src/p_spec.h index a1343bfa..aca36c19 100644 --- a/firmware/doom/lib/doomgeneric/src/p_spec.h +++ b/firmware/doom/lib/doomgeneric/src/p_spec.h @@ -27,7 +27,7 @@ // // End-level timer (-TIMER option) // -extern boolean levelTimer; +extern boolean32 levelTimer; extern int levelTimeCount; @@ -45,7 +45,7 @@ void P_SpawnSpecials (void); void P_UpdateSpecials (void); // when needed -boolean +boolean32 P_UseSpecialLine ( mobj_t* thing, line_t* line, @@ -290,7 +290,7 @@ typedef struct int count; plat_e status; plat_e oldstatus; - boolean crush; + boolean32 crush; int tag; plattype_e type; @@ -495,7 +495,7 @@ typedef struct fixed_t bottomheight; fixed_t topheight; fixed_t speed; - boolean crush; + boolean32 crush; // 1 = up, 0 = waiting, -1 = down int direction; @@ -582,7 +582,7 @@ typedef struct { thinker_t thinker; floor_e type; - boolean crush; + boolean32 crush; sector_t* sector; int direction; int newspecial; @@ -609,7 +609,7 @@ T_MovePlane ( sector_t* sector, fixed_t speed, fixed_t dest, - boolean crush, + boolean32 crush, int floorOrCeiling, int direction ); diff --git a/firmware/doom/lib/doomgeneric/src/p_switch.c b/firmware/doom/lib/doomgeneric/src/p_switch.c index ed4feeca..169bee98 100644 --- a/firmware/doom/lib/doomgeneric/src/p_switch.c +++ b/firmware/doom/lib/doomgeneric/src/p_switch.c @@ -266,7 +266,7 @@ P_ChangeSwitchTexture // Called when a thing uses a special line. // Only the front sides of lines are usable. // -boolean +boolean32 P_UseSpecialLine ( mobj_t* thing, line_t* line, diff --git a/firmware/doom/lib/doomgeneric/src/p_user.c b/firmware/doom/lib/doomgeneric/src/p_user.c index 73c0dc94..faef71d1 100644 --- a/firmware/doom/lib/doomgeneric/src/p_user.c +++ b/firmware/doom/lib/doomgeneric/src/p_user.c @@ -41,7 +41,7 @@ // 16 pixels of bob #define MAXBOB 0x100000 -boolean onground; +boolean32 onground; // diff --git a/firmware/doom/lib/doomgeneric/src/r_bsp.c b/firmware/doom/lib/doomgeneric/src/r_bsp.c index f23f7949..4d0f34d6 100644 --- a/firmware/doom/lib/doomgeneric/src/r_bsp.c +++ b/firmware/doom/lib/doomgeneric/src/r_bsp.c @@ -388,7 +388,7 @@ int checkcoord[12][4] = }; -boolean R_CheckBBox (fixed_t* bspcoord) +boolean32 R_CheckBBox (fixed_t* bspcoord) { int boxx; int boxy; diff --git a/firmware/doom/lib/doomgeneric/src/r_bsp.h b/firmware/doom/lib/doomgeneric/src/r_bsp.h index 6e193f37..23f252a4 100644 --- a/firmware/doom/lib/doomgeneric/src/r_bsp.h +++ b/firmware/doom/lib/doomgeneric/src/r_bsp.h @@ -31,13 +31,13 @@ extern sector_t* backsector; extern int rw_x; extern int rw_stopx; -extern boolean segtextured; +extern boolean32 segtextured; // false if the back side is the same plane -extern boolean markfloor; -extern boolean markceiling; +extern boolean32 markfloor; +extern boolean32 markceiling; -extern boolean skymap; +extern boolean32 skymap; extern drawseg_t* drawsegs; extern drawseg_t* ds_p; diff --git a/firmware/doom/lib/doomgeneric/src/r_defs.h b/firmware/doom/lib/doomgeneric/src/r_defs.h index a64ac842..297ddac9 100644 --- a/firmware/doom/lib/doomgeneric/src/r_defs.h +++ b/firmware/doom/lib/doomgeneric/src/r_defs.h @@ -392,7 +392,7 @@ typedef struct // If false use 0 for any position. // Note: as eight entries are available, // we might as well insert the same name eight times. - boolean rotate; + boolean32 rotate; // Lump to use for view angles 0-7. short lump[8]; diff --git a/firmware/doom/lib/doomgeneric/src/r_main.c b/firmware/doom/lib/doomgeneric/src/r_main.c index 4f930a1d..f410ecf9 100644 --- a/firmware/doom/lib/doomgeneric/src/r_main.c +++ b/firmware/doom/lib/doomgeneric/src/r_main.c @@ -671,7 +671,7 @@ void R_InitLightTables (void) // because it might be in the middle of a refresh. // The change will take effect next refresh. // -boolean setsizeneeded; +boolean32 setsizeneeded; int setblocks; int setdetail; diff --git a/firmware/doom/lib/doomgeneric/src/r_segs.c b/firmware/doom/lib/doomgeneric/src/r_segs.c index 9b4e413c..935a4776 100644 --- a/firmware/doom/lib/doomgeneric/src/r_segs.c +++ b/firmware/doom/lib/doomgeneric/src/r_segs.c @@ -36,13 +36,13 @@ // OPTIMIZE: closed two sided lines as single sided // True if any of the segs textures might be visible. -boolean segtextured; +boolean32 segtextured; // False if the back side is the same plane. -boolean markfloor; -boolean markceiling; +boolean32 markfloor; +boolean32 markceiling; -boolean maskedtexture; +boolean32 maskedtexture; int toptexture; int bottomtexture; int midtexture; diff --git a/firmware/doom/lib/doomgeneric/src/r_things.c b/firmware/doom/lib/doomgeneric/src/r_things.c index 2dcfbd03..75900fa2 100644 --- a/firmware/doom/lib/doomgeneric/src/r_things.c +++ b/firmware/doom/lib/doomgeneric/src/r_things.c @@ -117,7 +117,7 @@ R_InstallSpriteLump ( int lump, unsigned frame, unsigned rotation, - boolean flipped ) + boolean32 flipped ) { int r; @@ -478,7 +478,7 @@ void R_ProjectSprite (mobj_t* thing) int lump; unsigned rot; - boolean flip; + boolean32 flip; int index; @@ -530,13 +530,13 @@ void R_ProjectSprite (mobj_t* thing) ang = R_PointToAngle (thing->x, thing->y); rot = (ang-thing->angle+(unsigned)(ANG45/2)*9)>>29; lump = sprframe->lump[rot]; - flip = (boolean)sprframe->flip[rot]; + flip = (boolean32)sprframe->flip[rot]; } else { // use single rotation for all views lump = sprframe->lump[0]; - flip = (boolean)sprframe->flip[0]; + flip = (boolean32)sprframe->flip[0]; } // calculate edges of the shape @@ -659,7 +659,7 @@ void R_DrawPSprite (pspdef_t* psp) spritedef_t* sprdef; spriteframe_t* sprframe; int lump; - boolean flip; + boolean32 flip; vissprite_t* vis; vissprite_t avis; @@ -678,7 +678,7 @@ void R_DrawPSprite (pspdef_t* psp) sprframe = &sprdef->spriteframes[ psp->state->frame & FF_FRAMEMASK ]; lump = sprframe->lump[0]; - flip = (boolean)sprframe->flip[0]; + flip = (boolean32)sprframe->flip[0]; // calculate edges of the shape tx = psp->sx-160*FRACUNIT; diff --git a/firmware/doom/lib/doomgeneric/src/s_sound.c b/firmware/doom/lib/doomgeneric/src/s_sound.c index f6d8be13..d89fe88a 100644 --- a/firmware/doom/lib/doomgeneric/src/s_sound.c +++ b/firmware/doom/lib/doomgeneric/src/s_sound.c @@ -95,7 +95,7 @@ static int snd_SfxVolume; // Whether songs are mus_paused -static boolean mus_paused; +static boolean32 mus_paused; // Music currently being played @@ -646,7 +646,7 @@ void S_ChangeMusic(int musicnum, int looping) mus_playing = music; } -boolean S_MusicPlaying(void) +boolean32 S_MusicPlaying(void) { return I_MusicIsPlaying(); } diff --git a/firmware/doom/lib/doomgeneric/src/s_sound.h b/firmware/doom/lib/doomgeneric/src/s_sound.h index bbd100a0..42f4cca2 100644 --- a/firmware/doom/lib/doomgeneric/src/s_sound.h +++ b/firmware/doom/lib/doomgeneric/src/s_sound.h @@ -65,7 +65,7 @@ void S_StartMusic(int music_id); void S_ChangeMusic(int music_id, int looping); // query if music is playing -boolean S_MusicPlaying(void); +boolean32 S_MusicPlaying(void); // Stops the music fer sure. void S_StopMusic(void); diff --git a/firmware/doom/lib/doomgeneric/src/st_lib.c b/firmware/doom/lib/doomgeneric/src/st_lib.c index 7ce978d4..cfa2aa6b 100644 --- a/firmware/doom/lib/doomgeneric/src/st_lib.c +++ b/firmware/doom/lib/doomgeneric/src/st_lib.c @@ -37,7 +37,7 @@ // in AM_map.c -extern boolean automapactive; +extern boolean32 automapactive; @@ -62,7 +62,7 @@ STlib_initNum int y, patch_t** pl, int* num, - boolean* on, + boolean32* on, int width ) { n->x = x; @@ -83,7 +83,7 @@ STlib_initNum void STlib_drawNum ( st_number_t* n, - boolean refresh ) + boolean32 refresh ) { int numdigits = n->width; @@ -145,7 +145,7 @@ STlib_drawNum void STlib_updateNum ( st_number_t* n, - boolean refresh ) + boolean32 refresh ) { if (*n->on) STlib_drawNum(n, refresh); } @@ -159,7 +159,7 @@ STlib_initPercent int y, patch_t** pl, int* num, - boolean* on, + boolean32* on, patch_t* percent ) { STlib_initNum(&p->n, x, y, pl, num, on, 3); @@ -189,7 +189,7 @@ STlib_initMultIcon int y, patch_t** il, int* inum, - boolean* on ) + boolean32* on ) { i->x = x; i->y = y; @@ -204,7 +204,7 @@ STlib_initMultIcon void STlib_updateMultIcon ( st_multicon_t* mi, - boolean refresh ) + boolean32 refresh ) { int w; int h; @@ -238,8 +238,8 @@ STlib_initBinIcon int x, int y, patch_t* i, - boolean* val, - boolean* on ) + boolean32* val, + boolean32* on ) { b->x = x; b->y = y; @@ -254,7 +254,7 @@ STlib_initBinIcon void STlib_updateBinIcon ( st_binicon_t* bi, - boolean refresh ) + boolean32 refresh ) { int x; int y; diff --git a/firmware/doom/lib/doomgeneric/src/st_lib.h b/firmware/doom/lib/doomgeneric/src/st_lib.h index 3a8f5212..8c209525 100644 --- a/firmware/doom/lib/doomgeneric/src/st_lib.h +++ b/firmware/doom/lib/doomgeneric/src/st_lib.h @@ -45,9 +45,9 @@ typedef struct // pointer to current value int* num; - // pointer to boolean stating + // pointer to boolean32 stating // whether to update number - boolean* on; + boolean32* on; // list of patches for 0-9 patch_t** p; @@ -86,9 +86,9 @@ typedef struct // pointer to current icon int* inum; - // pointer to boolean stating + // pointer to boolean32 stating // whether to update icon - boolean* on; + boolean32* on; // list of icons patch_t** p; @@ -110,14 +110,14 @@ typedef struct int y; // last icon value - boolean oldval; + boolean32 oldval; // pointer to current icon status - boolean* val; + boolean32* val; - // pointer to boolean + // pointer to boolean32 // stating whether to update icon - boolean* on; + boolean32* on; patch_t* p; // icon @@ -147,13 +147,13 @@ STlib_initNum int y, patch_t** pl, int* num, - boolean* on, + boolean32* on, int width ); void STlib_updateNum ( st_number_t* n, - boolean refresh ); + boolean32 refresh ); // Percent widget routines @@ -164,7 +164,7 @@ STlib_initPercent int y, patch_t** pl, int* num, - boolean* on, + boolean32* on, patch_t* percent ); @@ -182,13 +182,13 @@ STlib_initMultIcon int y, patch_t** il, int* inum, - boolean* on ); + boolean32* on ); void STlib_updateMultIcon ( st_multicon_t* mi, - boolean refresh ); + boolean32 refresh ); // Binary Icon widget routines @@ -198,12 +198,12 @@ STlib_initBinIcon int x, int y, patch_t* i, - boolean* val, - boolean* on ); + boolean32* val, + boolean32* on ); void STlib_updateBinIcon ( st_binicon_t* bi, - boolean refresh ); + boolean32 refresh ); #endif diff --git a/firmware/doom/lib/doomgeneric/src/st_stuff.c b/firmware/doom/lib/doomgeneric/src/st_stuff.c index e25acccb..47bd7314 100644 --- a/firmware/doom/lib/doomgeneric/src/st_stuff.c +++ b/firmware/doom/lib/doomgeneric/src/st_stuff.c @@ -266,7 +266,7 @@ byte *st_backing_screen; static player_t* plyr; // ST_Start() has just been called -static boolean st_firsttime; +static boolean32 st_firsttime; // lump number for PLAYPAL static int lu_palette; @@ -284,25 +284,25 @@ static st_chatstateenum_t st_chatstate; static st_stateenum_t st_gamestate; // whether left-side main status bar is active -static boolean st_statusbaron; +static boolean32 st_statusbaron; // whether status bar chat is active -static boolean st_chat; +static boolean32 st_chat; // value of st_chat before message popped up -static boolean st_oldchat; +static boolean32 st_oldchat; // whether chat window has the cursor on -static boolean st_cursoron; +static boolean32 st_cursoron; // !deathmatch -static boolean st_notdeathmatch; +static boolean32 st_notdeathmatch; // !deathmatch && st_statusbaron -static boolean st_armson; +static boolean32 st_armson; // !deathmatch -static boolean st_fragson; +static boolean32 st_fragson; // main bar left static patch_t* sbar; @@ -371,7 +371,7 @@ static int st_fragscount; static int st_oldhealth = -1; // used for evil grin -static boolean oldweaponsowned[NUMWEAPONS]; +static boolean32 oldweaponsowned[NUMWEAPONS]; // count until face changes static int st_facecount = 0; @@ -435,7 +435,7 @@ void ST_refreshBackground(void) // Respond to keyboard input events, // intercept cheats. -boolean +boolean32 ST_Responder (event_t* ev) { int i; @@ -692,7 +692,7 @@ void ST_updateFaceWidget(void) angle_t diffang; static int lastattackdown = -1; static int priority = 0; - boolean doevilgrin; + boolean32 doevilgrin; if (priority < 10) { @@ -998,7 +998,7 @@ void ST_doPaletteStuff(void) } -void ST_drawWidgets(boolean refresh) +void ST_drawWidgets(boolean32 refresh) { int i; @@ -1052,7 +1052,7 @@ void ST_diffDraw(void) ST_drawWidgets(false); } -void ST_Drawer (boolean fullscreen, boolean refresh) +void ST_Drawer (boolean32 fullscreen, boolean32 refresh) { st_statusbaron = (!fullscreen) || automapactive; @@ -1383,7 +1383,7 @@ void ST_createWidgets(void) } -static boolean st_stopped = true; +static boolean32 st_stopped = true; void ST_Start (void) diff --git a/firmware/doom/lib/doomgeneric/src/st_stuff.h b/firmware/doom/lib/doomgeneric/src/st_stuff.h index 8ed53e41..22a2d334 100644 --- a/firmware/doom/lib/doomgeneric/src/st_stuff.h +++ b/firmware/doom/lib/doomgeneric/src/st_stuff.h @@ -37,13 +37,13 @@ // // Called by main loop. -boolean ST_Responder (event_t* ev); +boolean32 ST_Responder (event_t* ev); // Called by main loop. void ST_Ticker (void); // Called by main loop. -void ST_Drawer (boolean fullscreen, boolean refresh); +void ST_Drawer (boolean32 fullscreen, boolean32 refresh); // Called when the console player is spawned on each level. void ST_Start (void); diff --git a/firmware/doom/lib/doomgeneric/src/v_video.h b/firmware/doom/lib/doomgeneric/src/v_video.h index 63542827..98091ff2 100644 --- a/firmware/doom/lib/doomgeneric/src/v_video.h +++ b/firmware/doom/lib/doomgeneric/src/v_video.h @@ -43,7 +43,7 @@ extern byte *tinttable; // haleyjd 08/28/10: implemented for Strife support // haleyjd 08/28/10: Patch clipping callback, implemented to support Choco // Strife. -typedef boolean (*vpatchclipfunc_t)(patch_t *, int, int); +typedef boolean32 (*vpatchclipfunc_t)(patch_t *, int, int); void V_SetPatchClipCallback(vpatchclipfunc_t func); diff --git a/firmware/doom/lib/doomgeneric/src/w_main.c b/firmware/doom/lib/doomgeneric/src/w_main.c index b4c8c1fc..24913804 100644 --- a/firmware/doom/lib/doomgeneric/src/w_main.c +++ b/firmware/doom/lib/doomgeneric/src/w_main.c @@ -27,9 +27,9 @@ // Parse the command line, merging WAD files that are sppecified. // Returns true if at least one file was added. -boolean W_ParseCommandLine(void) +boolean32 W_ParseCommandLine(void) { - boolean modifiedgame = false; + boolean32 modifiedgame = false; int p; #ifdef FEATURE_WAD_MERGE diff --git a/firmware/doom/lib/doomgeneric/src/w_main.h b/firmware/doom/lib/doomgeneric/src/w_main.h index a0a6b302..89889f98 100644 --- a/firmware/doom/lib/doomgeneric/src/w_main.h +++ b/firmware/doom/lib/doomgeneric/src/w_main.h @@ -20,7 +20,7 @@ #include "d_log.h" -boolean W_ParseCommandLine(void); +boolean32 W_ParseCommandLine(void); #endif /* #ifndef W_MAIN_H */ diff --git a/firmware/doom/lib/doomgeneric/src/wi_stuff.c b/firmware/doom/lib/doomgeneric/src/wi_stuff.c index ddb9a66c..c1fbef5e 100644 --- a/firmware/doom/lib/doomgeneric/src/wi_stuff.c +++ b/firmware/doom/lib/doomgeneric/src/wi_stuff.c @@ -406,7 +406,7 @@ void WI_slamBackground(void) // The ticker is used to detect keys // because of timing issues in netgames. -boolean WI_Responder(event_t* ev) +boolean32 WI_Responder(event_t* ev) { return false; } @@ -478,7 +478,7 @@ WI_drawOnLnode int top; int right; int bottom; - boolean fits = false; + boolean32 fits = false; i = 0; do @@ -766,7 +766,7 @@ void WI_updateNoState(void) { } -static boolean snl_pointeron = false; +static boolean32 snl_pointeron = false; void WI_initShowNextLoc(void) @@ -901,7 +901,7 @@ void WI_updateDeathmatchStats(void) int i; int j; - boolean stillticking; + boolean32 stillticking; WI_updateAnimatedBack(); @@ -1120,7 +1120,7 @@ void WI_updateNetgameStats(void) int i; int fsum; - boolean stillticking; + boolean32 stillticking; WI_updateAnimatedBack(); diff --git a/firmware/doom/src/i_buzzersound.cpp b/firmware/doom/src/i_buzzersound.cpp index 5da64ce3..3dce7b48 100644 --- a/firmware/doom/src/i_buzzersound.cpp +++ b/firmware/doom/src/i_buzzersound.cpp @@ -10,7 +10,7 @@ extern "C" { #include "z_zone.h" } -static boolean use_sfx_prefix; +static boolean32 use_sfx_prefix; void soundTask(void* param); void queueSound(uint8_t* data, uint32_t length, uint32_t sample_rate, uint8_t vol); @@ -127,7 +127,7 @@ const float doomNoteToFreq[] = { }; -static boolean I_Buzzer_InitSound(bool _use_sfx_prefix) { +static boolean32 I_Buzzer_InitSound(boolean32 _use_sfx_prefix) { lilka::serial_log("I_Buzzer_InitSound"); use_sfx_prefix = _use_sfx_prefix; return true; @@ -216,7 +216,7 @@ static void I_Buzzer_StopSound(int handle) { // Nothing to do here. } -static boolean I_Buzzer_SoundIsPlaying(int handle) { +static boolean32 I_Buzzer_SoundIsPlaying(int handle) { return false; // TODO } diff --git a/firmware/doom/src/i_defaultmusic.cpp b/firmware/doom/src/i_defaultmusic.cpp index d91924cd..32663122 100644 --- a/firmware/doom/src/i_defaultmusic.cpp +++ b/firmware/doom/src/i_defaultmusic.cpp @@ -11,14 +11,14 @@ static snddevice_t music_devices[] = { // SNDDEVICE_AWE32, }; -static boolean I_Default_InitMusic(void) { +static boolean32 I_Default_InitMusic(void) { return false; } static void I_Default_ShutdownMusic(void) { } static void I_Default_SetMusicVolume(int volume) { } -static void I_Default_PlaySong(void* handle, boolean looping) { +static void I_Default_PlaySong(void* handle, boolean32 looping) { } static void I_Default_PauseSong(void) { } @@ -31,7 +31,7 @@ static void* I_Default_RegisterSong(void* data, int len) { } static void I_Default_UnRegisterSong(void* handle) { } -static boolean I_Default_MusicIsPlaying(void) { +static boolean32 I_Default_MusicIsPlaying(void) { return false; } static void I_Default_PollMusic(void) { diff --git a/firmware/doom/src/i_i2ssound.cpp b/firmware/doom/src/i_i2ssound.cpp index fc26c8f7..9d8e925c 100644 --- a/firmware/doom/src/i_i2ssound.cpp +++ b/firmware/doom/src/i_i2ssound.cpp @@ -11,7 +11,7 @@ extern "C" { #include "z_zone.h" } -static boolean use_sfx_prefix; +static boolean32 use_sfx_prefix; TaskHandle_t soundTaskHandle = NULL; SemaphoreHandle_t soundMutexHandle = NULL; @@ -36,7 +36,7 @@ static snddevice_t sound_devices[] = { SNDDEVICE_AWE32, }; -static boolean I_I2S_InitSound(bool _use_sfx_prefix) { +static boolean32 I_I2S_InitSound(boolean32 _use_sfx_prefix) { lilka::serial_log("I_I2S_InitSound"); use_sfx_prefix = _use_sfx_prefix; soundMutexHandle = xSemaphoreCreateMutex(); @@ -253,7 +253,7 @@ static void I_I2S_StopSound(int handle) { // Nothing to do here. } -static boolean I_I2S_SoundIsPlaying(int handle) { +static boolean32 I_I2S_SoundIsPlaying(int handle) { return false; // TODO } diff --git a/firmware/doom/src/i_nosound.cpp b/firmware/doom/src/i_nosound.cpp index 16c1ce41..771e3168 100644 --- a/firmware/doom/src/i_nosound.cpp +++ b/firmware/doom/src/i_nosound.cpp @@ -2,7 +2,7 @@ static snddevice_t sound_devices[] = {}; -static boolean I_NoSound_InitSound(bool _use_sfx_prefix) { +static boolean32 I_NoSound_InitSound(boolean32 _use_sfx_prefix) { return false; } diff --git a/firmware/doom/src/main.cpp b/firmware/doom/src/main.cpp index 4c3a7577..710a5192 100644 --- a/firmware/doom/src/main.cpp +++ b/firmware/doom/src/main.cpp @@ -7,6 +7,7 @@ extern "C" { #include "doomkeys.h" #include "doomgeneric.h" #include "d_alloc.h" +#include "doomstat.h" } extern void doomgeneric_Create(int argc, char** argv); @@ -40,6 +41,8 @@ float libsamplerate_scale = 0.65f; void gameTask(void* arg); void drawTask(void* arg); +char nextWeaponKey = '2'; + void buttonHandler(lilka::Button button, bool pressed) { xSemaphoreTake(inputMutex, portMAX_DELAY); doomkey_t* key = &keyqueue[keyqueueWrite]; @@ -66,7 +69,10 @@ void buttonHandler(lilka::Button button, bool pressed) { case lilka::Button::C: key->key = KEY_TAB; break; - // TODO: Weapon switch + case lilka::Button::D: + // Cycle weapons + key->key = nextWeaponKey; + break; // Strafing experiment // case lilka::Button::A: // key->key = KEY_STRAFE_R; @@ -115,7 +121,7 @@ void setup() { // Get firmware arg String firmwareFile = lilka::multiboot.getFirmwarePath(); - lilka::serial_log("Firmware file: %s\n", firmwareFile.c_str()); + lilka::serial_log("Firmware file: %s", firmwareFile.c_str()); String firmwareDir; if (firmwareFile.length()) { // Get directory from firmware file @@ -139,13 +145,13 @@ void setup() { } String name(file.name()); name.toLowerCase(); - lilka::serial_log("Checking file: %s\n", name.c_str()); + lilka::serial_log("Checking file: %s", name.c_str()); if (name.startsWith("doom") && name.endsWith(".wad")) { if (firmwareDir.endsWith("/")) { firmwareDir = firmwareDir.substring(0, firmwareDir.length() - 1); } strcpy(arg3, (String("/sd") + firmwareDir + "/" + file.name()).c_str()); - lilka::serial_log("Found .WAD file: %s\n", arg3); + lilka::serial_log("Found .WAD file: %s", arg3); found = true; file.close(); break; @@ -189,7 +195,7 @@ void setup() { lilka::display.fillScreen(lilka::colors::Black); - DG_printf("Doomgeneric starting, WAD file: %s\n", arg3); + DG_printf("Doomgeneric starting, WAD file: %s", arg3); D_AllocBuffers(); // Back buffer must be allocated before doomgeneric_Create since it calls DG_DrawFrame @@ -220,7 +226,7 @@ void setup() { void gameTask(void* arg) { while (1) { doomgeneric_Tick(); - taskYIELD(); + // Print free memory // Serial.print("Free heap: "); // Serial.print(ESP.getFreeHeap()); @@ -228,6 +234,50 @@ void gameTask(void* arg) { // Print free stack // Serial.print(" | Game task free stack: "); // Serial.println(uxTaskGetStackHighWaterMark(NULL)); + + if (playeringame[consoleplayer]) { + // We have a player (TODO: might be demo) + player_t* plyr = &players[consoleplayer]; + weapontype_t weapons[NUMWEAPONS] = { + wp_fist, + wp_chainsaw, + wp_pistol, + wp_shotgun, + wp_supershotgun, + wp_chaingun, + wp_missile, + wp_plasma, + wp_bfg, + }; + int weaponKeys[NUMWEAPONS] = {'1', '1', '2', '3', '3', '4', '5', '6', '7'}; + int currentWeaponIndex; + for (int i = 0; i < NUMWEAPONS; i++) { + if (plyr->readyweapon == weapons[i]) { + currentWeaponIndex = i; + break; + } + } + nextWeaponKey = weaponKeys[plyr->readyweapon]; + for (int i = 1; i < NUMWEAPONS; i++) { + int candidate = (currentWeaponIndex + i) % NUMWEAPONS; + if (plyr->weaponowned[weapons[candidate]] && plyr->ammo[weaponinfo[weapons[candidate]].ammo]) { + nextWeaponKey = weaponKeys[candidate]; + break; + } + } + // Print player position + // Serial.printf( + // "Player health: %d, armor: %d, ammo: %d\r\n", + // plyr->health, + // plyr->armorpoints, + // plyr->ammo[weaponinfo[plyr->readyweapon].ammo] + // ); + // if (plyr->mo) { + // Serial.printf("Player position: %d, %d, %d\r\n", plyr->mo->x, plyr->mo->y, plyr->mo->z); + // } + } + + taskYIELD(); } } From 802f326cd75ab44d9411695f2ce35e24644a2c3b Mon Sep 17 00:00:00 2001 From: Andrew Dunai Date: Thu, 4 Apr 2024 00:12:12 +0300 Subject: [PATCH 2/3] doom: fix code style --- firmware/doom/src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware/doom/src/main.cpp b/firmware/doom/src/main.cpp index 710a5192..1899b20a 100644 --- a/firmware/doom/src/main.cpp +++ b/firmware/doom/src/main.cpp @@ -237,8 +237,8 @@ void gameTask(void* arg) { if (playeringame[consoleplayer]) { // We have a player (TODO: might be demo) - player_t* plyr = &players[consoleplayer]; - weapontype_t weapons[NUMWEAPONS] = { + const player_t* plyr = &players[consoleplayer]; + const weapontype_t weapons[NUMWEAPONS] = { wp_fist, wp_chainsaw, wp_pistol, @@ -249,7 +249,7 @@ void gameTask(void* arg) { wp_plasma, wp_bfg, }; - int weaponKeys[NUMWEAPONS] = {'1', '1', '2', '3', '3', '4', '5', '6', '7'}; + const int weaponKeys[NUMWEAPONS] = {'1', '1', '2', '3', '3', '4', '5', '6', '7'}; int currentWeaponIndex; for (int i = 0; i < NUMWEAPONS; i++) { if (plyr->readyweapon == weapons[i]) { From b70250ab13bc7b6c89e2c6cb2bfdc41d2337c5bb Mon Sep 17 00:00:00 2001 From: Andrew Dunai Date: Thu, 4 Apr 2024 00:19:33 +0300 Subject: [PATCH 3/3] doom: implement gave & setting saving --- firmware/doom/lib/doomgeneric/src/m_config.c | 55 ++++++++++++++------ 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/firmware/doom/lib/doomgeneric/src/m_config.c b/firmware/doom/lib/doomgeneric/src/m_config.c index c239dd2d..0edefa4b 100644 --- a/firmware/doom/lib/doomgeneric/src/m_config.c +++ b/firmware/doom/lib/doomgeneric/src/m_config.c @@ -26,6 +26,7 @@ #include "config.h" +#include "deh_str.h" #include "doomtype.h" #include "doomkeys.h" #include "doomfeatures.h" @@ -39,7 +40,7 @@ // DEFAULTS // -// Location where all configuration data is stored - +// Location where all configuration data is stored - // default.cfg, savegames, etc. char *configdir; @@ -49,7 +50,7 @@ char *configdir; static char *default_main_config; static char *default_extra_config; -typedef enum +typedef enum { DEFAULT_INT, DEFAULT_INT_HEX, @@ -74,7 +75,7 @@ typedef struct // If zero, we didn't read this value from a config file. int untranslated; - // The value we translated the scancode into when we read the + // The value we translated the scancode into when we read the // config file on startup. If the variable value is different from // this, it has been changed and needs to be converted; otherwise, // use the 'untranslated' value. @@ -1564,7 +1565,7 @@ static default_t *SearchCollection(default_collection_t *collection, char *name) { int i; - for (i=0; inumdefaults; ++i) + for (i=0; inumdefaults; ++i) { if (!strcmp(name, collection->defaults[i].name)) { @@ -1612,13 +1613,13 @@ static void SaveDefaultCollection(default_collection_t *collection) default_t *defaults; int i, v; FILE *f; - + f = fopen (collection->filename, "w"); if (!f) return; // can't write the file, but don't complain defaults = collection->defaults; - + for (i=0 ; inumdefaults ; i++) { int chars_written; @@ -1639,14 +1640,14 @@ static void SaveDefaultCollection(default_collection_t *collection) // Print the value - switch (defaults[i].type) + switch (defaults[i].type) { case DEFAULT_KEY: // use the untranslated version if we can, to reduce // the possibility of screwing up the user's config // file - + v = * (int *) defaults[i].location; if (v == KEY_RSHIFT) @@ -1781,7 +1782,7 @@ static void LoadDefaultCollection(default_collection_t *collection) if (f == NULL) { - // File not opened, but don't complain. + // File not opened, but don't complain. // It's probably just the first time they ran the game. return; @@ -1881,7 +1882,7 @@ void M_SaveDefaultsAlternate(char *main, char *extra) void M_LoadDefaults (void) { int i; - + // check for a custom default file //! @@ -1919,7 +1920,7 @@ void M_LoadDefaults (void) if (i) { extra_defaults.filename = myargv[i+1]; - DG_printf(" extra configuration file: %s\n", + DG_printf(" extra configuration file: %s\n", extra_defaults.filename); } else @@ -2042,14 +2043,33 @@ float M_GetFloatVariable(char *name) static char *GetDefaultConfigDir(void) { - char *result = (char *)malloc(2); - result[0] = '.'; - result[1] = '\0'; + // char *result = (char *)malloc(2); + // result[0] = '.'; + // result[1] = '\0'; + // return result; - return result; + // Update for Lilka: use IWAD directory as default config directory. + // This will also be used for game saves. /AD + int iwadparm = M_CheckParmWithArgs("-iwad", 1); + + if (!iwadparm) + { + DEH_printf("No IWAD specified. Using /sd/ as default config directory.\n"); + return strdup("/sd"); + } + + char* iwadfile = myargv[iwadparm + 1]; + + // Find the last directory separator in the IWAD filename + char *lastsep = strrchr(iwadfile, DIR_SEPARATOR); + // Trim iwadfile to the last directory separator (excluding the separator) + char *iwaddir = strdup(iwadfile); + iwaddir[lastsep - iwadfile] = '\0'; + + return iwaddir; } -// +// // SetConfigDir: // // Sets the location of the configuration directory, where configuration @@ -2115,7 +2135,8 @@ char *M_GetSaveGameDir(char *iwadname) free(topdir); #else - savegamedir = M_StringJoin(configdir, DIR_SEPARATOR_S, ".savegame/", NULL); + // savegamedir = M_StringJoin(configdir, DIR_SEPARATOR_S, ".savegame/", NULL); + savegamedir = M_StringJoin(configdir, DIR_SEPARATOR_S, NULL); // AD M_MakeDirectory(savegamedir);