From b351dd643f11c3d51fae835e7ba4d2ffa1e05cb0 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 24 Mar 2026 01:06:50 +0100 Subject: [PATCH] remove some dead code --- src/dehacked.c | 98 +++++++++++-------------------------------- src/doomstat.h | 42 ++----------------- src/g_game.c | 2 - src/lua_maplib.c | 15 +++---- src/m_cond.c | 25 ++--------- src/m_cond.h | 10 ----- src/p_mobj.c | 26 ------------ src/p_mobj.h | 2 - src/p_setup.c | 105 ----------------------------------------------- src/p_setup.h | 7 ---- src/p_slopes.c | 4 +- src/r_draw.cpp | 2 +- 12 files changed, 38 insertions(+), 300 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 6b09f0d5b..59e9d8276 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -272,7 +272,6 @@ static void clear_levels(void) // (no need to set num to 0, we're freeing the entire header shortly) Z_Free(mapheaderinfo[i]->customopts); - P_DeleteGrades(i); Z_Free(mapheaderinfo[i]); mapheaderinfo[i] = NULL; } @@ -836,22 +835,8 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum) // Now go to uppercase strupr(word2); - // NiGHTS grades - if (fastncmp(word, "GRADES", 6)) - { - UINT8 mare = (UINT8)atoi(word + 6); - - if (mare <= 0 || mare > 8) - { - deh_warning("Level header %d: unknown word '%s'", num, word); - continue; - } - - P_AddGradesForMare((INT16)(num-1), mare-1, word2); - } - // Strings that can be truncated - else if (fastcmp(word, "SCRIPTNAME")) + if (fastcmp(word, "SCRIPTNAME")) { deh_strlcpy(mapheaderinfo[num-1]->scriptname, word2, sizeof(mapheaderinfo[num-1]->scriptname), va("Level header %d: scriptname", num)); @@ -863,10 +848,6 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum) } else if (fastcmp(word, "ACT")) { - /*if (i >= 0 && i < 20) // 0 for no act number, TTL1 through TTL19 - mapheaderinfo[num-1]->actnum = (UINT8)i; - else - deh_warning("Level header %d: invalid act number %d", num, i);*/ deh_strlcpy(mapheaderinfo[num-1]->actnum, word2, sizeof(mapheaderinfo[num-1]->actnum), va("Level header %d: actnum", num)); } @@ -931,11 +912,7 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum) mapheaderinfo[num-1]->mustrack = ((UINT16)i - 1); else if (fastcmp(word, "MUSICPOS")) mapheaderinfo[num-1]->muspos = (UINT32)get_number(word2); - else if (fastcmp(word, "MUSICINTERFADEOUT")) - mapheaderinfo[num-1]->musinterfadeout = (UINT32)get_number(word2); - else if (fastcmp(word, "MUSICINTER")) - deh_strlcpy(mapheaderinfo[num-1]->musintername, word2, - sizeof(mapheaderinfo[num-1]->musintername), va("Level header %d: intermission music", num)); + else if (fastcmp(word, "FORCECHARACTER")) { strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1); @@ -977,44 +954,12 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum) else if (fastcmp(word, "SKYBOXSCALEZ")) mapheaderinfo[num-1]->skybox_scalez = (INT16)i; - else if (fastcmp(word, "BONUSTYPE")) - { - if (fastcmp(word2, "NONE")) i = -1; - else if (fastcmp(word2, "NORMAL")) i = 0; - else if (fastcmp(word2, "BOSS")) i = 1; - else if (fastcmp(word2, "ERZ3")) i = 2; - - if (i >= -1 && i <= 2) // -1 for no bonus. Max is 2. - mapheaderinfo[num-1]->bonustype = (SINT8)i; - else - deh_warning("Level header %d: invalid bonus type number %d", num, i); - } - - else if (fastcmp(word, "SAVEOVERRIDE")) - { - if (fastcmp(word2, "DEFAULT")) i = SAVE_DEFAULT; - else if (fastcmp(word2, "ALWAYS")) i = SAVE_ALWAYS; - else if (fastcmp(word2, "NEVER")) i = SAVE_NEVER; - - if (i >= SAVE_NEVER && i <= SAVE_ALWAYS) - mapheaderinfo[num-1]->saveoverride = (SINT8)i; - else - deh_warning("Level header %d: invalid save override number %d", num, i); - } - else if (fastcmp(word, "LEVELFLAGS")) mapheaderinfo[num-1]->levelflags = get_number(word2); else if (fastcmp(word, "MENUFLAGS")) mapheaderinfo[num-1]->menuflags = get_number(word2); // SRB2Kart - /*else if (fastcmp(word, "AUTOMAP")) - { - if (i || word2[0] == 'T' || word2[0] == 'Y') - mapheaderinfo[num-1]->automap = true; - else - mapheaderinfo[num-1]->automap = false; - }*/ else if (fastcmp(word, "MOBJSCALE")) mapheaderinfo[num-1]->mobj_scale = get_number(word2); else if (fastcmp(word, "LIGHTCONTRAST") || fastcmp(word, "ENCORELIGHTCONTRAST")) @@ -1127,6 +1072,26 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum) else mapheaderinfo[num-1]->menuflags &= ~LF2_NOVISITNEEDED; } + else if (fastcmp(word, "MUSICINTERFADEOUT")) + { + continue; // unused + } + else if (fastcmp(word, "MUSICINTER")) + { + continue; // unused + } + else if (fastcmp(word, "BONUSTYPE")) + { + continue; // unused + } + else if (fastcmp(word, "SAVEOVERRIDE")) + { + continue; // unused + } + else if (fastncmp(word, "GRADES", 6)) // NiGHTS grades + { + continue; // unused + } else deh_warning("Level header %d: unknown word '%s'", num, word); } @@ -1217,7 +1182,6 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) i = atoi(word2); usi = (UINT16)i; - if (fastcmp(word, "NUMBEROFPICS")) { cutscenes[num]->scene[scenenum].numpics = (UINT8)i; @@ -1898,16 +1862,8 @@ static void reademblemdata(MYFILE *f, INT32 num) emblemlocations[num-1].type = ET_GLOBAL; else if (fastcmp(word2, "SKIN")) emblemlocations[num-1].type = ET_SKIN; - /*else if (fastcmp(word2, "SCORE")) - emblemlocations[num-1].type = ET_SCORE;*/ else if (fastcmp(word2, "TIME")) emblemlocations[num-1].type = ET_TIME; - /*else if (fastcmp(word2, "RINGS")) - emblemlocations[num-1].type = ET_RINGS; - else if (fastcmp(word2, "NGRADE")) - emblemlocations[num-1].type = ET_NGRADE; - else if (fastcmp(word2, "NTIME")) - emblemlocations[num-1].type = ET_NTIME;*/ else emblemlocations[num-1].type = (UINT8)value; } @@ -2196,14 +2152,11 @@ static void readcondition(UINT8 set, UINT32 id, char *word2) } else if ((offset=0) || fastcmp(params[0], "GAMECLEAR") || (++offset && fastcmp(params[0], "ALLEMERALDS"))) - //|| (++offset && fastcmp(params[0], "ULTIMATECLEAR"))) { ty = UC_GAMECLEAR + offset; re = (params[1]) ? atoi(params[1]) : 1; } else if ((offset=0) || fastcmp(params[0], "OVERALLTIME")) - //|| (++offset && fastcmp(params[0], "OVERALLSCORE")) - //|| (++offset && fastcmp(params[0], "OVERALLRINGS"))) { PARAMCHECK(1); ty = UC_OVERALLTIME + offset; @@ -2212,8 +2165,6 @@ static void readcondition(UINT8 set, UINT32 id, char *word2) else if ((offset=0) || fastcmp(params[0], "MAPVISITED") || (++offset && fastcmp(params[0], "MAPBEATEN")) || (++offset && fastcmp(params[0], "MAPALLEMERALDS"))) - //|| (++offset && fastcmp(params[0], "MAPULTIMATE")) - //|| (++offset && fastcmp(params[0], "MAPPERFECT"))) { PARAMCHECK(1); ty = UC_MAPVISITED + offset; @@ -2231,8 +2182,6 @@ static void readcondition(UINT8 set, UINT32 id, char *word2) } } else if ((offset=0) || fastcmp(params[0], "MAPTIME")) - //|| (++offset && fastcmp(params[0], "MAPSCORE")) - //|| (++offset && fastcmp(params[0], "MAPRINGS"))) { PARAMCHECK(2); ty = UC_MAPTIME + offset; @@ -2615,7 +2564,7 @@ static void readmaincfg(MYFILE *f) } else if (fastcmp(word, "MAXXTRALIFE")) { - maxXtraLife = (UINT8)get_number(word2); + continue; // unused } else if (fastcmp(word, "GAMEDATA")) { @@ -2645,6 +2594,7 @@ static void readmaincfg(MYFILE *f) strcatbf(savegamename, srb2home, PATHSEP); refreshdirmenu |= REFRESHDIR_GAMEDATA;*/ + continue; } else if (fastcmp(word, "RESETDATA")) { diff --git a/src/doomstat.h b/src/doomstat.h index 80f86b974..f8216cc1e 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -205,12 +205,6 @@ extern struct quake fixed_t radius, intensity; } quake; -// NiGHTS grades -typedef struct -{ - UINT32 grade[6]; // D, C, B, A, S, X (F: failed to reach any of these) -} nightsgrades_t; - // Custom Lua values // (This is not ifdeffed so the map header structure can stay identical, just in case.) typedef struct @@ -261,28 +255,16 @@ typedef struct UINT8 numlaps; ///< Number of laps in circuit mode, unless overridden. SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no. UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in? - SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.) - SINT8 saveoverride; ///< Set how the game is allowed to save (1 for always, -1 for never, 0 is 2.1 default) - UINT8 levelflags; ///< LF_flags: merged eight booleans into one UINT8 for space, see below UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus - // NiGHTS stuff. - UINT8 numGradedMares; ///< Internal. For grade support. - nightsgrades_t *grades; ///< NiGHTS grades. Allocated dynamically for space reasons. Be careful. - // SRB2kart - //boolean automap; ///< Displays a level's white map outline in modified games 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 boolean use_encore_lighting; ///< Whether to use separate Encore lighting - // Music stuff. - UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds - char musintername[7]; ///< Intermission screen music. - // Lua stuff. // (This is not ifdeffed so the map header structure can stay identical, just in case.) UINT8 numCustomOptions; ///< Internal. For Lua custom value support. @@ -379,8 +361,6 @@ typedef struct { tic_t time; ///< Time in which the level was finished. tic_t lap; ///< Best lap time for this level. - //UINT32 score; ///< Score when the level was finished. - //UINT16 rings; ///< Rings when the level was finished. } recorddata_t; /** Setup for one NiGHTS map. @@ -394,34 +374,19 @@ typedef struct #define GRADE_A 5 #define GRADE_S 6 -/*typedef struct -{ - // 8 mares, 1 overall (0) - UINT8 nummares; - UINT32 score[9]; - UINT8 grade[9]; - tic_t time[9]; -} nightsdata_t;*/ - -//extern nightsdata_t *nightsrecords[NUMMAPS]; extern recorddata_t *mainrecords[NUMMAPS]; // mapvisited is now a set of flags that says what we've done in the map. #define MV_VISITED 1 #define MV_BEATEN 2 #define MV_ALLEMERALDS 4 -//#define MV_ULTIMATE 8 -//#define MV_PERFECT 16 #define MV_MAX 7 // used in gamedata check extern UINT8 mapvisited[NUMMAPS]; -// Temporary holding place for nights data for the current map -//nightsdata_t ntemprecords; - -extern UINT32 token; ///< Number of tokens collected in a level +extern UINT32 token; ///< Number of tokens collected in a level extern UINT32 tokenlist; ///< List of tokens collected -extern INT32 tokenbits; ///< Used for setting token bits -extern INT32 sstimer; ///< Time allotted in the special stage +extern INT32 tokenbits; ///< Used for setting token bits +extern INT32 sstimer; ///< Time allotted in the special stage extern UINT32 bluescore; ///< Blue Team Scores extern UINT32 redscore; ///< Red Team Scores @@ -461,7 +426,6 @@ extern UINT8 introtoplay; extern UINT8 creditscutscene; extern UINT8 use1upSound; -extern UINT8 maxXtraLife; // Max extra lives from rings extern mobj_t *hunt1, *hunt2, *hunt3; // Emerald hunt locations diff --git a/src/g_game.c b/src/g_game.c index 90334aa7b..26e3d3df5 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -98,7 +98,6 @@ boolean savemoddata = false; UINT8 paused = 0; UINT8 modeattacking = ATTACKING_NONE; boolean imcontinuing = false; -boolean runemeraldmanager = false; boolean netgame = false; // only true if packets are broadcast boolean multiplayer = false; @@ -211,7 +210,6 @@ const INT32 wantedfrequency = 10*TICRATE; INT32 gameovertics = 15*TICRATE; UINT8 use1upSound = 0; -UINT8 maxXtraLife = 2; // Max extra lives from rings UINT8 introtoplay = 0; UINT8 creditscutscene = 0; diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 2931e9a16..606d54383 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1506,7 +1506,6 @@ enum mapheaderinfo_e mapheaderinfo_saveoverride, mapheaderinfo_levelflags, mapheaderinfo_menuflags, - //mapheaderinfo_automap, mapheaderinfo_mobj_scale, }; @@ -1542,7 +1541,6 @@ static const char *const mapheaderinfo_opt[] = { "saveoverride", "levelflags", "menuflags", - //"automap", "mobj_scale", NULL, }; @@ -1584,10 +1582,11 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->muspos); break; case mapheaderinfo_musinterfadeout: - lua_pushinteger(L, header->musinterfadeout); + lua_pushinteger(L, 0); // unused break; case mapheaderinfo_musintername: - lua_pushstring(L, header->musintername); + // uhh psure its fine to just push nil instead of empty string? + lua_pushstring(L, NULL); break; case mapheaderinfo_forcecharacter: lua_pushstring(L, header->forcecharacter); @@ -1641,10 +1640,10 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->levelselect); break; case mapheaderinfo_bonustype: - lua_pushinteger(L, header->bonustype); + lua_pushinteger(L, 0); // unused break; case mapheaderinfo_saveoverride: - lua_pushinteger(L, header->saveoverride); + lua_pushinteger(L, SAVE_DEFAULT); // unused break; case mapheaderinfo_levelflags: lua_pushinteger(L, header->levelflags); @@ -1652,13 +1651,9 @@ static int mapheaderinfo_get(lua_State *L) case mapheaderinfo_menuflags: lua_pushinteger(L, header->menuflags); break; - /*case mapheaderinfo_automap: - lua_pushstring(L, header->selectheading); - break;*/ case mapheaderinfo_mobj_scale: lua_pushfixed(L, header->mobj_scale); break; - // TODO add support for reading numGradedMares and grades default: { // Read custom vars now diff --git a/src/m_cond.c b/src/m_cond.c index c22c966f3..85c0b5ee2 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -479,32 +479,13 @@ UINT8 M_CheckLevelEmblems(void) // Update Score, Time, Rings emblems for (i = 0; i < numemblems; ++i) { - if (emblemlocations[i].type <= ET_SKIN || emblemlocations[i].collected) + // Requires time on map <= x + if (emblemlocations[i].type != ET_TIME || emblemlocations[i].collected) continue; levelnum = emblemlocations[i].level; valToReach = emblemlocations[i].var; - - switch (emblemlocations[i].type) - { - /*case ET_SCORE: // Requires score on map >= x - res = (G_GetBestScore(levelnum) >= (unsigned)valToReach); - break;*/ - case ET_TIME: // Requires time on map <= x - res = (G_GetBestTime(levelnum) <= (unsigned)valToReach); - break; - /*case ET_RINGS: // Requires rings on map >= x - res = (G_GetBestRings(levelnum) >= valToReach); - break; - case ET_NGRADE: // Requires NiGHTS grade on map >= x - res = (G_GetBestNightsGrade(levelnum, 0) >= valToReach); - break; - case ET_NTIME: // Requires NiGHTS time on map <= x - res = (G_GetBestNightsTime(levelnum, 0) <= (unsigned)valToReach); - break;*/ - default: // unreachable but shuts the compiler up. - continue; - } + res = (G_GetBestTime(levelnum) <= (unsigned)valToReach); emblemlocations[i].collected = res; if (res) diff --git a/src/m_cond.h b/src/m_cond.h index 06bf30faf..48ff8b9c5 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -27,21 +27,11 @@ typedef enum UC_MATCHESPLAYED, // SRB2Kart: MATCHESPLAYED [x played] UC_GAMECLEAR, // GAMECLEAR UC_ALLEMERALDS, // ALLEMERALDS - //UC_ULTIMATECLEAR, // ULTIMATECLEAR - //UC_OVERALLSCORE, // OVERALLSCORE [score to beat] UC_OVERALLTIME, // OVERALLTIME [time to beat, tics] - //UC_OVERALLRINGS, // OVERALLRINGS [rings to beat] UC_MAPVISITED, // MAPVISITED [map number] UC_MAPBEATEN, // MAPBEATEN [map number] UC_MAPALLEMERALDS, // MAPALLEMERALDS [map number] - //UC_MAPULTIMATE, // MAPULTIMATE [map number] - //UC_MAPPERFECT, // MAPPERFECT [map number] - //UC_MAPSCORE, // MAPSCORE [map number] [score to beat] UC_MAPTIME, // MAPTIME [map number] [time to beat, tics] - //UC_MAPRINGS, // MAPRINGS [map number] [rings to beat] - //UC_NIGHTSSCORE, // NIGHTSSCORE [map number] [score to beat] - //UC_NIGHTSTIME, // NIGHTSTIME [map number] [time to beat, tics] - //UC_NIGHTSGRADE, // NIGHTSGRADE [map number] [grade] UC_TRIGGER, // TRIGGER [trigger number] UC_TOTALEMBLEMS, // TOTALEMBLEMS [number of emblems] UC_EMBLEM, // EMBLEM [emblem number] diff --git a/src/p_mobj.c b/src/p_mobj.c index 2351b8884..697612d88 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3284,30 +3284,6 @@ static boolean P_CameraCheckWater(camera_t *thiscam) return false; } -void P_DestroyRobots(void) -{ - // Search through all the thinkers for enemies. - mobj_t *mo; - thinker_t *think; - - for (think = thinkercap.next; think != &thinkercap; think = think->next) - { - if (think->function != (actionf_p1)P_MobjThinker) - continue; // not a mobj thinker - - mo = (mobj_t *)think; - - if (mo->health <= 0 || !(mo->flags & MF_ENEMY || mo->flags & MF_BOSS)) - continue; // not a valid enemy - - if (mo->type == MT_PLAYER) // Don't chase after other players! - continue; - - // Found a target enemy - P_KillMobj(mo, players[consoleplayer].mo, players[consoleplayer].mo); - } -} - // the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person void P_CalcChasePostImg(player_t *player, camera_t *thiscam) { @@ -11234,8 +11210,6 @@ void P_SpawnMapThing(mapthing_t *mthing) { if (!cv_powerstones.value || !G_BattleGametype()) return; - - runemeraldmanager = true; } if (!G_RaceGametype()) // No enemies in match or CTF modes diff --git a/src/p_mobj.h b/src/p_mobj.h index 201ae3fa8..68355aefc 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -509,7 +509,6 @@ void P_SpawnPrecipitation(void); void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, statenum_t nstate, angle_t rotangle, boolean spawncenter); boolean P_BossTargetPlayer(mobj_t *actor, boolean closest); boolean P_SupermanLook4Players(mobj_t *actor); -void P_DestroyRobots(void); boolean P_PrecipThinker(precipmobj_t *mobj); void P_NullPrecipThinker(precipmobj_t *mobj); void P_FreePrecipMobj(precipmobj_t *mobj); @@ -520,7 +519,6 @@ void P_EmeraldManager(void); #define MAXHUNTEMERALDS 64 extern mapthing_t *huntemeralds[MAXHUNTEMERALDS]; extern INT32 numhuntemeralds; -extern boolean runemeraldmanager; extern INT32 numstarposts; #ifdef __cplusplus diff --git a/src/p_setup.c b/src/p_setup.c index 8ce67c21b..6483e00ef 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -218,8 +218,6 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) mapheaderinfo[num]->musname[6] = 0; mapheaderinfo[num]->mustrack = 0; mapheaderinfo[num]->muspos = 0; - mapheaderinfo[num]->musinterfadeout = 0; - mapheaderinfo[num]->musintername[0] = '\0'; mapheaderinfo[num]->forcecharacter[0] = '\0'; mapheaderinfo[num]->weather = 0; mapheaderinfo[num]->skynum = 1; @@ -237,16 +235,10 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) mapheaderinfo[num]->numlaps = NUMLAPS_DEFAULT; mapheaderinfo[num]->unlockrequired = -1; mapheaderinfo[num]->levelselect = 0; - mapheaderinfo[num]->bonustype = 0; - 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; mapheaderinfo[num]->customopts = NULL; @@ -266,107 +258,11 @@ void P_AllocMapHeader(INT16 i) if (!mapheaderinfo[i]) { mapheaderinfo[i] = Z_Malloc(sizeof(mapheader_t), PU_STATIC, NULL); - mapheaderinfo[i]->grades = NULL; } P_ClearSingleMapHeaderInfo(i + 1); } -/** NiGHTS Grades are a special structure, - * we initialize them here. - * - * \param i Index of header to allocate grades for - * \param mare The mare we're adding grades for - * \param grades the string from DeHackEd, we work with it ourselves - */ -void P_AddGradesForMare(INT16 i, UINT8 mare, char *gtext) -{ - INT32 g; - char *spos = gtext; - - CONS_Debug(DBG_SETUP, "Map %d Mare %d: ", i+1, (UINT16)mare+1); - - if (mapheaderinfo[i]->numGradedMares < mare+1) - { - mapheaderinfo[i]->numGradedMares = mare+1; - mapheaderinfo[i]->grades = Z_Realloc(mapheaderinfo[i]->grades, sizeof(nightsgrades_t) * mapheaderinfo[i]->numGradedMares, PU_STATIC, NULL); - } - - for (g = 0; g < 6; ++g) - { - // Allow "partial" grading systems - if (spos != NULL) - { - mapheaderinfo[i]->grades[mare].grade[g] = atoi(spos); - CONS_Debug(DBG_SETUP, "%u ", atoi(spos)); - // Grab next comma - spos = strchr(spos, ','); - if (spos) - ++spos; - } - else - { - // Grade not reachable - mapheaderinfo[i]->grades[mare].grade[g] = UINT32_MAX; - } - } - - CONS_Debug(DBG_SETUP, "\n"); -} - -/** And this removes the grades safely. - * - * \param i The header to remove grades from - */ -void P_DeleteGrades(INT16 i) -{ - Z_Free(mapheaderinfo[i]->grades); - mapheaderinfo[i]->grades = NULL; - mapheaderinfo[i]->numGradedMares = 0; -} - -/** And this fetches the grades - * - * \param pscore The player's score. - * \param map The game map. - * \param mare The mare to test. - */ -UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare) -{ - INT32 i; - - // Determining the grade - if (mapheaderinfo[map-1] && mapheaderinfo[map-1]->grades && mapheaderinfo[map-1]->numGradedMares >= mare + 1) - { - INT32 pgrade = 0; - for (i = 0; i < 6; ++i) - { - if (pscore >= mapheaderinfo[map-1]->grades[mare].grade[i]) - ++pgrade; - } - - return (UINT8)pgrade; - } - - return 0; -} - -UINT8 P_HasGrades(INT16 map, UINT8 mare) -{ - // Determining the grade - // Mare 0 is treated as overall and is true if ANY grades exist - return (mapheaderinfo[map-1] && mapheaderinfo[map-1]->grades - && (mare == 0 || mapheaderinfo[map-1]->numGradedMares >= mare)); -} - -UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade) -{ - // Get the score for the grade... if it exists - if (grade == GRADE_F || grade > GRADE_S || !P_HasGrades(map, mare)) return 0; - - return mapheaderinfo[map-1]->grades[mare].grade[grade-1]; -} - // Loads the vertexes for a level. FUNCINLINE static ATTRINLINE void P_LoadVertices(UINT8 *data) { @@ -2050,7 +1946,6 @@ static void P_LevelInitStuff(boolean reloadinggamestate) // special stage tokens, emeralds, and ring total tokenbits = 0; - runemeraldmanager = false; nummaprings = nummapboxes = numgotboxes = 0; // emerald hunt diff --git a/src/p_setup.h b/src/p_setup.h index 7827ebbe6..c5ad15d44 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -114,13 +114,6 @@ size_t P_PrecacheLevelFlats(void); void P_AllocMapHeader(INT16 i); -// Needed for NiGHTS -void P_DeleteGrades(INT16 i); -void P_AddGradesForMare(INT16 i, UINT8 mare, char *gtext); -UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare); -UINT8 P_HasGrades(INT16 map, UINT8 mare); -UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade); - #ifdef __cplusplus } // extern "C" #endif diff --git a/src/p_slopes.c b/src/p_slopes.c index b3f4592d6..627052236 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -76,8 +76,8 @@ static void P_UpdateSlopeLightOffset(pslope_t *slope) */ light = FixedMul(nX, FINECOSINE(maplighting.angle >> ANGLETOFINESHIFT)) - + FixedMul(nY, FINESINE(maplighting.angle >> ANGLETOFINESHIFT)); - light = (light + FRACUNIT) / 2; + + FixedMul(nY, FINESINE(maplighting.angle >> ANGLETOFINESHIFT)); + light = (light + FRACUNIT) / 2; } else { diff --git a/src/r_draw.cpp b/src/r_draw.cpp index d49cbbc84..eb84704d9 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -406,7 +406,7 @@ static UINT8* RGetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 f case TC_ALLWHITE: skintableindex = ALLWHITE_TT_CACHE_INDEX; break; case TC_RAINBOW: skintableindex = RAINBOW_TT_CACHE_INDEX; break; case TC_BLINK: skintableindex = BLINK_TT_CACHE_INDEX; break; - default: skintableindex = skinnum; break; + default: skintableindex = skinnum; break; } }