From c977c4fc45ddcd9cc9cf41d2f8fce61afc606a02 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 11 Nov 2025 14:19:02 +0100 Subject: [PATCH] initialize most of our global variables just to be safe, not really trusting the game at this point, maybe this helps with some obscure bugs or smth lel --- src/d_clisrv.c | 39 +++++---- src/d_main.c | 72 +++------------- src/d_net.c | 6 +- src/d_netfil.c | 8 +- src/g_demo.c | 6 +- src/g_game.c | 177 +++++++++++++++++++-------------------- src/hardware/hw_clip.c | 13 ++- src/hardware/hw_defs.h | 2 +- src/hardware/hw_main.cpp | 16 ++-- src/hardware/hw_md2.c | 7 +- src/hardware/hw_portal.c | 4 +- src/p_enemy.c | 4 +- src/p_map.c | 26 +++--- src/p_mobj.c | 2 +- src/p_saveg.c | 2 +- src/p_setup.c | 56 ++++++------- src/p_spec.c | 4 +- src/p_tick.c | 6 +- src/r_bsp.cpp | 14 ++-- src/r_data.c | 4 +- src/r_data.h | 2 - src/r_draw.cpp | 30 +++---- src/r_main.cpp | 48 +++++------ src/r_patchrotation.cpp | 4 +- src/r_portal.c | 12 +-- src/r_segs.cpp | 6 +- src/r_skins.c | 12 +-- src/r_sky.c | 16 ++-- src/r_things.cpp | 8 +- src/screen.c | 4 +- src/v_video.c | 2 +- 31 files changed, 278 insertions(+), 334 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index eb39f34f7..f69d67cfe 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -78,14 +78,14 @@ #define MAX_REASONLENGTH 30 #define FORCECLOSE 0x8000 -static long long unsigned packetstat[NUMPACKETTYPE+1] = {0}; +static long long unsigned packetstat[NUMPACKETTYPE+1] = {}; boolean server = true; // true or false but !server == client #define client (!server) boolean nodownload = false; boolean serverrunning = false; INT32 serverplayer = 0; -char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support) +char motd[254] = {}, server_context[8] = {}; // Message of the Day, Unique Context (even without Mumble support) #define MAP_ICON_REQUEST_FREQUENCY 8 @@ -98,14 +98,13 @@ static int map_icon_request_count; // current count of icon requests sent static UINT8 *map_icon_data; static patch_t *map_icon; -plrinfo playerinfo[MAXPLAYERS]; +plrinfo playerinfo[MAXPLAYERS] = {}; SINT8 joinnode = 0; // used for CL_VIEWSERVER -boolean player_muted[MAXPLAYERS] = {0}; +boolean player_muted[MAXPLAYERS] = {}; // Server specific vars -UINT8 playernode[MAXPLAYERS]; - +UINT8 playernode[MAXPLAYERS] = {}; // Minimum timeout for sending the savegame // The actual timeout will be longer depending on the savegame length @@ -118,15 +117,15 @@ static tic_t savegameresendcooldown[MAXNETNODES]; // How long before we can rese static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout? UINT16 pingmeasurecount = 1; -UINT32 realpingtable[MAXPLAYERS]; //the base table of ping where an average will be sent to everyone. -UINT32 playerpingtable[MAXPLAYERS]; //table of player latency values. +UINT32 realpingtable[MAXPLAYERS] = {}; //the base table of ping where an average will be sent to everyone. +UINT32 playerpingtable[MAXPLAYERS] = {}; //table of player latency values. #define GENTLEMANSMOOTHING (TICRATE) static tic_t reference_lag; static UINT8 spike_time; -tic_t lowest_lag; -tic_t simulated_lag; -boolean server_lagless; +tic_t lowest_lag = 0; +tic_t simulated_lag = 0; +boolean server_lagless = true; static void Lagless_OnChange(void) { @@ -144,12 +143,12 @@ static CV_PossibleValue_t mindelay_cons_t[] = {{0, "MIN"}, {30, "MAX"}, {0, NULL consvar_t cv_mindelay = {"mindelay", "0", CV_SAVE, mindelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_gentlemens = {"gentlemensdelay", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Lagless_OnChange, 0, NULL, NULL, 0, 0, NULL}; // this should be a netvar Zzz... -SINT8 nodetoplayer[MAXNETNODES]; -SINT8 nodetoplayer2[MAXNETNODES]; // say the numplayer for this node if any (splitscreen) -SINT8 nodetoplayer3[MAXNETNODES]; // say the numplayer for this node if any (splitscreen == 2) -SINT8 nodetoplayer4[MAXNETNODES]; // say the numplayer for this node if any (splitscreen == 3) -UINT8 playerpernode[MAXNETNODES]; // used specialy for splitscreen -boolean nodeingame[MAXNETNODES]; // set false as nodes leave game +SINT8 nodetoplayer[MAXNETNODES] = {}; +SINT8 nodetoplayer2[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen) +SINT8 nodetoplayer3[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen == 2) +SINT8 nodetoplayer4[MAXNETNODES] = {}; // say the numplayer for this node if any (splitscreen == 3) +UINT8 playerpernode[MAXNETNODES] = {}; // used specialy for splitscreen +boolean nodeingame[MAXNETNODES] = {}; // set false as nodes leave game tic_t servermaxping = 20; // server's max delay, in frames. Defaults to 20 static tic_t nettics[MAXNETNODES]; // what tic the client have received @@ -196,7 +195,7 @@ boolean is_client_saturn[MAXNETNODES]; static UINT8 localtextcmd[MAXSPLITSCREENPLAYERS][MAXTEXTCMD]; static tic_t neededtic; SINT8 servernode = 0; // the number of the server node -char connectedservername[MAXSERVERNAME+1]; +char connectedservername[MAXSERVERNAME+1] = {}; /// \brief do we accept new players? /// \todo WORK! boolean acceptnewnode = true; @@ -227,7 +226,7 @@ struct textcmdbuf_s static textcmdbuf_t *textcmdbuf[MAXSPLITSCREENPLAYERS] = {NULL}; static ticcmd_t playercmds[MAXPLAYERS]; -ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS]; +ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS] = {}; static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL}; consvar_t cv_showjoinaddress = {"showjoinaddress", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -285,7 +284,7 @@ static inline void *G_ScpyTiccmd(ticcmd_t* dest, void* src, const size_t n) // Some software don't support largest packet // (original sersetup, not exactely, but the probability of sending a packet // of 512 bytes is like 0.1) -UINT16 software_MAXPACKETLENGTH; +UINT16 software_MAXPACKETLENGTH = 0; /** Guesses the value of a tic from its lowest byte and from maketic * diff --git a/src/d_main.c b/src/d_main.c index bafc110e1..7a738288b 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -142,8 +142,8 @@ static char addonsdir[MAX_WADPATH]; // Events can be discarded if no responder claims them // referenced from i_system.c for I_GetKey() -event_t events[MAXEVENTS]; -INT32 eventhead, eventtail; +event_t events[MAXEVENTS] = {}; +INT32 eventhead = 0, eventtail = 0; boolean dedicated = false; @@ -161,68 +161,17 @@ void D_PostEvent(const event_t *ev) // modifier keys // Now handled in I_OsPolling -UINT8 shiftdown = 0; // 0x1 left, 0x2 right -UINT8 ctrldown = 0; // 0x1 left, 0x2 right -UINT8 altdown = 0; // 0x1 left, 0x2 right -boolean capslock = 0; // gee i wonder what this does. +UINT8 shiftdown = 0; // 0x1 left, 0x2 right +UINT8 ctrldown = 0; // 0x1 left, 0x2 right +UINT8 altdown = 0; // 0x1 left, 0x2 right +boolean capslock = 0; // gee i wonder what this does. -static void D_PadMenuScrollInput(UINT8 input) -{ - event_t dpadev; - memset(&dpadev, 0, sizeof(event_t)); - dpadev.type = ev_keydown; - - switch (input) - { - case DPAD_UP: - dpadev.data1 = KEY_UPARROW; - break; - case DPAD_DOWN: - dpadev.data1 = KEY_DOWNARROW; - break; - case DPAD_LEFT: - dpadev.data1 = KEY_LEFTARROW; - break; - case DPAD_RIGHT: - dpadev.data1 = KEY_RIGHTARROW; - break; - } - - D_PostEvent(&dpadev); // put into eventlist -} - -#define SCROLLDELAY 19 - -// Check if any dpad button is held -// and pass it to the eventlist -static void D_GamePadMenuScrollTicker(void) -{ - UINT8 i; - static UINT8 menuInputDelayTimer = 0; - - for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) - { - if (dpadscrollstate[i]) - { - if (menuInputDelayTimer < SCROLLDELAY) - menuInputDelayTimer++; - else if (menuInputDelayTimer == SCROLLDELAY) - D_PadMenuScrollInput(i); - - return; - } - } - - menuInputDelayTimer = 0; -} -#undef SCROLLDELAY - -static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0}; +static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {}; static void D_DeviceLEDTick(void) { UINT8 i; - static UINT16 color[MAXSPLITSCREENPLAYERS] = {0}; + static UINT16 color[MAXSPLITSCREENPLAYERS] = {}; if (numcontrollers == 0) { @@ -390,8 +339,7 @@ static void D_Renderview(void) } else if (rendermode == render_soft) #endif - - R_RenderPlayerView(&players[displayplayers[i]]); + R_RenderPlayerView(&players[displayplayers[i]]); } if (rendermode == render_soft) @@ -720,7 +668,7 @@ static boolean D_Display(void) // D_SRB2Loop // ========================================================================= -tic_t rendergametic; +tic_t rendergametic = 0; void D_SRB2Loop(void) { diff --git a/src/d_net.c b/src/d_net.c index d5b11f018..7fb216288 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -95,9 +95,9 @@ static INT32 sendackpacket = 0, getackpacket = 0; INT32 ticruned = 0, ticmiss = 0; // globals -INT32 getbps, sendbps; -float lostpercent, duppercent, gamelostpercent; -INT32 packetheaderlength; +INT32 getbps = 0, sendbps = 0; +float lostpercent = 0, duppercent = 0, gamelostpercent = 0; +INT32 packetheaderlength = 0; boolean Net_GetNetStat(void) { diff --git a/src/d_netfil.c b/src/d_netfil.c index 6c9183eea..d80ae7b79 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -110,14 +110,14 @@ static fileused_t transferFiles[UINT8_MAX + 1]; // Write time of file: utime // Receiver structure -INT32 fileneedednum; // Number of files needed to join the server -fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files +INT32 fileneedednum = 0; // Number of files needed to join the server +fileneeded_t fileneeded[MAX_WADFILES] = {}; // List of needed files #ifdef HAVE_THREADS static I_mutex downloadmutex; #endif char downloaddir[512] = "DOWNLOAD"; -file_download_t filedownload; +file_download_t filedownload = {}; #ifdef HAVE_CURL static CURL *http_handle; @@ -131,7 +131,7 @@ static UINT32 curl_origfilesize; static UINT32 curl_origtotalfilesize; static char *curl_realname = NULL; fileneeded_t *curl_curfile = NULL; -HTTP_login *curl_logins; +HTTP_login *curl_logins = NULL; #endif /** Fills a serverinfo packet with information about wad files loaded. diff --git a/src/g_demo.c b/src/g_demo.c index 897238107..5e6f20a6d 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -68,8 +68,8 @@ UINT8 numDemos = 0; //3; -- i'm FED UP of losing my skincolour to a broken UINT32 demoDelayTime = 15*TICRATE; UINT32 demoIdleTime = 3*TICRATE; -boolean nodrawers; // for comparative timing purposes -boolean noblit; // for comparative timing purposes +boolean nodrawers = false; // for comparative timing purposes +boolean noblit = false; // for comparative timing purposes static tic_t demostarttime; // for comparative timing purposes //@TODO put these all in a struct for namespacing purposes? @@ -80,7 +80,7 @@ static UINT8 *demoend; static UINT8 demoflags; static boolean demosynced = true; // console warning message -struct demovars_s demo; +struct demovars_s demo = {}; consvar_t cv_resyncdemo = {"resyncdemo", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/g_game.c b/src/g_game.c index aa03a0524..a9b2579a8 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -59,15 +59,15 @@ #include "discord.h" #endif -gameaction_t gameaction; +gameaction_t gameaction = 0; gamestate_t gamestate = GS_NULL; UINT8 ultimatemode = false; -boolean botingame; -UINT8 botskin; -UINT8 botcolor; +boolean botingame = false; +UINT8 botskin = 0; +UINT8 botcolor = 0; -JoyType_t Joystick[MAXSPLITSCREENPLAYERS]; +JoyType_t Joystick[MAXSPLITSCREENPLAYERS] = {}; // 1024 bytes is plenty for a savegame #define SAVEGAMESIZE (1024) @@ -83,10 +83,10 @@ static void G_DoContinued(void); static void G_DoWorldDone(void); static void G_DoStartVote(void); -music_t mapmusic; +music_t mapmusic = {}; INT16 gamemap = 1; -INT16 maptol; +INT16 maptol = 0; UINT8 globalweather = 0; INT32 curWeather = PRECIP_NONE; INT32 cursaveslot = -1; // Auto-save 1p savegame slot @@ -97,29 +97,29 @@ UINT16 mainwads = 0; boolean modifiedgame = false; // Set if homebrew PWAD stuff has been added. boolean majormods = false; // Set if Lua/Gameplay SOC/replacement map has been added. boolean savemoddata = false; -UINT8 paused; +UINT8 paused = 0; UINT8 modeattacking = ATTACKING_NONE; boolean imcontinuing = false; boolean runemeraldmanager = false; -boolean netgame; // only true if packets are broadcast -boolean multiplayer; -boolean playeringame[MAXPLAYERS]; -boolean addedtogame; -player_t players[MAXPLAYERS]; +boolean netgame = false; // only true if packets are broadcast +boolean multiplayer = false; +boolean playeringame[MAXPLAYERS] = {}; +boolean addedtogame = false; +player_t players[MAXPLAYERS] = {}; -INT32 consoleplayer; // player taking events and displaying -INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {0}; // view being displayed +INT32 consoleplayer = 0; // player taking events and displaying +INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {}; // view being displayed -tic_t gametic; -tic_t levelstarttic; // gametic at level start -UINT32 totalrings; // for intermission -INT16 lastmap; // last level you were at (returning from special stages) -tic_t timeinmap; // Ticker for time spent in level (used for levelcard display) +tic_t gametic = 0; +tic_t levelstarttic = 0; // gametic at level start +UINT32 totalrings = 0; // for intermission +INT16 lastmap = 0; // last level you were at (returning from special stages) +tic_t timeinmap = 0; // Ticker for time spent in level (used for levelcard display) -INT16 spstage_start; -INT16 sstage_start; -INT16 sstage_end; +INT16 spstage_start = 0; +INT16 sstage_start = 0; +INT16 sstage_end = 0; boolean looptitle = true; boolean useNightsSS = false; @@ -134,42 +134,42 @@ boolean countdowntimeup = false; cutscene_t *cutscenes[128]; -INT16 nextmapoverride; -boolean skipstats; +INT16 nextmapoverride = 0; +boolean skipstats = false; // Pointers to each CTF flag -mobj_t *redflag; -mobj_t *blueflag; +mobj_t *redflag = NULL; +mobj_t *blueflag = NULL; // Pointers to CTF spawn location -mapthing_t *rflagpoint; -mapthing_t *bflagpoint; +mapthing_t *rflagpoint = NULL; +mapthing_t *bflagpoint = NULL; struct quake quake; // Map Header Information -mapheader_t* mapheaderinfo[NUMMAPS] = {NULL}; +mapheader_t* mapheaderinfo[NUMMAPS] = {}; static boolean exitgame = false; static boolean retrying = false; -UINT8 stagefailed; // Used for GEMS BONUS? Also to see if you beat the stage. +UINT8 stagefailed = 0; // Used for GEMS BONUS? Also to see if you beat the stage. -UINT16 emeralds; -UINT32 token; // Number of tokens collected in a level -UINT32 tokenlist; // List of tokens collected -INT32 tokenbits; // Used for setting token bits +UINT16 emeralds = 0; +UINT32 token = 0; // Number of tokens collected in a level +UINT32 tokenlist = 0; // List of tokens collected +INT32 tokenbits = 0; // Used for setting token bits // Old Special Stage -INT32 sstimer; // Time allotted in the special stage +INT32 sstimer = 0; // Time allotted in the special stage boolean gamedataloaded = false; // Time attack data for levels // These are dynamically allocated for space reasons now -recorddata_t *mainrecords[NUMMAPS] = {NULL}; -UINT8 mapvisited[NUMMAPS]; +recorddata_t *mainrecords[NUMMAPS] = {}; +UINT8 mapvisited[NUMMAPS] = {}; -UINT32 bluescore, redscore; // CTF and Team Match team scores +UINT32 bluescore = 0, redscore = 0; // CTF and Team Match team scores // ring count... for PERFECT! INT32 nummaprings = 0; @@ -179,12 +179,12 @@ INT32 nummapboxes = 0; INT32 numgotboxes = 0; // Elminates unnecessary searching. -boolean CheckForBustableBlocks; -boolean CheckForBouncySector; -boolean CheckForQuicksand; -boolean CheckForMarioBlocks; -boolean CheckForFloatBob; -boolean CheckForReverseGravity; +boolean CheckForBustableBlocks = false; +boolean CheckForBouncySector = false; +boolean CheckForQuicksand = false; +boolean CheckForMarioBlocks = false; +boolean CheckForFloatBob = false; +boolean CheckForReverseGravity = false; // Powerup durations UINT16 invulntics = 20*TICRATE; @@ -215,67 +215,66 @@ INT32 gameovertics = 15*TICRATE; UINT8 use1upSound = 0; UINT8 maxXtraLife = 2; // Max extra lives from rings -UINT8 introtoplay; -UINT8 creditscutscene; +UINT8 introtoplay = 0; +UINT8 creditscutscene = 0; // Emerald locations -mobj_t *hunt1; -mobj_t *hunt2; -mobj_t *hunt3; +mobj_t *hunt1 = NULL; +mobj_t *hunt2 = NULL; +mobj_t *hunt3 = NULL; -tic_t racecountdown, exitcountdown; // for racing +tic_t racecountdown = 0, exitcountdown = 0; // for racing -fixed_t gravity; -fixed_t mapobjectscale; +fixed_t gravity = 0; +fixed_t mapobjectscale = FRACUNIT; struct maplighting maplighting; -INT16 autobalance; //for CTF team balance -INT16 teamscramble; //for CTF team scramble -INT16 scrambleplayers[MAXPLAYERS]; //for CTF team scramble -INT16 scrambleteams[MAXPLAYERS]; //for CTF team scramble -INT16 scrambletotal; //for CTF team scramble -INT16 scramblecount; //for CTF team scramble +INT16 autobalance = 0; //for CTF team balance +INT16 teamscramble = 0; //for CTF team scramble +INT16 scrambleplayers[MAXPLAYERS] = {}; //for CTF team scramble +INT16 scrambleteams[MAXPLAYERS] = {}; //for CTF team scramble +INT16 scrambletotal = 0; //for CTF team scramble +INT16 scramblecount = 0; //for CTF team scramble -INT32 cheats; //for multiplayer cheat commands +INT32 cheats = 0; //for multiplayer cheat commands // SRB2Kart // Cvars that we don't want changed mid-game -UINT8 gamespeed; // Game's current speed (or difficulty, or cc, or etc); 0 for easy, 1 for normal, 2 for hard +UINT8 gamespeed = 0; // Game's current speed (or difficulty, or cc, or etc); 0 for easy, 1 for normal, 2 for hard boolean encoremode = false; // Encore Mode currently enabled? -boolean prevencoremode; -boolean franticitems; // Frantic items currently enabled? -boolean comeback; // Battle Mode's karma comeback is on/off +boolean prevencoremode = 0; +boolean franticitems = 0; // Frantic items currently enabled? +boolean comeback = 0; // Battle Mode's karma comeback is on/off // Voting system -INT16 votelevels[4][2]; // Levels that were rolled by the host -SINT8 votes[MAXPLAYERS]; // Each player's vote -SINT8 pickedvote; // What vote the host rolls +INT16 votelevels[4][2] = {}; // Levels that were rolled by the host +SINT8 votes[MAXPLAYERS] = {}; // Each player's vote +SINT8 pickedvote = 0; // What vote the host rolls // Server-sided, synched variables -SINT8 battlewanted[4]; // WANTED players in battle, worth x2 points -tic_t wantedcalcdelay; // Time before it recalculates WANTED -tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any other item that works indirectly is awarded -tic_t hyubgone; // Cooldown before hyudoro is allowed to be rerolled -tic_t mapreset; // Map reset delay when enough players have joined an empty game -UINT8 nospectategrief; // How many players need to be in-game to eliminate last; for preventing spectate griefing -boolean thwompsactive; // Thwomps activate on lap 2 -SINT8 spbplace; // SPB exists, give the person behind better items -boolean startedInFreePlay; // Map was started in free play +SINT8 battlewanted[4] = {}; // WANTED players in battle, worth x2 points +tic_t wantedcalcdelay = 0; // Time before it recalculates WANTED +tic_t indirectitemcooldown = 0; // Cooldown before any more Shrink, SPB, or any other item that works indirectly is awarded +tic_t hyubgone = 0; // Cooldown before hyudoro is allowed to be rerolled +tic_t mapreset = 0; // Map reset delay when enough players have joined an empty game +UINT8 nospectategrief = 0; // How many players need to be in-game to eliminate last; for preventing spectate griefing +boolean thwompsactive = 0; // Thwomps activate on lap 2 +SINT8 spbplace = 0; // SPB exists, give the person behind better items +boolean startedInFreePlay = false; // Map was started in free play // Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players) -boolean legitimateexit; // Did this client actually finish the match? -boolean comebackshowninfo; // Have you already seen the "ATTACK OR PROTECT" message? -static INT16 randmapbuffer[NUMMAPS+1]; // Buffer for maps RandMap is allowed to roll +boolean legitimateexit = 0; // Did this client actually finish the match? +boolean comebackshowninfo = 0; // Have you already seen the "ATTACK OR PROTECT" message? +static INT16 randmapbuffer[NUMMAPS+1] = {}; // Buffer for maps RandMap is allowed to roll -tic_t hidetime; +tic_t hidetime = 0; // Grading -UINT32 timesBeaten; -UINT32 timesBeatenWithEmeralds; -//UINT32 timesBeatenUltimate; +UINT32 timesBeaten = 0; +UINT32 timesBeatenWithEmeralds = 0; -INT16 prevmap, nextmap; +INT16 prevmap = 0, nextmap = 0; // Analog Control void SendWeaponPref(void); @@ -470,7 +469,7 @@ consvar_t cv_cechotoggle = {"show_cecho", "On", CV_SAVE, cechotoggle_t, NULL, 0, #endif #ifdef SEENAMES -player_t *seenplayer; // player we're aiming at right now +player_t *seenplayer = NULL; // player we're aiming at right now #endif char player_names[MAXPLAYERS][MAXPLAYERNAME+1] = @@ -493,7 +492,7 @@ char player_names[MAXPLAYERS][MAXPLAYERNAME+1] = "Player 16" }; // SRB2kart - removed Players 17 through 32 -INT32 player_name_changes[MAXPLAYERS]; +INT32 player_name_changes[MAXPLAYERS] = {}; INT16 rw_maximums[NUM_WEAPONS] = { @@ -797,9 +796,9 @@ boolean InputDown(INT32 gc, UINT8 p) } } -INT32 localaiming[MAXSPLITSCREENPLAYERS] = {0}; -angle_t localangle[MAXSPLITSCREENPLAYERS] = {0}; -boolean camspin[MAXSPLITSCREENPLAYERS] = {0}; +INT32 localaiming[MAXSPLITSCREENPLAYERS] = {}; +angle_t localangle[MAXSPLITSCREENPLAYERS] = {}; +boolean camspin[MAXSPLITSCREENPLAYERS] = {}; static fixed_t forwardmove[2] = {25<>16, 50<>16}; static fixed_t sidemove[2] = {2<>16, 4<>16}; diff --git a/src/hardware/hw_clip.c b/src/hardware/hw_clip.c index 6066d8528..624dc4234 100644 --- a/src/hardware/hw_clip.c +++ b/src/hardware/hw_clip.c @@ -80,14 +80,13 @@ typedef struct clipnode_s - { - struct clipnode_s *prev, *next; - angle_t start, end; - } clipnode_t; +{ + struct clipnode_s *prev, *next; + angle_t start, end; +} clipnode_t; -clipnode_t *freelist; -clipnode_t *clipnodes; -clipnode_t *cliphead; +static clipnode_t *freelist; +static clipnode_t *cliphead; static clipnode_t * gld_clipnode_GetNew(void); static clipnode_t * gld_clipnode_NewRange(angle_t start, angle_t end); diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index 590e03a63..ce903c82d 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -117,7 +117,7 @@ typedef struct typedef struct { - FLOAT x,y,z; // position + FLOAT x, y, z; // position FLOAT anglex, angley, anglez; // aimingangle / viewangle FLOAT scalex, scaley, scalez; FLOAT fovangle; diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 969b976ff..2db86af78 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -75,19 +75,19 @@ boolean gl_drawing_stencil = false; static INT32 current_bsp_culling_distance = 0; -FTransform atransform; +FTransform atransform = {}; // Float variants of viewx, viewy, viewz, etc. static float gl_viewx, gl_viewy, gl_viewz; -float gl_viewsin, gl_viewcos; +float gl_viewsin = 0.0f, gl_viewcos = 0.0f; static float gl_viewludsin, gl_viewludcos; static angle_t gl_aimingangle; -seg_t *gl_curline; -side_t *gl_sidedef; -line_t *gl_linedef; -sector_t *gl_frontsector; -sector_t *gl_backsector; +seg_t *gl_curline = NULL; +side_t *gl_sidedef = NULL; +line_t *gl_linedef = NULL; +sector_t *gl_frontsector = NULL; +sector_t *gl_backsector = NULL; // values for the far clipping plane static constexpr float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f}; @@ -5327,7 +5327,9 @@ void HWR_SetTransform(float fpov) atransform.fliptype = TRANSFORM_FLIP; } else if (postimg & POSTIMG_MIRROR) + { atransform.fliptype = TRANSFORM_MIRROR; + } // Set transform. GL_SetTransform(&atransform); diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 911f382a9..763fb873c 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -72,10 +72,9 @@ #include #endif -md2_t md2_models[NUMSPRITES]; -md2_t md2_playermodels[MAXSKINS]; -md2_t md2_localplayermodels[MAXLOCALSKINS]; - +md2_t md2_models[NUMSPRITES] = {}; +md2_t md2_playermodels[MAXSKINS] = {}; +md2_t md2_localplayermodels[MAXLOCALSKINS] = {}; /* * free model diff --git a/src/hardware/hw_portal.c b/src/hardware/hw_portal.c index db17d05bf..d8ad87354 100644 --- a/src/hardware/hw_portal.c +++ b/src/hardware/hw_portal.c @@ -30,7 +30,7 @@ SINT8 gl_portal_state = GLPORTAL_OFF; -gl_portallist_t *currentportallist; +gl_portallist_t *currentportallist = NULL; // clip the area outside the portal destination window void HWR_PortalClipping(gl_portal_t *portal) @@ -168,8 +168,10 @@ void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float // go to portal frame lmao HWR_PortalFrame(portal); + // call HWR_RenderViewpoint HWR_RenderPortalViewpoint(portal, player, stencil_level + 1, true); + // return to current frame if (rootportal) HWR_PortalFrame(rootportal); diff --git a/src/p_enemy.c b/src/p_enemy.c index a487eb328..880f110cd 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -28,8 +28,8 @@ boolean LUA_CallAction(enum actionnum actionnum, void *thing); -INT32 var1; -INT32 var2; +INT32 var1 = 0; +INT32 var2 = 0; // // P_NewChaseDir related LUT. diff --git a/src/p_map.c b/src/p_map.c index aea01c6a7..f9d828b98 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -41,32 +41,32 @@ #include "m_perfstats.h" // ps_checkposition_calls -fixed_t tmbbox[4]; -mobj_t *tmthing; +fixed_t tmbbox[4] = {}; +mobj_t *tmthing = NULL; static INT32 tmflags; -fixed_t tmx; -fixed_t tmy; +fixed_t tmx = 0; +fixed_t tmy = 0; // If "floatok" true, move would be ok // if within "tmfloorz - tmceilingz". -boolean floatok; +boolean floatok = false; -fixed_t tmfloorz, tmceilingz; -static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights -mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector -mobj_t *tmhitthing; // the solid thing you bumped into (for collisions) -pslope_t *tmfloorslope, *tmceilingslope; +fixed_t tmfloorz = 0, tmceilingz = 0; +static fixed_t tmdropoffz = 0, tmdrpoffceilz = 0; // drop-off floor/ceiling heights +mobj_t *tmfloorthing = NULL; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector +mobj_t *tmhitthing = NULL; // the solid thing you bumped into (for collisions) +pslope_t *tmfloorslope = NULL, *tmceilingslope = NULL; // keep track of the line that lowers the ceiling, // so missiles don't explode against sky hack walls -line_t *ceilingline; +line_t *ceilingline = NULL; // set by PIT_CheckLine() for any line that stopped the PIT_CheckLine() // that is, for any line which is 'solid' -line_t *blockingline; +line_t *blockingline = NULL; msecnode_t *sector_list = NULL; -camera_t *mapcampointer; +camera_t *mapcampointer = NULL; // // TELEPORT MOVE diff --git a/src/p_mobj.c b/src/p_mobj.c index 86261a644..1813522e7 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -43,7 +43,7 @@ consvar_t cv_splats = {"splats", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #endif -actioncache_t actioncachehead; +actioncache_t actioncachehead = {}; static mobj_t *overlaycap = NULL; static mobj_t *shadowcap = NULL; diff --git a/src/p_saveg.c b/src/p_saveg.c index 46d52917a..7c2bd9e95 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -35,7 +35,7 @@ #include "lua_script.h" #include "p_slopes.h" -savedata_t savedata; +savedata_t savedata = {}; // Block UINT32s to attempt to ensure that the correct data is // being sent and received diff --git a/src/p_setup.c b/src/p_setup.c index b70cdebd6..b81bfd30f 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -92,7 +92,7 @@ // Map MD5, calculated on level load. // Sent to clients in PT_SERVERINFO. // -unsigned char mapmd5[16]; +unsigned char mapmd5[16] = {}; // true when level was loaded from netsave boolean midgamejoin = false; @@ -102,22 +102,22 @@ boolean midgamejoin = false; // Store VERTEXES, LINEDEFS, SIDEDEFS, etc. // -size_t numvertexes, numsegs, numsectors, numsubsectors, numnodes, numlines, numsides, nummapthings; -vertex_t *vertexes; -seg_t *segs; -sector_t *sectors; -subsector_t *subsectors; -node_t *nodes; -line_t *lines; -side_t *sides; -mapthing_t *mapthings; -sector_t *spawnsectors; -line_t *spawnlines; -side_t *spawnsides; -INT32 numstarposts; -boolean levelloading; +size_t numvertexes = 0, numsegs = 0, numsectors = 0, numsubsectors = 0, numnodes = 0, numlines = 0, numsides = 0, nummapthings = 0; +vertex_t *vertexes = NULL; +seg_t *segs = NULL; +sector_t *sectors = NULL; +subsector_t *subsectors = NULL; +node_t *nodes = NULL; +line_t *lines = NULL; +side_t *sides = NULL; +mapthing_t *mapthings = NULL; +sector_t *spawnsectors = NULL; +line_t *spawnlines = NULL; +side_t *spawnsides = NULL; +INT32 numstarposts = 0; +boolean levelloading = false; -virtres_t *curmapvirt; +virtres_t *curmapvirt = NULL; // BLOCKMAP // Created from axis aligned bounding box @@ -127,32 +127,32 @@ virtres_t *curmapvirt; // by spatial subdivision in 2D. // // Blockmap size. -INT32 bmapwidth, bmapheight; // size in mapblocks +INT32 bmapwidth = 0, bmapheight = 0; // size in mapblocks -INT32 *blockmap; // INT32 for large maps +INT32 *blockmap = NULL; // INT32 for large maps // offsets in blockmap are from here -INT32 *blockmaplump; // Big blockmap +INT32 *blockmaplump = NULL; // Big blockmap // origin of block map -fixed_t bmaporgx, bmaporgy; +fixed_t bmaporgx = 0, bmaporgy = 0; // for thing chains -mobj_t **blocklinks; -precipmobj_t **precipblocklinks; +mobj_t **blocklinks = NULL; +precipmobj_t **precipblocklinks = NULL; // REJECT // For fast sight rejection. // Speeds up enemy AI by skipping detailed LineOf Sight calculation. // Without special effect, this could be used as a PVS lookup as well. // -UINT8 *rejectmatrix; +UINT8 *rejectmatrix = NULL; // Maintain single and multi player starting spots. -INT32 numdmstarts, numcoopstarts, numredctfstarts, numbluectfstarts; +INT32 numdmstarts = 0, numcoopstarts = 0, numredctfstarts = 0, numbluectfstarts = 0; -mapthing_t *deathmatchstarts[MAX_DM_STARTS]; -mapthing_t *playerstarts[MAXPLAYERS]; -mapthing_t *bluectfstarts[MAXPLAYERS]; -mapthing_t *redctfstarts[MAXPLAYERS]; +mapthing_t *deathmatchstarts[MAX_DM_STARTS] = {}; +mapthing_t *playerstarts[MAXPLAYERS] = {}; +mapthing_t *bluectfstarts[MAXPLAYERS] = {}; +mapthing_t *redctfstarts[MAXPLAYERS] = {}; // Global state for PartialAddWadFile/MultiSetupWadFiles // Might be replacable with parameters, but non-trivial when the functions are called on separate tics diff --git a/src/p_spec.c b/src/p_spec.c index c7a6dc15f..7332154a8 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -44,7 +44,7 @@ // Not sure if this is necessary, but it was in w_wad.c, so I'm putting it here too -Shadow Hog #include -mobj_t *skyboxmo[2]; +mobj_t *skyboxmo[2] = {}; // Amount (dx, dy) vector linedef is shifted right to get scroll amount #define SCROLL_SHIFT 5 @@ -93,7 +93,7 @@ static void P_AddSpikeThinker(sector_t *sec, INT32 referrer); //SoM: 3/7/2000: New sturcture without limits. -anim_t *lastanim; +anim_t *lastanim = NULL; anim_t *anims = NULL; /// \todo free leak static size_t maxanims; diff --git a/src/p_tick.c b/src/p_tick.c index 35dc25164..d8b21aa86 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -44,7 +44,7 @@ // Dynamic slopes #include "p_slopes.h" -tic_t leveltime; +tic_t leveltime = 0; // // THINKERS @@ -55,8 +55,8 @@ tic_t leveltime; // // Both the head and tail of the thinker list. -thinker_t thinkercap; -thinker_t precipcap; +thinker_t thinkercap = {}; +thinker_t precipcap = {}; void Command_Numthinkers_f(void) { diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 87d775c87..ea0f5c17a 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -26,11 +26,11 @@ #include "qs22j.h" -seg_t *curline; -side_t *sidedef; -line_t *linedef; -sector_t *frontsector; -sector_t *backsector; +seg_t *curline = NULL; +side_t *sidedef = NULL; +line_t *linedef = NULL; +sector_t *frontsector = NULL; +sector_t *backsector = NULL; // very ugly realloc() of drawsegs at run-time, I upped it to 512 // instead of 256.. and someone managed to send me a level with @@ -40,11 +40,11 @@ drawseg_t *drawsegs = NULL; drawseg_t *ds_p = NULL; // indicates doors closed wrt automap bugfix: -INT32 doorclosed; +INT32 doorclosed = 0; // A wall was drawn covering the whole screen, which means we // can block off the BSP across that seg. -boolean g_walloffscreen; +boolean g_walloffscreen = false; boolean R_NoEncore(sector_t *sector, boolean ceiling) { diff --git a/src/r_data.c b/src/r_data.c index 4dc6653ea..da5a81dac 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -83,7 +83,7 @@ typedef struct // a patch or sprite is composed of zero or more columns. // -size_t numspritelumps, max_spritelumps; +size_t numspritelumps = 0, max_spritelumps = 0; // textures INT32 numtextures = 0; // total number of textures found, @@ -110,7 +110,7 @@ UINT8 invertmap[256]; #endif // for debugging/info purposes -size_t flatmemory, spritememory, texturememory; // gotta play by 2.2 rules to get this to work +static size_t flatmemory = 0, spritememory = 0, texturememory = 0; // gotta play by 2.2 rules to get this to work // Blends two pixels together, using the equation // that matches the specified alpha style. diff --git a/src/r_data.h b/src/r_data.h index c77ac8b0e..090c363ed 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -91,8 +91,6 @@ UINT8 *R_GetFlat(lumpnum_t flatnum); void R_InitData(void); void R_PrecacheLevel(void); -extern size_t flatmemory, spritememory, texturememory; - // Retrieval. // Floor/ceiling opaque texture tiles, // lookup by name. For animation? diff --git a/src/r_draw.cpp b/src/r_draw.cpp index c2b0f9e28..f27b0023c 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -41,40 +41,40 @@ /** \brief view info */ -INT32 viewwidth, viewheight, viewwindowx, viewwindowy; +INT32 viewwidth = 0, viewheight = 0, viewwindowx = 0, viewwindowy = 0; // ========================================================================= // COLUMN DRAWING CODE STUFF // ========================================================================= -drawcolumndata_t g_dc; +drawcolumndata_t g_dc = {}; // ----------------------- // translucency stuff here // ----------------------- #define NUMTRANSTABLES 9 // how many translucency tables are used -UINT8 *transtables; // translucency tables -UINT8 *blendtables[NUMBLENDMAPS]; +UINT8 *transtables = NULL; // translucency tables +UINT8 *blendtables[NUMBLENDMAPS] = {}; // -------------------------------------------- // c drawer routines // -------------------------------------------- -coldrawfunc_t *colfunc; -coldrawfunc_t *colfuncs[COLDRAWFUNC_MAX]; -int colfunctype; +coldrawfunc_t *colfunc = NULL; +coldrawfunc_t *colfuncs[COLDRAWFUNC_MAX] = {}; +int colfunctype = 0; // ========================================================================= // SPAN DRAWING CODE STUFF // ========================================================================= -drawspandata_t g_ds; +drawspandata_t g_ds = {}; // Vectors for Software's tilted slope drawers -floatv3_t *ds_su, *ds_sv, *ds_sz; +floatv3_t *ds_su = NULL, *ds_sv = NULL, *ds_sz = NULL; -float focallengthf; +float focallengthf = 0.0f; // For, uh, tilted lighting, duh. //static INT32 *tiltlighting; @@ -83,8 +83,8 @@ float focallengthf; // c drawer routines // -------------------------------------------- -spandrawfunc_t *spanfunc; -spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX]; +spandrawfunc_t *spanfunc = NULL; +spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX] = {}; // ========================================================================== // OLD DOOM FUZZY EFFECT @@ -105,10 +105,10 @@ spandrawfunc_t *spanfuncs[SPANDRAWFUNC_MAX]; #define DEFAULT_STARTTRANSCOLOR 160 #define NUM_PALETTE_ENTRIES 256 -static UINT8 **translationtablecache[TT_CACHE_SIZE] = {NULL}; -static UINT8 **localtranslationtablecache[MAXLOCALSKINS] = {NULL}; +static UINT8 **translationtablecache[TT_CACHE_SIZE] = {}; +static UINT8 **localtranslationtablecache[MAXLOCALSKINS] = {}; -CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1]; +CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1] = {}; struct GenerateBlendTables_State { diff --git a/src/r_main.cpp b/src/r_main.cpp index b6d0e7f0f..1887b0381 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -49,54 +49,54 @@ // increment every time a check is made size_t validcount = 1; -INT32 centerx, centery; +INT32 centerx = 0, centery = 0; -fixed_t centerxfrac, centeryfrac; -fixed_t projection; -fixed_t projectiony; // aspect ratio -fixed_t fovtan; // field of view +fixed_t centerxfrac = 0, centeryfrac = 0; +fixed_t projection = 0; +fixed_t projectiony = 0; // aspect ratio +fixed_t fovtan = 0; // field of view // just for profiling purposes -size_t framecount; +size_t framecount = 0; -size_t loopcount; +size_t loopcount = 0; -fixed_t viewx, viewy, viewz; -angle_t viewangle, aimingangle, viewroll; +fixed_t viewx = 0, viewy = 0, viewz = 0; +angle_t viewangle = 0, aimingangle = 0, viewroll = 0; UINT8 viewssnum = 0; -fixed_t viewcos, viewsin; -boolean skyVisible; -boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible for each splitscreen player -sector_t *viewsector; -player_t *viewplayer; +fixed_t viewcos = 0, viewsin = 0; +boolean skyVisible = 0; +boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS] = {}; // saved values of skyVisible for each splitscreen player +sector_t *viewsector = NULL; +player_t *viewplayer = NULL; -fixed_t renderdeltatics; -boolean renderisnewtic; +fixed_t renderdeltatics = 0; +boolean renderisnewtic = true; // // precalculated math tables // -angle_t clipangle; -angle_t doubleclipangle; +angle_t clipangle = 0; +angle_t doubleclipangle = 0; // The viewangletox[viewangle + FINEANGLES/4] lookup // maps the visible view angles to screen X coordinates, // flattening the arc to a flat projection plane. // There will be many angles mapped to the same X. -INT32 viewangletox[FINEANGLES/2]; +INT32 viewangletox[FINEANGLES/2] = {}; // The xtoviewangleangle[] table maps a screen pixel // to the lowest viewangle that maps back to x ranges // from clipangle to -clipangle. angle_t *xtoviewangle = NULL; -lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE]; -lighttable_t *scalelightfixed[MAXLIGHTSCALE]; -lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ]; +lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE] = {}; +lighttable_t *scalelightfixed[MAXLIGHTSCALE] = {}; +lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ] = {}; // Hack to support extra boom colormaps. -size_t num_extra_colormaps; -extracolormap_t extra_colormaps[MAXCOLORMAPS]; +size_t num_extra_colormaps = 0; +extracolormap_t extra_colormaps[MAXCOLORMAPS] = {}; // Performance stats precise_t ps_prevframetime = 0; diff --git a/src/r_patchrotation.cpp b/src/r_patchrotation.cpp index 5d4b5478c..485a8b9f1 100644 --- a/src/r_patchrotation.cpp +++ b/src/r_patchrotation.cpp @@ -23,8 +23,8 @@ // // Angles precalculated in R_InitSprites. // -fixed_t rollcosang[ROTANGLES]; -fixed_t rollsinang[ROTANGLES]; +fixed_t rollcosang[ROTANGLES] = {}; +fixed_t rollsinang[ROTANGLES] = {}; INT32 R_GetRollAngle(angle_t rollangle) { diff --git a/src/r_portal.c b/src/r_portal.c index 432e3f50d..1a5c7c4a8 100644 --- a/src/r_portal.c +++ b/src/r_portal.c @@ -21,16 +21,16 @@ #include "r_things.h" #include "r_sky.h" -UINT8 portalrender; /**< When rendering a portal, it establishes the depth of the current BSP traversal. */ +UINT8 portalrender = 0; /**< When rendering a portal, it establishes the depth of the current BSP traversal. */ // Linked list for portals. -portal_t *portal_base, *portal_cap; +portal_t *portal_base = NULL, *portal_cap = NULL; -line_t *portalclipline; -sector_t *portalcullsector; -INT32 portalclipstart, portalclipend; +line_t *portalclipline = NULL; +sector_t *portalcullsector = NULL; +INT32 portalclipstart = 0, portalclipend = 0; -portal_t *g_portal; // is curline a portal seg? +portal_t *g_portal = NULL; // is curline a portal seg? void Portal_InitList (void) { diff --git a/src/r_segs.cpp b/src/r_segs.cpp index c6cb63bf5..61eac0c35 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -47,10 +47,10 @@ static INT32 toptexture, bottomtexture, midtexture; static bool topremap, bottomremap, midremap; static INT32 numthicksides, numbackffloors; -angle_t rw_normalangle; +angle_t rw_normalangle = 0; // angle to line origin -angle_t rw_angle1; -fixed_t rw_distance; +angle_t rw_angle1 = 0; +fixed_t rw_distance = 0; // // regular wall diff --git a/src/r_skins.c b/src/r_skins.c index 8a08da7b2..538b8c38a 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -33,7 +33,7 @@ #include "qs22j.h" -CV_PossibleValue_t Forceskin_cons_t[MAXSKINS+2]; // huehuehuehuehue +CV_PossibleValue_t Forceskin_cons_t[MAXSKINS+2] = {}; // huehuehuehuehue #include "discord.h" @@ -55,15 +55,15 @@ UINT8 skinstatscount[9][9] = { {0, 0, 0, 0, 0, 0, 0, 0, 0} }; -UINT8 skinsorted[MAXSKINS]; -skin_t localskins[MAXLOCALSKINS]; -skin_t allskins[MAXSKINS+MAXLOCALSKINS]; +UINT8 skinsorted[MAXSKINS] = {}; +skin_t localskins[MAXLOCALSKINS] = {}; +skin_t allskins[MAXSKINS+MAXLOCALSKINS] = {}; // FIXTHIS: don't work because it must be inistilised before the config load //#define SKINVALUES #ifdef SKINVALUES -CV_PossibleValue_t skin_cons_t[MAXSKINS+1]; -CV_PossibleValue_t localskin_cons_t[MAXLOCALSKINS+1]; +CV_PossibleValue_t skin_cons_t[MAXSKINS+1] = {}; +CV_PossibleValue_t localskin_cons_t[MAXLOCALSKINS+1] = {}; #endif static void Sk_SetDefaultValue(skin_t *skin, boolean local) diff --git a/src/r_sky.c b/src/r_sky.c index 9b0a9262c..795a0f572 100644 --- a/src/r_sky.c +++ b/src/r_sky.c @@ -22,8 +22,6 @@ #include "w_wad.h" #include "z_zone.h" -#include "p_maputl.h" // P_PointOnLineSide - // // sky mapping // @@ -31,28 +29,28 @@ /** \brief Needed to store the number of the dummy sky flat. Used for rendering, as well as tracking projectiles etc. */ -INT32 skyflatnum; +INT32 skyflatnum = 0; /** \brief the lump number of the sky texture */ -INT32 skytexture; +INT32 skytexture = 0; /** \brief the horizon line in a 256x128 sky texture */ -INT32 skytexturemid; +INT32 skytexturemid = 0; /** \brief the x offset of the sky texture */ -INT32 skytextureoffset; +INT32 skytextureoffset = 0; /** \brief the scale of the sky */ -fixed_t skyscale; +fixed_t skyscale = 0; /** \brief used for keeping track of the current sky */ -INT32 levelskynum; -INT32 globallevelskynum; +INT32 levelskynum = 0; +INT32 globallevelskynum = 0; /** \brief The R_SetupSkyDraw function diff --git a/src/r_things.cpp b/src/r_things.cpp index 03eab22c8..3cf92381e 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -95,15 +95,15 @@ static INT32 drawsegs_xrange_count = 0; // There was a lot of stuff grabbed wrong, so I changed it... // -spriteinfo_t spriteinfo[NUMSPRITES]; +spriteinfo_t spriteinfo[NUMSPRITES] = {}; // // INITIALIZATION FUNCTIONS // // variables used to look up and range check thing_t sprites patches -spritedef_t *sprites; -size_t numsprites; +spritedef_t *sprites = NULL; +size_t numsprites = 0; static spriteframe_t sprtemp[64]; static size_t maxframe; @@ -112,7 +112,7 @@ static const char *spritename; // // GAME FUNCTIONS // -UINT32 visspritecount, numvisiblesprites; +UINT32 visspritecount = 0, numvisiblesprites = 0; static UINT32 clippedvissprites; static vissprite_t *visspritechunks[MAXVISSPRITES >> VISSPRITECHUNKBITS] = {NULL}; diff --git a/src/screen.c b/src/screen.c index cae7d2479..f588d0e38 100644 --- a/src/screen.c +++ b/src/screen.c @@ -36,8 +36,8 @@ // ------------------ // global video state // ------------------ -viddef_t vid; -INT32 setmodeneeded; // video mode change needed if > 0 (the mode number to set + 1) +viddef_t vid = {}; +INT32 setmodeneeded = 0; // video mode change needed if > 0 (the mode number to set + 1) static CV_PossibleValue_t shittyscreen_cons_t[] = {{0, "Okay"}, {1, "Shitty"}, {2, "Extra Shitty"}, {0, NULL}}; diff --git a/src/v_video.c b/src/v_video.c index 20c98c154..815583dc5 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -100,7 +100,7 @@ Please check it out if you're trying to maintain this. toast 18/04/17 */ -float Cubepal[2][2][2][3]; +float Cubepal[2][2][2][3] = {}; boolean Cubeapply = false; // returns whether to apply cube, selectively avoiding expensive operations