From 987d18fe992418007891a837d15a9f00d0fa3a67 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 24 Apr 2025 09:24:37 +0200 Subject: [PATCH] memset those --- src/doomstat.h | 4 ++-- src/p_setup.c | 26 ++++++++++++++++++++------ src/r_things.c | 7 ++++--- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/doomstat.h b/src/doomstat.h index f6e708be6..54c6ae320 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -244,7 +244,7 @@ typedef struct INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end. char musname[7]; ///< Music track to play. "" for no music. UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. - UINT32 muspos; ///< Music position to jump to. + UINT32 muspos; ///< Music position to jump to. char forcecharacter[17]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable. UINT8 weather; ///< 0 = sunny day, 1 = storm, 2 = snow, 3 = rain, 4 = blank, 5 = thunder w/o rain, 6 = rain w/o lightning, 7 = heat wave. INT16 skynum; ///< Sky number to use. @@ -276,7 +276,7 @@ typedef struct // SRB2kart //boolean automap; ///< Displays a level's white map outline in modified games - fixed_t mobj_scale; ///< Replacement for TOL_ERZ3 + fixed_t mobj_scale; ///< Replacement for TOL_ERZ3 mapheader_lighting_t lighting; ///< Wall and sprite lighting mapheader_lighting_t lighting_encore; ///< Alternative lighting for Encore mode diff --git a/src/p_setup.c b/src/p_setup.c index e4c22f253..b51a8abce 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -296,6 +296,7 @@ static void P_ClearMapHeaderLighting(mapheader_lighting_t *lighting) static void P_ClearSingleMapHeaderInfo(INT16 i) { const INT16 num = (INT16)(i-1); + mapheaderinfo[num]->lvlttl[0] = '\0'; mapheaderinfo[num]->subttl[0] = '\0'; mapheaderinfo[num]->zonttl[0] = '\0'; @@ -329,8 +330,10 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) mapheaderinfo[num]->saveoverride = SAVE_DEFAULT; mapheaderinfo[num]->levelflags = 0; mapheaderinfo[num]->menuflags = (mainwads ? 0 : LF2_EXISTSHACK); // see p_setup.c - prevents replacing maps in addons with easier versions + // TODO grades support for delfile (pfft yeah right) P_DeleteGrades(num); + // SRB2Kart //mapheaderinfo[num]->automap = false; mapheaderinfo[num]->mobj_scale = FRACUNIT; @@ -752,7 +755,7 @@ INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat) // first scan through the already found flats // for (i = 0; i < numlevelflats; i++, levelflat++) - if (strnicmp(levelflat->name,flatname,8)==0) + if (strnicmp(levelflat->name,flatname,8) == 0) break; // that flat was already found in the level, return the id @@ -947,6 +950,7 @@ static void P_LoadRawNodes(UINT8 *data) no->y = SHORT(mn->y)<dx = SHORT(mn->dx)<dy = SHORT(mn->dy)<children[j] = SHORT(mn->children[j]); @@ -2376,10 +2380,14 @@ static INT32 P_MakeBufferMD5(const char *buffer, size_t len, void *resblock) return 1; #else tic_t t = I_GetTime(); + CONS_Debug(DBG_SETUP, "Making MD5\n"); + if (md5_buffer(buffer, len, resblock) == NULL) return 1; + CONS_Debug(DBG_SETUP, "MD5 calc took %f seconds\n", (float)(I_GetTime() - t)/NEWTICRATE); + return 0; #endif } @@ -2460,6 +2468,7 @@ static void P_RunLevelScript(const char *scriptname) { COM_BufAddText(va("exec %s\n", scriptname)); } + COM_BufExecute(); // Run it! } @@ -2760,7 +2769,7 @@ static boolean P_RunSpecialWipe(boolean reloadinggamestate) F_WipeEndScreen(); F_RunWipe(wipedefs[wipe_level_final], false); } - else //dedicated servers can call this now, to wait the appropriate amount of time for clients to wipe + else // dedicated servers can call this now, to wait the appropriate amount of time for clients to wipe { F_RunWipe(wipedefs[wipe_speclevel_towhite], false); F_RunWipe(wipedefs[wipe_level_final], false); @@ -2778,7 +2787,9 @@ static boolean P_RunSpecialWipe(boolean reloadinggamestate) I_Sleep(cv_sleep.value); I_UpdateTime(cv_timescale.value); } + lastwipetic = nowtime; + if (moviemode) // make sure we save frames for the white hold too M_SaveFrame(); @@ -2797,6 +2808,7 @@ static void P_SetupPlayer(void) INT32 i; for (i = 0; i < MAXPLAYERS; i++) + { if (playeringame[i]) { players[i].pflags &= ~PF_NIGHTSMODE; @@ -2821,6 +2833,7 @@ static void P_SetupPlayer(void) G_SpawnPlayer(i, false); } } + } if (modeattacking == ATTACKING_RECORD && !demo.playback) P_LoadRecordGhosts(); @@ -3077,10 +3090,8 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate) numdmstarts = numredctfstarts = numbluectfstarts = 0; // reset the player starts - for (i = 0; i < MAXPLAYERS; i++) - playerstarts[i] = NULL; - for (i = 0; i < 2; i++) - skyboxmo[i] = NULL; + memset(playerstarts, 0, sizeof(playerstarts)); + memset(skyboxmo, 0, sizeof(skyboxmo)); P_ResetWaypoints(); @@ -3180,12 +3191,15 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate) if (!fromnetsave) // uglier hack { // to make a newly loaded level start on the second frame. INT32 buf = gametic % TICQUEUE; + for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i]) G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1); } + P_PreTicker(2); + if (!reloadinggamestate) LUA_HookInt(gamemap, HOOK(MapLoad)); } diff --git a/src/r_things.c b/src/r_things.c index e2c3c2c76..45afd824d 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -3096,7 +3096,7 @@ INT32 R_SkinAvailable(const char *name) for (i = 0; i < numskins; i++) { - if (stricmp(skins[i].name,name)==0) + if (stricmp(skins[i].name,name) == 0) return i; } return -1; @@ -3110,7 +3110,7 @@ INT32 R_AnySkinAvailable(const char *name) for (i = 0; i < numallskins; i++) { - if (stricmp(allskins[i].name,name)==0) + if (stricmp(allskins[i].name,name) == 0) return i; } return -1; @@ -3124,7 +3124,7 @@ INT32 R_LocalSkinAvailable(const char *name, boolean local) { for (i = 0; i < numlocalskins; i++) { - if (stricmp(localskins[i].name,name)==0) + if (stricmp(localskins[i].name,name) == 0) return i; } return -1; @@ -3258,6 +3258,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum) CONS_Alert(CONS_WARNING, M_GetText("Skin %d not found\n"), skinnum); else if(server || IsPlayerAdmin(consoleplayer)) CONS_Alert(CONS_WARNING, "Player %d (%s) skin %d not found\n", playernum, player_names[playernum], skinnum); + SetPlayerSkinByNum(playernum, 0); // not found put the sonic skin }