diff --git a/src/Makefile b/src/Makefile index 63386f188..116595868 100644 --- a/src/Makefile +++ b/src/Makefile @@ -93,7 +93,10 @@ ifeq ($(OS),Windows_NT) # all windows are Windows_NT... WINDOWSHELL=1 NOOBJDUMP=1 + NOBLUAJIT=1 + else # if you on the *nix + NOBLUAJIT=1 system:=$(shell uname -s) ifeq ($(system),Linux) diff --git a/src/console.c b/src/console.c index 3212521b0..f1c8efcc2 100644 --- a/src/console.c +++ b/src/console.c @@ -827,7 +827,7 @@ boolean CON_Responder(event_t *ev) // let go keyup events, don't eat them if (ev->type != ev_keydown && ev->type != ev_console) { - if (ev->data1 == gamecontrol[gc_console][0] || ev->data1 == gamecontrol[gc_console][1]) + if (ev->data1 == gamecontrol[0][gc_console][0] || ev->data1 == gamecontrol[0][gc_console][1]) consdown = false; return false; } @@ -845,7 +845,7 @@ boolean CON_Responder(event_t *ev) INT32 i; for (i = 0; i < num_gamecontrols; i++) { - if (gamecontrol[i][0] == ev->data1 || gamecontrol[i][1] == ev->data1) + if (gamecontrol[0][i][0] == ev->data1 || gamecontrol[0][i][1] == ev->data1) break; } @@ -853,7 +853,7 @@ boolean CON_Responder(event_t *ev) return false; } - if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1]) + if (key == gamecontrol[0][gc_console][0] || key == gamecontrol[0][gc_console][1]) { if (consdown) // ignore repeat return true; diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 4a2a0cc0f..51abad01d 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2261,13 +2261,13 @@ static void M_ConfirmConnect(event_t *ev) #ifndef NONET if (ev->type == ev_keydown) { - if (ev->data1 == ' ' || ev->data1 == 'y' || ev->data1 == KEY_ENTER || ev->data1 == gamecontrol[gc_accelerate][0] || ev->data1 == gamecontrol[gc_accelerate][1]) + if (ev->data1 == ' ' || ev->data1 == 'y' || ev->data1 == KEY_ENTER || ev->data1 == gamecontrol[0][gc_accelerate][0] || ev->data1 == gamecontrol[0][gc_accelerate][1]) { CL_ConfirmConnect(); M_ClearMenus(true); } - else if (ev->data1 == 'n' || ev->data1 == KEY_ESCAPE|| ev->data1 == gamecontrol[gc_brake][0] || ev->data1 == gamecontrol[gc_brake][1]) + else if (ev->data1 == 'n' || ev->data1 == KEY_ESCAPE|| ev->data1 == gamecontrol[0][gc_brake][0] || ev->data1 == gamecontrol[0][gc_brake][1]) { cl_mode = CL_ABORTED; M_ClearMenus(true); @@ -6305,7 +6305,8 @@ static void Local_Maketic(INT32 realtics) D_ProcessEvents(); // menu responder, cons responder, // game responder calls HU_Responder, AM_Responder, F_Responder, // and G_MapEventsToControls - if (!dedicated) rendergametic = gametic; + if (!dedicated) + rendergametic = gametic; // translate inputs (keyboard/mouse/joystick) into game controls for (i = 0; i <= splitscreen; i++) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b380b8d76..83edad6b1 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2687,7 +2687,8 @@ static tic_t last_map_cmd = 0; // static void Command_Map_f(void) { - if (I_GetTime() - last_map_cmd < 20) { + if (I_GetTime() - last_map_cmd < 20) + { CONS_Alert(CONS_WARNING, "Map command is used too frequently!\n"); return; } @@ -2745,8 +2746,7 @@ static void Command_Map_f(void) { if (!multiplayer) { - CONS_Printf(M_GetText( - "You can't switch gametypes in single player!\n")); + CONS_Printf(M_GetText("You can't switch gametypes in single player!\n")); return; } else if (COM_Argc() < option_gametype + 2)/* no argument after? */ @@ -4445,7 +4445,7 @@ static void Command_Addfilelocal(void) // Add any wad file, ignoring checks for if it contains complex things like // lua. Great for complex but client-side customizations, like different // level cards or anything like that. - P_AddWadFileLocal(fn); + P_AddWadFile(fn, true); } @@ -4540,38 +4540,9 @@ static void Command_Addfile(void) /** Adds something at runtime. */ -static void -Command_Addskins (void) +static void Command_Addskins(void) { - if (COM_Argc() > 3) - { - CONS_Printf( - "addskins : Load a skin file.\n"); - return; - } - // no forcing? - /* - if (fasticmp(COM_Argv(2), "-force") || fasticmp(COM_Argv(2), "-f")) { - CONS_Alert(CONS_NOTICE, M_GetText("Adding file %s. May or may not be a skin.\n"), COM_Argv(1)); - P_AddWadFile(COM_Argv(1), 0, true); - } else { - if (DumbStartsWith("KC_", COM_Argv(1))) { - P_AddWadFile(COM_Argv(1), 0, true); - } else if (DumbStartsWith("KCL_", COM_Argv(1))) { - if (!demo.playback) { - CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is a skin with lua. Include -force or -f to force it to load.\n"), COM_Argv(1)); - return; - } else { - */ - P_AddWadFile(COM_Argv(1), true); - /* - } - } else { - CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is not a skin.\n"), COM_Argv(1)); - return; - } - } - */ + CONS_Printf("addskins has been deprecated\nuse addfilelocal instead!\n"); } static void Command_GLocalSkin (void) @@ -4587,7 +4558,7 @@ static void Command_GLocalSkin (void) char* fuck; // local skin name - if (!( first_option = COM_FirstOption() )) + if (!(first_option = COM_FirstOption())) first_option = COM_Argc(); if (first_option < 2) @@ -4595,14 +4566,14 @@ static void Command_GLocalSkin (void) /* holy fucking shit */ CONS_Printf("localskin [-player ] [-display ] [-all]:\n"); CONS_Printf(M_GetText("Set a localskin via its internal name (usually printed on the console).\n\n\ -* Using \"-player\" will set a localskin to a specified player.\n\ - Defaults to yourself.\n\ -* Using \"-display\" will set a localskin to the displayed player.\n\ - Defaults to 0, which is the first player displayed.\n\ - Can go up to 3 for splitscreen.\n\ -* Using \"-all\" will set a localskin to ALL players.\n\ -* \"localskin none\" removes the localskin, just like how\n\ - \"forceskin none\" does.\n")); + * Using \"-player\" will set a localskin to a specified player.\n\ + Defaults to yourself.\n\ + * Using \"-display\" will set a localskin to the displayed player.\n\ + Defaults to 0, which is the first player displayed.\n\ + Can go up to 3 for splitscreen.\n\ + * Using \"-all\" will set a localskin to ALL players.\n\ + * \"localskin none\" removes the localskin, just like how\n\ + \"forceskin none\" does.\n")); return; } diff --git a/src/d_player.h b/src/d_player.h index a1e4a0b20..af24630c2 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -356,6 +356,16 @@ typedef enum LAP__MAX } laptime_e; +// yes i made a whole struct for this :chonkbuncle: +typedef struct squishdance_s +{ + tic_t countdown; // hold "custom 3" for 2 seconds to engange le dance + tic_t time; + fixed_t work; + fixed_t ang; + fixed_t bounce; // hehe squishy +} squishdance_t; + // ======================================================================== // PLAYER STRUCTURE // ======================================================================== @@ -555,7 +565,7 @@ typedef struct player_s fixed_t spinoutrot; // When a player spins out, this value increments modulus 360. - tic_t dancetime; + squishdance_t squishdance; fixed_t fovadd; // adjust FOV for hw rendering } player_t; diff --git a/src/dehacked.c b/src/dehacked.c index fd90c380e..1a84108fd 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1414,6 +1414,9 @@ static void readhuditem(MYFILE *f, INT32 num) // IMPORTANT! // DO NOT FORGET TO SYNC THIS LIST WITH THE ACTIONNUM ENUM IN INFO.H + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wincompatible-pointer-types" actionpointer_t actionpointers[] = { {{A_Explode}, "A_EXPLODE"}, @@ -1622,6 +1625,7 @@ actionpointer_t actionpointers[] = // This NULL entry must be the last in the list {{NULL}, NULL}, }; +#pragma GCC diagnostic pop static void readframe(MYFILE *f, INT32 num) { 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/g_game.c b/src/g_game.c index 7acda852e..0712a49e5 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1277,7 +1277,8 @@ static void G_DoLoadLevel(boolean resetplayer) // clear cmd building stuff memset(gamekeydown, 0, sizeof (gamekeydown)); - for (i = 0;i < JOYAXISSET; i++) + + for (i = 0; i < JOYAXISSET; i++) { joyxmove[i] = joyymove[i] = 0; joy2xmove[i] = joy2ymove[i] = 0; @@ -1298,92 +1299,32 @@ static INT32 pausedelay = 0; static INT32 camtoggledelay[MAXSPLITSCREENPLAYERS] = {0,0,0,0}; static INT32 spectatedelay[MAXSPLITSCREENPLAYERS] = {0,0,0,0}; -// -// G_Responder -// Get info needed to make ticcmd_ts for the players. -// -boolean G_Responder(event_t *ev) +static void G_ToggleSpectate(INT32 player) { - // any other key pops up menu if in demos - if (gameaction == ga_nothing && !demo.quitafterplaying && - ((demo.playback && !modeattacking && !demo.title && !multiplayer) || gamestate == GS_TITLESCREEN)) + switch (player) { - if (ev->type == ev_keydown && ev->data1 != 301) - { - M_StartControlPanel(); - return true; - } - return false; - } - else if (demo.playback && demo.title) - { - // Title demo uses intro responder - if (F_IntroResponder(ev)) - { - // stop the title demo - G_CheckDemoStatus(); - return true; - } - return false; + case 0: + COM_ImmedExecute("changeteam spectator"); + break; + case 1: + COM_ImmedExecute("changeteam2 spectator"); + break; + case 2: + COM_ImmedExecute("changeteam3 spectator"); + break; + case 3: + COM_ImmedExecute("changeteam4 spectator"); + break; } +} - if (gamestate == GS_LEVEL) - { - if (HU_Responder(ev)) - return true; // chat ate the event - if (AM_Responder(ev)) - return true; // automap ate it - // map the event (key/mouse/joy) to a gamecontrol - } - // Intro - else if (gamestate == GS_INTRO) - { - if (F_IntroResponder(ev)) - { - D_StartTitle(); - return true; - } - } - else if (gamestate == GS_CUTSCENE) - { - if (HU_Responder(ev)) - return true; // chat ate the event - - if (F_CutsceneResponder(ev)) - { - D_StartTitle(); - return true; - } - } - - else if (gamestate == GS_CREDITS) - { - if (HU_Responder(ev)) - return true; // chat ate the event - - if (F_CreditResponder(ev)) - { - F_StartGameEvaluation(); - return true; - } - } - - else if (gamestate == GS_CONTINUING) - { - if (F_ContinueResponder(ev)) - return true; - } - // Demo End - else if (gamestate == GS_GAMEEND || gamestate == GS_EVALUATION || gamestate == GS_CREDITS) - return true; - - else if (gamestate == GS_INTERMISSION || gamestate == GS_VOTING || gamestate == GS_WAITINGPLAYERS) - if (HU_Responder(ev)) - return true; // chat ate the event - +static boolean G_LevelResponder(event_t *ev) +{ // allow spy mode changes even during the demo - if (gamestate == GS_LEVEL && ev->type == ev_keydown - && (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1])) + if (ev->type == ev_keydown + && (ev->data1 == KEY_F12 + || ev->data1 == gamecontrol[0][gc_viewpoint][0] + || ev->data1 == gamecontrol[0][gc_viewpoint][1])) { if (!demo.playback && (splitscreen || !netgame)) displayplayers[0] = consoleplayer; @@ -1399,31 +1340,21 @@ boolean G_Responder(event_t *ev) } } - if (gamestate == GS_LEVEL && ev->type == ev_keydown && multiplayer && demo.playback) + if (ev->type == ev_keydown && multiplayer && demo.playback) { - if (ev->data1 == gamecontrolbis[gc_viewpoint][0] || ev->data1 == gamecontrolbis[gc_viewpoint][1]) + for (INT32 i = 1; i <= splitscreen; i++) { - G_AdjustView(2, 1, true); - - return true; - } - else if (ev->data1 == gamecontrol3[gc_viewpoint][0] || ev->data1 == gamecontrol3[gc_viewpoint][1]) - { - G_AdjustView(3, 1, true); - - return true; - } - else if (ev->data1 == gamecontrol4[gc_viewpoint][0] || ev->data1 == gamecontrol4[gc_viewpoint][1]) - { - G_AdjustView(4, 1, true); - - return true; + if (ev->data1 == gamecontrol[i][gc_viewpoint][0] + || ev->data1 == gamecontrol[i][gc_viewpoint][1]) + { + G_AdjustView(i+1, 1, true); + return true; + } } // Allow pausing - if ( - ev->data1 == gamecontrol[gc_pause][0] - || ev->data1 == gamecontrol[gc_pause][1] + if (ev->data1 == gamecontrol[0][gc_pause][0] + || ev->data1 == gamecontrol[0][gc_pause][1] || ev->data1 == KEY_PAUSE ) { @@ -1447,19 +1378,106 @@ boolean G_Responder(event_t *ev) if (ev->data1 == 32) { M_StartControlPanel(); - return true; } } + return false; +} + +// +// G_Responder +// Get info needed to make ticcmd_ts for the players. +// +boolean G_Responder(event_t *ev) +{ + if (demo.playback && demo.title) + { + // Title demo uses intro responder + if (F_IntroResponder(ev)) + { + // stop the title demo + G_CheckDemoStatus(); + return true; + } + + return false; + } + else if (gameaction == ga_nothing + && !demo.quitafterplaying + && ((demo.playback && !modeattacking && !multiplayer) || gamestate == GS_TITLESCREEN)) + { + // any other key pops up menu if in demos + if (ev->type == ev_keydown && ev->data1 != 301) + { + M_StartControlPanel(); + return true; + } + + return false; + } + + if (Playing()) + { + // If you're playing, chat is real. + // Neatly sidesteps a class of bugs where whenever we add a + // new gamestate accessible in netplay, chat was console-only. + if (HU_Responder(ev)) + { + return true; // chat ate the event + } + } + + switch (gamestate) + { + case GS_LEVEL: + if (AM_Responder(ev)) + return true; // automap ate it + // map the event (key/mouse/joy) to a gamecontrol + if (G_LevelResponder(ev)) + return true; + break; + case GS_INTRO: + if (F_IntroResponder(ev)) + { + D_StartTitle(); + return true; + } + break; + case GS_CUTSCENE: + if (F_CutsceneResponder(ev)) + { + D_StartTitle(); + return true; + } + break; + case GS_CREDITS: + if (F_CreditResponder(ev)) + { + F_StartGameEvaluation(); + return true; + } + break; + case GS_CONTINUING: + if (F_ContinueResponder(ev)) + return true; + break; + case GS_GAMEEND: + case GS_EVALUATION: + return true; // Demo End + break; + default: + break; + } + // update keys current state G_MapEventsToControls(ev); switch (ev->type) { case ev_keydown: - if (ev->data1 == gamecontrol[gc_pause][0] - || ev->data1 == gamecontrol[gc_pause][1] + if (ev->data1 == gamecontrol[0][gc_pause][0] + || ev->data1 == gamecontrol[0][gc_pause][1] || ev->data1 == KEY_PAUSE) { if (!pausedelay) @@ -1474,121 +1492,58 @@ boolean G_Responder(event_t *ev) else pausedelay = NEWTICRATE/7; } - if (ev->data1 == gamecontrol[gc_camtoggle][0] - || ev->data1 == gamecontrol[gc_camtoggle][1]) - { - if (!camtoggledelay[0]) - { - camtoggledelay[0] = NEWTICRATE / 7; - CV_SetValue(&cv_chasecam[0], cv_chasecam[0].value ? 0 : 1); - } - } - if (ev->data1 == gamecontrolbis[gc_camtoggle][0] - || ev->data1 == gamecontrolbis[gc_camtoggle][1]) - { - if (!camtoggledelay[1]) - { - camtoggledelay[1] = NEWTICRATE / 7; - CV_SetValue(&cv_chasecam[1], cv_chasecam[1].value ? 0 : 1); - } - } - if (ev->data1 == gamecontrol3[gc_camtoggle][0] - || ev->data1 == gamecontrol3[gc_camtoggle][1]) - { - if (!camtoggledelay[2]) - { - camtoggledelay[2] = NEWTICRATE / 7; - CV_SetValue(&cv_chasecam[2], cv_chasecam[2].value ? 0 : 1); - } - } - if (ev->data1 == gamecontrol4[gc_camtoggle][0] - || ev->data1 == gamecontrol4[gc_camtoggle][1]) - { - if (!camtoggledelay[3]) - { - camtoggledelay[3] = NEWTICRATE / 7; - CV_SetValue(&cv_chasecam[3], cv_chasecam[3].value ? 0 : 1); - } - } - if (ev->data1 == gamecontrol[gc_spectate][0] - || ev->data1 == gamecontrol[gc_spectate][1]) - { - if (!spectatedelay[0]) - { - spectatedelay[0] = NEWTICRATE / 7; - COM_ImmedExecute("changeteam spectator"); - } - } - if (ev->data1 == gamecontrolbis[gc_spectate][0] - || ev->data1 == gamecontrolbis[gc_spectate][1]) - { - if (!spectatedelay[1]) - { - spectatedelay[1] = NEWTICRATE / 7; - COM_ImmedExecute("changeteam2 spectator"); - } - } - if (ev->data1 == gamecontrol3[gc_spectate][0] - || ev->data1 == gamecontrol3[gc_spectate][1]) - { - if (!spectatedelay[2]) - { - spectatedelay[2] = NEWTICRATE / 7; - COM_ImmedExecute("changeteam3 spectator"); - } - } - if (ev->data1 == gamecontrol4[gc_spectate][0] - || ev->data1 == gamecontrol4[gc_spectate][1]) - { - if (!spectatedelay[3]) - { - spectatedelay[3] = NEWTICRATE / 7; - COM_ImmedExecute("changeteam4 spectator"); - } - } - if (ev->data1 == gamecontrol[gc_director][0] || ev->data1 == gamecontrol[gc_director][1]) + // no splitscreen support for director here + if (ev->data1 == gamecontrol[0][gc_director][0] + || ev->data1 == gamecontrol[0][gc_director][1]) { K_ToggleDirector(); } - if (ev->data1 == gamecontrol[gc_freecam][0] || ev->data1 == gamecontrol[gc_freecam][1]) + // absolutely horrid + for (INT32 i = 0; i <= splitscreen; i++) { - P_ToggleDemoCamera(0); - } - else if (ev->data1 == gamecontrolbis[gc_freecam][0] || ev->data1 == gamecontrolbis[gc_freecam][1]) - { - P_ToggleDemoCamera(1); - } - else if (ev->data1 == gamecontrol3[gc_freecam][0] || ev->data1 == gamecontrol3[gc_freecam][1]) - { - P_ToggleDemoCamera(2); - } - else if (ev->data1 == gamecontrol4[gc_freecam][0] || ev->data1 == gamecontrol4[gc_freecam][1]) - { - P_ToggleDemoCamera(3); + if (ev->data1 == gamecontrol[i][gc_camtoggle][0] + || ev->data1 == gamecontrol[i][gc_camtoggle][1]) + { + if (!camtoggledelay[i]) + { + camtoggledelay[i] = NEWTICRATE / 7; + CV_SetValue(&cv_chasecam[i], (cv_chasecam[i].value ^ 1)); + } + } + + if (ev->data1 == gamecontrol[i][gc_spectate][0] + || ev->data1 == gamecontrol[i][gc_spectate][1]) + { + if (!spectatedelay[i]) + { + spectatedelay[i] = NEWTICRATE / 7; + G_ToggleSpectate(i); + } + } + + if (ev->data1 == gamecontrol[i][gc_freecam][0] + || ev->data1 == gamecontrol[i][gc_freecam][1]) + { + P_ToggleDemoCamera(i); + } } return true; case ev_keyup: return false; // always let key up events filter down - case ev_mouse: return true; // eat events - case ev_joystick: return true; // eat events - case ev_joystick2: return true; // eat events - case ev_joystick3: return true; // eat events - case ev_joystick4: return true; // eat events - default: break; } @@ -4055,7 +4010,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool unlocktriggers = 0; // clear itemfinder, just in case - if (!dedicated) // except in dedicated servers, where it is not registered and can actually I_Error debug builds + if (!dedicated) // except in dedicated servers, where it is not registered and can actually I_Error debug builds CV_StealthSetValue(&cv_itemfinder, 0); } @@ -4073,7 +4028,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool // gamemap changed; we assume that its map header is always valid, // so make it so - if(!mapheaderinfo[gamemap-1]) + if (!mapheaderinfo[gamemap-1]) P_AllocMapHeader(gamemap-1); maptol = mapheaderinfo[gamemap-1]->typeoflevel; @@ -4878,6 +4833,7 @@ void G_GhostAddThok(INT32 playernum) { if (!demo.recording || !(demoflags & DF_GHOST)) return; + ghostext[playernum].flags = (ghostext[playernum].flags & ~EZT_THOKMASK) | EZT_THOK; } @@ -4885,6 +4841,7 @@ void G_GhostAddSpin(INT32 playernum) { if (!demo.recording || !(demoflags & DF_GHOST)) return; + ghostext[playernum].flags = (ghostext[playernum].flags & ~EZT_THOKMASK) | EZT_SPIN; } @@ -4892,6 +4849,7 @@ void G_GhostAddRev(INT32 playernum) { if (!demo.recording || !(demoflags & DF_GHOST)) return; + ghostext[playernum].flags = (ghostext[playernum].flags & ~EZT_THOKMASK) | EZT_REV; } @@ -4899,6 +4857,7 @@ void G_GhostAddFlip(INT32 playernum) { if (!demo.recording || !(demoflags & DF_GHOST)) return; + ghostext[playernum].flags |= EZT_FLIP; } @@ -4906,11 +4865,13 @@ void G_GhostAddColor(INT32 playernum, ghostcolor_t color) { if (!demo.recording || !(demoflags & DF_GHOST)) return; + if (ghostext[playernum].lastcolor == (UINT8)color) { ghostext[playernum].flags &= ~EZT_COLOR; return; } + ghostext[playernum].flags |= EZT_COLOR; ghostext[playernum].color = (UINT8)color; } @@ -4919,11 +4880,13 @@ void G_GhostAddScale(INT32 playernum, fixed_t scale) { if (!demo.recording || !(demoflags & DF_GHOST)) return; + if (ghostext[playernum].lastscale == scale) { ghostext[playernum].flags &= ~EZT_SCALE; return; } + ghostext[playernum].flags |= EZT_SCALE; ghostext[playernum].scale = scale; } @@ -4932,9 +4895,10 @@ void G_GhostAddHit(INT32 playernum, mobj_t *victim) { if (!demo.recording || !(demoflags & DF_GHOST)) return; + ghostext[playernum].flags |= EZT_HIT; ghostext[playernum].hits++; - ghostext[playernum].hitlist = Z_Realloc(ghostext[playernum].hitlist, ghostext[playernum].hits * sizeof(mobj_t *), PU_LEVEL, NULL); + ghostext[playernum].hitlist = Z_Realloc(ghostext[playernum].hitlist, ghostext[playernum].hits * sizeof(mobj_t *), PU_LEVEL, &ghostext[playernum].hitlist); P_SetTarget(ghostext[playernum].hitlist + (ghostext[playernum].hits-1), victim); } @@ -4954,7 +4918,7 @@ void G_WriteAllGhostTics(void) if (!playeringame[i] || players[i].spectator) continue; - if (!players[i].mo) + if (P_MobjWasRemoved(players[i].mo)) continue; counter++; @@ -5038,6 +5002,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum) // Store one full byte of movement, plus one byte of fractional movement. INT16 momx = (INT16)((ghost->x-oldghost[playernum].x + (1<<4))>>8); INT16 momy = (INT16)((ghost->y-oldghost[playernum].y + (1<<4))>>8); + if (momx != oldghost[playernum].momx || momy != oldghost[playernum].momy) { @@ -5050,7 +5015,9 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum) WRITEINT16(demobuf.p,momx); WRITEINT16(demobuf.p,momy); } + momx = (INT16)((ghost->z-oldghost[playernum].z + (1<<4))>>8); + if (momx != oldghost[playernum].momz) { oldghost[playernum].momz = momx; @@ -5122,6 +5089,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum) if (ghostext[playernum].color == ghostext[playernum].lastcolor) ghostext[playernum].flags &= ~EZT_COLOR; + if (ghostext[playernum].scale == ghostext[playernum].lastscale) ghostext[playernum].flags &= ~EZT_SCALE; @@ -5136,16 +5104,19 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum) WRITEUINT8(demobuf.p,ghostext[playernum].color); ghostext[playernum].lastcolor = ghostext[playernum].color; } + if (ghostext[playernum].flags & EZT_SCALE) { CHECKSPACE(sizeof(fixed_t)); WRITEFIXED(demobuf.p,ghostext[playernum].scale); ghostext[playernum].lastscale = ghostext[playernum].scale; } + if (ghostext[playernum].flags & EZT_HIT) { CHECKSPACE(2); WRITEUINT16(demobuf.p,ghostext[playernum].hits); + for (i = 0; i < ghostext[playernum].hits; i++) { mobj_t *mo = ghostext[playernum].hitlist[i]; @@ -5161,23 +5132,24 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum) WRITEANGLE(demobuf.p,mo->angle); P_SetTarget(ghostext[playernum].hitlist+i, NULL); } - Z_Free(ghostext[playernum].hitlist); + ghostext[playernum].hits = 0; - ghostext[playernum].hitlist = NULL; } + if (ghostext[playernum].flags & EZT_SPRITE) { CHECKSPACE(1); WRITEUINT8(demobuf.p,sprite); } + if (ghostext[playernum].flags & EZT_KART) { CHECKSPACE(12); - WRITEINT32(demobuf.p, ghostext[playernum].kartitem); WRITEINT32(demobuf.p, ghostext[playernum].kartamount); WRITEINT32(demobuf.p, ghostext[playernum].kartbumpers); } + ghostext[playernum].flags = 0; } @@ -5225,6 +5197,7 @@ void G_ConsGhostTic(INT32 playernum) // Grab ghost data. ziptic = READUINT8(demobuf.p); + if (ziptic & GZT_XYZ) { oldghost[playernum].x = READFIXED(demobuf.p); @@ -5239,17 +5212,22 @@ void G_ConsGhostTic(INT32 playernum) oldghost[playernum].momx = READINT16(demobuf.p)<<8; oldghost[playernum].momy = READINT16(demobuf.p)<<8; } + if (ziptic & GZT_MOMZ) oldghost[playernum].momz = READINT16(demobuf.p)<<8; + oldghost[playernum].x += oldghost[playernum].momx; oldghost[playernum].y += oldghost[playernum].momy; oldghost[playernum].z += oldghost[playernum].momz; syncleeway = FRACUNIT; } + if (ziptic & GZT_ANGLE) demobuf.p++; + if (ziptic & GZT_SPRITE) demobuf.p++; + if (ziptic & GZT_NIGHTS) { if (!testmo || !testmo->player || !(testmo->player->pflags & PF_NIGHTSMODE) || !testmo->tracer) @@ -5263,8 +5241,10 @@ void G_ConsGhostTic(INT32 playernum) ziptic = READUINT8(demobuf.p); if (ziptic & EZT_COLOR) demobuf.p++; + if (ziptic & EZT_SCALE) demobuf.p += sizeof(fixed_t); + if (ziptic & EZT_HIT) { // Resync mob damage. UINT16 i, count = READUINT16(demobuf.p); @@ -5297,6 +5277,7 @@ void G_ConsGhostTic(INT32 playernum) break; mobj = NULL; // wasn't this one, keep searching. } + if (mobj && mobj->health != health) // Wasn't damaged?! This is desync! Fix it! { if (demosynced) @@ -5304,13 +5285,16 @@ void G_ConsGhostTic(INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced (health)!\n")); CONS_Printf("expected health %d got %d\n", health, mobj->health); } + demosynced = false; P_DamageMobj(mobj, players[0].mo, players[0].mo, 1); } } } + if (ziptic & EZT_SPRITE) demobuf.p++; + if (ziptic & EZT_KART) { ghostext[playernum].kartitem = READINT32(demobuf.p); @@ -5390,7 +5374,8 @@ void G_ConsGhostTic(INT32 playernum) void G_GhostTicker(void) { demoghost *g,*p; - for(g = ghosts, p = NULL; g; g = g->next) + + for (g = ghosts, p = NULL; g; g = g->next) { // Skip normal demo data. UINT8 ziptic = READUINT8(g->p); diff --git a/src/g_input.c b/src/g_input.c index f0121f37d..f7ea83a75 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -131,10 +131,7 @@ joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[J UINT8 gamekeydown[NUMINPUTS]; // two key codes (or virtual key) per game control -INT32 gamecontrol[num_gamecontrols][2]; -INT32 gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player -INT32 gamecontrol3[num_gamecontrols][2]; // tertiary splitscreen player -INT32 gamecontrol4[num_gamecontrols][2]; // quarternary splitscreen player +INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2]; typedef struct { @@ -977,13 +974,14 @@ void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control) void G_ClearAllControlKeys(void) { - INT32 i; - for (i = 0; i < num_gamecontrols; i++) + INT32 i, k; + + for (k = 0; k < MAXSPLITSCREENPLAYERS; k++) { - G_ClearControlKeys(gamecontrol, i); - G_ClearControlKeys(gamecontrolbis, i); - G_ClearControlKeys(gamecontrol3, i); - G_ClearControlKeys(gamecontrol4, i); + for (i = 0; i < num_gamecontrols; i++) + { + G_ClearControlKeys(gamecontrol[k], i); + } } } @@ -1022,7 +1020,7 @@ INT32 G_KeyStringtoNum(const char *keystr) if (!keystr[0]) return 0; - if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z') + if (!keystr[0] || (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z')) return keystr[0]; if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9') @@ -1041,158 +1039,131 @@ void G_Controldefault(UINT8 player) if (player == 0 || player == 1) { // Main controls - gamecontrol[gc_aimforward ][0] = KEY_UPARROW; - gamecontrol[gc_aimbackward][0] = KEY_DOWNARROW; - gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW; - gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW; - gamecontrol[gc_accelerate ][0] = 'a'; - gamecontrol[gc_drift ][0] = 's'; - gamecontrol[gc_brake ][0] = 'd'; - gamecontrol[gc_fire ][0] = KEY_SPACE; - gamecontrol[gc_lookback ][0] = KEY_LSHIFT; + gamecontrol[0][gc_aimforward ][0] = KEY_UPARROW; + gamecontrol[0][gc_aimbackward][0] = KEY_DOWNARROW; + gamecontrol[0][gc_turnleft ][0] = KEY_LEFTARROW; + gamecontrol[0][gc_turnright ][0] = KEY_RIGHTARROW; + gamecontrol[0][gc_accelerate ][0] = 'a'; + gamecontrol[0][gc_drift ][0] = 's'; + gamecontrol[0][gc_brake ][0] = 'd'; + gamecontrol[0][gc_fire ][0] = KEY_SPACE; + gamecontrol[0][gc_lookback ][0] = KEY_LSHIFT; - gamecontrol[gc_accelerate ][1] = KEY_JOY1+0; // A - gamecontrol[gc_lookback ][1] = KEY_JOY1+2; // X - gamecontrol[gc_brake ][1] = KEY_JOY1+1; // B - gamecontrol[gc_fire ][1] = KEY_JOY1+9; // LB - gamecontrol[gc_drift ][1] = KEY_JOY1+10; // RB + gamecontrol[0][gc_accelerate ][1] = KEY_JOY1+0; // A + gamecontrol[0][gc_lookback ][1] = KEY_JOY1+2; // X + gamecontrol[0][gc_brake ][1] = KEY_JOY1+1; // B + gamecontrol[0][gc_fire ][1] = KEY_JOY1+9; // LB + gamecontrol[0][gc_drift ][1] = KEY_JOY1+10; // RB // Extra controls - gamecontrol[gc_pause ][0] = KEY_PAUSE; - gamecontrol[gc_console ][0] = KEY_CONSOLE; - gamecontrol[gc_screenshot ][0] = KEY_F8; - gamecontrol[gc_recordgif ][0] = KEY_F9; - gamecontrol[gc_viewpoint ][0] = KEY_F12; - gamecontrol[gc_talkkey ][0] = 't'; + gamecontrol[0][gc_pause ][0] = KEY_PAUSE; + gamecontrol[0][gc_console ][0] = KEY_CONSOLE; + gamecontrol[0][gc_screenshot ][0] = KEY_F8; + gamecontrol[0][gc_recordgif ][0] = KEY_F9; + gamecontrol[0][gc_viewpoint ][0] = KEY_F12; + gamecontrol[0][gc_talkkey ][0] = 't'; //gamecontrol[gc_teamkey ][0] = 'y'; - gamecontrol[gc_scores ][0] = KEY_TAB; - gamecontrol[gc_spectate ][0] = '\''; - gamecontrol[gc_lookup ][0] = KEY_PGUP; - gamecontrol[gc_lookdown ][0] = KEY_PGDN; - gamecontrol[gc_centerview ][0] = KEY_END; - gamecontrol[gc_camreset ][0] = KEY_HOME; - gamecontrol[gc_camtoggle ][0] = KEY_BACKSPACE; + gamecontrol[0][gc_scores ][0] = KEY_TAB; + gamecontrol[0][gc_spectate ][0] = '\''; + gamecontrol[0][gc_lookup ][0] = KEY_PGUP; + gamecontrol[0][gc_lookdown ][0] = KEY_PGDN; + gamecontrol[0][gc_centerview ][0] = KEY_END; + gamecontrol[0][gc_camreset ][0] = KEY_HOME; + gamecontrol[0][gc_camtoggle ][0] = KEY_BACKSPACE; - gamecontrol[gc_viewpoint ][1] = KEY_JOY1+3; // Y - gamecontrol[gc_pause ][1] = KEY_JOY1+4; // Back - gamecontrol[gc_systemmenu ][0] = KEY_JOY1+6; // Start - //gamecontrol[gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up - //gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down // absolutely fucking NOT - gamecontrol[gc_talkkey ][1] = KEY_HAT1+1; // D-Pad Down - gamecontrol[gc_scores ][1] = KEY_HAT1+0; // D-Pad Up + gamecontrol[0][gc_viewpoint ][1] = KEY_JOY1+3; // Y + gamecontrol[0][gc_pause ][1] = KEY_JOY1+4; // Back + gamecontrol[0][gc_systemmenu ][0] = KEY_JOY1+6; // Start + //gamecontrol[0][gc_camtoggle ][1] = KEY_HAT1+0; // D-Pad Up + //gamecontrol[0][gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down // absolutely fucking NOT + gamecontrol[0][gc_talkkey ][1] = KEY_HAT1+1; // D-Pad Down + gamecontrol[0][gc_scores ][1] = KEY_HAT1+0; // D-Pad Up } if (player == 0 || player == 2) { // Player 2 controls - gamecontrolbis[gc_accelerate ][0] = KEY_2JOY1+0; // A - gamecontrolbis[gc_lookback ][0] = KEY_2JOY1+2; // X - gamecontrolbis[gc_brake ][0] = KEY_2JOY1+1; // B - gamecontrolbis[gc_fire ][0] = KEY_2JOY1+9; // LB - gamecontrolbis[gc_drift ][0] = KEY_2JOY1+10; // RB + gamecontrol[1][gc_accelerate ][0] = KEY_2JOY1+0; // A + gamecontrol[1][gc_lookback ][0] = KEY_2JOY1+2; // X + gamecontrol[1][gc_brake ][0] = KEY_2JOY1+1; // B + gamecontrol[1][gc_fire ][0] = KEY_2JOY1+9; // LB + gamecontrol[1][gc_drift ][0] = KEY_2JOY1+10; // RB } if (player == 0 || player == 3) { // Player 3 controls - gamecontrol3[gc_accelerate ][0] = KEY_3JOY1+0; // A - gamecontrol3[gc_lookback ][0] = KEY_3JOY1+2; // X - gamecontrol3[gc_brake ][0] = KEY_3JOY1+1; // B - gamecontrol3[gc_fire ][0] = KEY_3JOY1+9; // LB - gamecontrol3[gc_drift ][0] = KEY_3JOY1+10; // RB + gamecontrol[2][gc_accelerate ][0] = KEY_3JOY1+0; // A + gamecontrol[2][gc_lookback ][0] = KEY_3JOY1+2; // X + gamecontrol[2][gc_brake ][0] = KEY_3JOY1+1; // B + gamecontrol[2][gc_fire ][0] = KEY_3JOY1+9; // LB + gamecontrol[2][gc_drift ][0] = KEY_3JOY1+10; // RB } if (player == 0 || player == 4) { // Player 4 controls - gamecontrol4[gc_accelerate ][0] = KEY_4JOY1+0; // A - gamecontrol4[gc_lookback ][0] = KEY_4JOY1+2; // X - gamecontrol4[gc_brake ][0] = KEY_4JOY1+1; // B - gamecontrol4[gc_fire ][0] = KEY_4JOY1+9; // LB - gamecontrol4[gc_drift ][0] = KEY_4JOY1+10; // RB + gamecontrol[3][gc_accelerate ][0] = KEY_4JOY1+0; // A + gamecontrol[3][gc_lookback ][0] = KEY_4JOY1+2; // X + gamecontrol[3][gc_brake ][0] = KEY_4JOY1+1; // B + gamecontrol[3][gc_fire ][0] = KEY_4JOY1+9; // LB + gamecontrol[3][gc_drift ][0] = KEY_4JOY1+10; // RB } } void G_SaveKeySetting(FILE *f) { - INT32 i; + INT32 i, k; - for (i = 1; i < num_gamecontrols; i++) + static const char *controltext[MAXSPLITSCREENPLAYERS] = { + "setcontrol", + "setcontrol2", + "setcontrol3", + "setcontrol4" + }; + + for (k = 0; k < MAXSPLITSCREENPLAYERS; k++) { - fprintf(f, "setcontrol \"%s\" \"%s\"", gamecontrolname[i], - G_KeynumToString(gamecontrol[i][0])); + for (i = 1; i < num_gamecontrols; i++) + { + fprintf(f, "%s \"%s\" \"%s\"", controltext[k], gamecontrolname[i], + G_KeynumToString(gamecontrol[k][i][0])); - if (gamecontrol[i][1]) - fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrol[i][1])); - else - fprintf(f, "\n"); - } - - for (i = 1; i < num_gamecontrols; i++) - { - fprintf(f, "setcontrol2 \"%s\" \"%s\"", gamecontrolname[i], - G_KeynumToString(gamecontrolbis[i][0])); - - if (gamecontrolbis[i][1]) - fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrolbis[i][1])); - else - fprintf(f, "\n"); - } - - for (i = 1; i < num_gamecontrols; i++) - { - fprintf(f, "setcontrol3 \"%s\" \"%s\"", gamecontrolname[i], - G_KeynumToString(gamecontrol3[i][0])); - - if (gamecontrol3[i][1]) - fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrol3[i][1])); - else - fprintf(f, "\n"); - } - - for (i = 1; i < num_gamecontrols; i++) - { - fprintf(f, "setcontrol4 \"%s\" \"%s\"", gamecontrolname[i], - G_KeynumToString(gamecontrol4[i][0])); - - if (gamecontrol4[i][1]) - fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrol4[i][1])); - else - fprintf(f, "\n"); + if (gamecontrol[k][i][1]) + fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrol[k][i][1])); + else + fprintf(f, "\n"); + } } } INT32 G_CheckDoubleUsage(INT32 keynum, boolean modify) { INT32 result = gc_null; + if (cv_controlperkey.value == 1) { - INT32 i, j; - for (i = 0; i < num_gamecontrols; i++) + INT32 i, j, k; + + for (k = 0; k < MAXSPLITSCREENPLAYERS; k++) { - for (j = 0; j < 2; j++) + for (i = 0; i < num_gamecontrols; i++) { - if (gamecontrol[i][j] == keynum) { - result = i; - if (modify) gamecontrol[i][j] = KEY_NULL; + for (j = 0; j < 2; j++) + { + if (gamecontrol[k][i][j] == keynum) + { + result = i; + if (modify) gamecontrol[k][i][j] = KEY_NULL; + } + + if (result && !modify) + return result; } - if (gamecontrolbis[i][j] == keynum) { - result = i; - if (modify) gamecontrolbis[i][j] = KEY_NULL; - } - if (gamecontrol3[i][j] == keynum) { - result = i; - if (modify) gamecontrol3[i][j] = KEY_NULL; - } - if (gamecontrol4[i][j] == keynum) { - result = i; - if (modify) gamecontrol4[i][j] = KEY_NULL; - } - if (result && !modify) - return result; } } } + return result; } @@ -1346,11 +1317,11 @@ static void setcontrol(INT32 (*gc)[2]) INT32 player; boolean nestedoverride = false; - if ((void*)gc == (void*)&gamecontrol4) + if ((void*)gc == (void*)&gamecontrol[3]) player = 3; - else if ((void*)gc == (void*)&gamecontrol3) + else if ((void*)gc == (void*)&gamecontrol[2]) player = 2; - else if ((void*)gc == (void*)&gamecontrolbis) + else if ((void*)gc == (void*)&gamecontrol[1]) player = 1; else player = 0; @@ -1413,7 +1384,7 @@ void Command_Setcontrol_f(void) return; } - setcontrol(gamecontrol); + setcontrol(gamecontrol[0]); } void Command_Setcontrol2_f(void) @@ -1428,7 +1399,7 @@ void Command_Setcontrol2_f(void) return; } - setcontrol(gamecontrolbis); + setcontrol(gamecontrol[1]); } void Command_Setcontrol3_f(void) @@ -1443,7 +1414,7 @@ void Command_Setcontrol3_f(void) return; } - setcontrol(gamecontrol3); + setcontrol(gamecontrol[2]); } void Command_Setcontrol4_f(void) @@ -1458,5 +1429,5 @@ void Command_Setcontrol4_f(void) return; } - setcontrol(gamecontrol4); + setcontrol(gamecontrol[3]); } diff --git a/src/g_input.h b/src/g_input.h index 505d210f8..b8e4cd8d8 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -121,14 +121,12 @@ extern INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], extern UINT8 gamekeydown[NUMINPUTS]; // two key codes (or virtual key) per game control -extern INT32 gamecontrol[num_gamecontrols][2]; -extern INT32 gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player -extern INT32 gamecontrol3[num_gamecontrols][2]; -extern INT32 gamecontrol4[num_gamecontrols][2]; -#define PLAYER1INPUTDOWN(gc) (gamekeydown[gamecontrol[gc][0]] || gamekeydown[gamecontrol[gc][1]]) -#define PLAYER2INPUTDOWN(gc) (gamekeydown[gamecontrolbis[gc][0]] || gamekeydown[gamecontrolbis[gc][1]]) -#define PLAYER3INPUTDOWN(gc) (gamekeydown[gamecontrol3[gc][0]] || gamekeydown[gamecontrol3[gc][1]]) -#define PLAYER4INPUTDOWN(gc) (gamekeydown[gamecontrol4[gc][0]] || gamekeydown[gamecontrol4[gc][1]]) +extern INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2]; + +#define PLAYER1INPUTDOWN(gc) (gamekeydown[gamecontrol[0][gc][0]] || gamekeydown[gamecontrol[0][gc][1]]) +#define PLAYER2INPUTDOWN(gc) (gamekeydown[gamecontrol[1][gc][0]] || gamekeydown[gamecontrol[1][gc][1]]) +#define PLAYER3INPUTDOWN(gc) (gamekeydown[gamecontrol[2][gc][0]] || gamekeydown[gamecontrol[2][gc][1]]) +#define PLAYER4INPUTDOWN(gc) (gamekeydown[gamecontrol[3][gc][0]] || gamekeydown[gamecontrol[3][gc][1]]) // peace to my little coder fingers! // check a gamecontrol being active or not diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 5ba8655b8..f3b4ae84f 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -553,7 +553,7 @@ static void HWR_PrecacheLevelFlats(void) // gotta check sector floor and ceiling for (j = 0; j < 2; j++) { - const boolean ceiling = (j == 1); + const boolean ceiling = (j == 0); INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic; levelflat = levelflats[pic]; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 37d0e25cd..c485b5a77 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2357,7 +2357,35 @@ static void HWR_AddLine(seg_t *line) gl_backsector = line->backsector; if (!cv_glportals.value || LIKELY(!gl_maphasportals)) - goto doaddline; + { +doaddline: + if (!line->backsector) + { + gld_clipper_SafeAddClipRange(angle2, angle1); + } + else + { + gl_backsector = R_FakeFlat(gl_backsector, &tempsec, NULL, NULL, true); + + if (CheckClip(gl_frontsector, gl_backsector)) + { + gld_clipper_SafeAddClipRange(angle2, angle1); + checkforemptylines = false; + } + + // Reject empty lines used for triggers and special events. + // Identical floor and ceiling on both sides, + // identical light levels on both sides, + // and no middle texture. + if (checkforemptylines && R_IsEmptyLine(line, gl_frontsector, gl_backsector)) + return; + } + + if (LIKELY(gl_portal_state != GLPORTAL_SEARCH && !dont_draw))// no need to do this during the portal check + HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D + + return; + } // do extra checks on the seg when rendering portals: // don't render segs that are behind the portal destination line @@ -2393,34 +2421,7 @@ static void HWR_AddLine(seg_t *line) return;// dont do anything with the other side i guess? } -doaddline: - - if (!line->backsector) - { - gld_clipper_SafeAddClipRange(angle2, angle1); - } - else - { - gl_backsector = R_FakeFlat(gl_backsector, &tempsec, NULL, NULL, true); - - if (CheckClip(gl_frontsector, gl_backsector)) - { - gld_clipper_SafeAddClipRange(angle2, angle1); - checkforemptylines = false; - } - - // Reject empty lines used for triggers and special events. - // Identical floor and ceiling on both sides, - // identical light levels on both sides, - // and no middle texture. - if (checkforemptylines && R_IsEmptyLine(line, gl_frontsector, gl_backsector)) - return; - } - - if (LIKELY(gl_portal_state != GLPORTAL_SEARCH && !dont_draw))// no need to do this during the portal check - HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D - - return; + goto doaddline; } // HWR_CheckBBox @@ -2437,8 +2438,8 @@ static boolean HWR_CheckBBox(const fixed_t *bspcoord) // Find the corners of the box // that define the edges from current viewpoint. - const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT ] ? 1 : 2) + - (viewy >= bspcoord[BOXTOP ] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8); + const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT] ? 1 : 2) + + (viewy >= bspcoord[BOXTOP] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8); if (boxpos == 5) return true; @@ -2877,7 +2878,7 @@ static void HWR_Subsector(size_t num) gl_frontsector = R_FakeFlat(gl_frontsector, &tempsec, &floorlightlevel, &ceilinglightlevel, false); - if (gl_portal_state == GLPORTAL_SEARCH) + if (UNLIKELY(gl_portal_state == GLPORTAL_SEARCH)) { goto doaddline; } @@ -3003,37 +3004,37 @@ static void HWR_Subsector(size_t num) { UINT8 alpha; - light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < bottomCullHeight ? true : false); + light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < bottomCullHeight)); alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap); HWR_AddTransparentFloor(0, - &extrasubsectors[num], - false, - *rover->bottomheight, - *gl_frontsector->lightlist[light].lightlevel, - alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, - true, rover->master->frontsector->extra_colormap); + &extrasubsectors[num], + false, + *rover->bottomheight, + *gl_frontsector->lightlist[light].lightlevel, + alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, + true, rover->master->frontsector->extra_colormap); } else if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) // SoM: Flags are more efficient { - light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < bottomCullHeight ? true : false); + light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < bottomCullHeight)); HWR_AddTransparentFloor(levelflats[*rover->bottompic].lumpnum, - &extrasubsectors[num], - false, - *rover->bottomheight, - *gl_frontsector->lightlist[light].lightlevel, - CLAMP(rover->alpha, 0 ,255), rover->master->frontsector, HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent), - false, gl_frontsector->lightlist[light].extra_colormap); + &extrasubsectors[num], + false, + *rover->bottomheight, + *gl_frontsector->lightlist[light].lightlevel, + CLAMP(rover->alpha, 0 ,255), rover->master->frontsector, HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent), + false, gl_frontsector->lightlist[light].extra_colormap); } else { HWR_GetFlat(levelflats[*rover->bottompic].lumpnum, R_NoEncore(gl_frontsector, false)); - light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < bottomCullHeight ? true : false); + light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < bottomCullHeight)); HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum, - rover->master->frontsector, 255, gl_frontsector->lightlist[light].extra_colormap); + rover->master->frontsector, 255, gl_frontsector->lightlist[light].extra_colormap); } } @@ -3049,21 +3050,21 @@ static void HWR_Subsector(size_t num) { UINT8 alpha; - light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < topCullHeight ? true : false); + light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < topCullHeight)); alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap); HWR_AddTransparentFloor(0, - &extrasubsectors[num], - true, - *rover->topheight, - *gl_frontsector->lightlist[light].lightlevel, - alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, - true, rover->master->frontsector->extra_colormap); + &extrasubsectors[num], + true, + *rover->topheight, + *gl_frontsector->lightlist[light].lightlevel, + alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, + true, rover->master->frontsector->extra_colormap); } else if ((rover->flags & FF_TRANSLUCENT && rover->alpha < 256) || rover->blend) { - light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < topCullHeight ? true : false); + light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < topCullHeight)); HWR_AddTransparentFloor(levelflats[*rover->toppic].lumpnum, &extrasubsectors[num], @@ -3076,10 +3077,10 @@ static void HWR_Subsector(size_t num) else { HWR_GetFlat(levelflats[*rover->toppic].lumpnum, R_NoEncore(gl_frontsector, true)); - light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < topCullHeight ? true : false); + light = R_GetPlaneLight(gl_frontsector, centerHeight, (viewz < topCullHeight)); HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum, - rover->master->frontsector, 255, gl_frontsector->lightlist[light].extra_colormap); + rover->master->frontsector, 255, gl_frontsector->lightlist[light].extra_colormap); } } } @@ -3459,7 +3460,7 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, GLPatch_t *gpatch) sSurf.PolyColor.s.green = 0x01; // shadow is always half as translucent as the sprite itself - if (!cv_translucency.value) // use default translucency (main sprite won't have any translucency) + if (UNLIKELY(!cv_translucency.value)) // use default translucency (main sprite won't have any translucency) sSurf.PolyColor.s.alpha = 0x80; // default else if (spr->mobj->flags2 & MF2_SHADOW) sSurf.PolyColor.s.alpha = 0x20; @@ -3668,7 +3669,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite) else blendmode = spr->mobj->blendmode; - if (!cv_translucency.value) // translucency disabled + if (UNLIKELY(!cv_translucency.value)) // translucency disabled { Surf.PolyColor.s.alpha = 0xFF; blend = PF_Translucent|PF_Occlude; @@ -3952,7 +3953,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) else blendmode = spr->mobj->blendmode; - if (!cv_translucency.value) // translucency disabled + if (UNLIKELY(!cv_translucency.value)) // translucency disabled { Surf.PolyColor.s.alpha = 0xFF; blend = PF_Translucent|PF_Occlude; @@ -5316,6 +5317,7 @@ static void HWR_SetTransformAiming(FTransform *trans) trans->shearing = false; gl_aimingangle = aimingangle; } + trans->anglex = (float)(gl_aimingangle>>ANGLETOFINESHIFT)*(FINEDEGREE); } @@ -5451,7 +5453,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl validcount++; - if (cv_glbatching.value) + if (LIKELY(cv_glbatching.value)) HWR_StartBatching(); if (useportals && !rootportal && portallist.base && !skybox) // if portals have been drawn in the main view, then render skywalls differently @@ -5475,7 +5477,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl PS_STOP_TIMING(ps_bsptime); - if (cv_glbatching.value) + if (LIKELY(cv_glbatching.value)) HWR_RenderBatches(); if (skyWallVertexArraySize) // if there are skywalls to draw using the alternate method @@ -5689,7 +5691,7 @@ static void HWR_CheckForHorizonLines(void) } } -void HWR_LoadLevel(void) +void HWR_LoadLevel(boolean reloadinggamestate) { // Lactozilla (December 8, 2019) // Level setup used to free EVERY mipmap from memory. @@ -5708,7 +5710,8 @@ void HWR_LoadLevel(void) HWR_ClearSkyDome(); HWR_BuildSkyDome(); - HWR_CheckForHorizonLines(); + if (!reloadinggamestate) + HWR_CheckForHorizonLines(); if (HWR_ShouldUsePaletteRendering()) HWR_SetMapPalette(); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 0fcb58a3d..d2e363079 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1557,7 +1557,7 @@ void GL_SetBlend(FBITFIELD PolyFlags) { if (PolyFlags & PF_Skydecal) { - pglPolygonOffset(-0.45f, -0.45f); // dont let skywalls draw over actual walls tho + pglPolygonOffset(0.45f, 0.45f); pglEnable(GL_POLYGON_OFFSET_FILL); } else diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 268059d06..feedf4039 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1315,7 +1315,7 @@ boolean HU_Responder(event_t *ev) INT32 i; for (i = 0; i < num_gamecontrols; i++) { - if (gamecontrol[i][0] == ev->data1 || gamecontrol[i][1] == ev->data1) + if (gamecontrol[0][i][0] == ev->data1 || gamecontrol[0][i][1] == ev->data1) break; } @@ -1327,7 +1327,7 @@ boolean HU_Responder(event_t *ev) if (!chat_on) { // enter chat mode - if ((ev->data1 == gamecontrol[gc_talkkey][0] || ev->data1 == gamecontrol[gc_talkkey][1]) + if ((ev->data1 == gamecontrol[0][gc_talkkey][0] || ev->data1 == gamecontrol[0][gc_talkkey][1]) && netgame && !OLD_MUTE) // check for old chat mute, still let the players open the chat incase they want to scroll otherwise. { chat_on = true; @@ -1338,7 +1338,7 @@ boolean HU_Responder(event_t *ev) typelines = 1; return true; } - if ((ev->data1 == gamecontrol[gc_teamkey][0] || ev->data1 == gamecontrol[gc_teamkey][1]) + if ((ev->data1 == gamecontrol[0][gc_teamkey][0] || ev->data1 == gamecontrol[0][gc_teamkey][1]) && netgame && !OLD_MUTE) { chat_on = true; @@ -1364,8 +1364,8 @@ boolean HU_Responder(event_t *ev) // Ignore non-keyboard keys, except when the talk key is bound if (ev->data1 >= KEY_MOUSE1 - && (ev->data1 != gamecontrol[gc_talkkey][0] - && ev->data1 != gamecontrol[gc_talkkey][1])) + && (ev->data1 != gamecontrol[0][gc_talkkey][0] + && ev->data1 != gamecontrol[0][gc_talkkey][1])) return false; M_TextInputHandle(&w_chat, c); @@ -1377,8 +1377,8 @@ boolean HU_Responder(event_t *ev) HU_SendChatMessage(); } else if (c == KEY_ESCAPE - || ((c == gamecontrol[gc_talkkey][0] || c == gamecontrol[gc_talkkey][1] - || c == gamecontrol[gc_teamkey][0] || c == gamecontrol[gc_teamkey][1]) + || ((c == gamecontrol[0][gc_talkkey][0] || c == gamecontrol[0][gc_talkkey][1] + || c == gamecontrol[0][gc_teamkey][0] || c == gamecontrol[0][gc_teamkey][1]) && c >= KEY_MOUSE1)) // If it's not a keyboard key, then the chat button is used as a toggle. { chat_on = false; diff --git a/src/info.c b/src/info.c index 7afc76bf6..19183de52 100644 --- a/src/info.c +++ b/src/info.c @@ -69,6 +69,8 @@ char sprnames[NUMSPRITES + 1][5] = }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wincompatible-pointer-types" state_t states[NUMSTATES] = { // frame is masked through FF_FRAMEMASK @@ -3410,6 +3412,7 @@ state_t states[NUMSTATES] = {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK #endif }; +#pragma GCC diagnostic pop mobjinfo_t mobjinfo[NUMMOBJTYPES] = { diff --git a/src/k_kart.c b/src/k_kart.c index 1e2190c2f..222890332 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -230,6 +230,8 @@ static boolean K_SpeedLinesShouldBlend(player_t *player); // mapreset is set when enough players fill an empty server // nospectategrief is the players in-game needed to eliminate the person in last +#define XTRA3PSCALE 50135 //0.765 +#define XTRA3VSCALE 35344 //0.55 //{ SRB2kart Color Code @@ -774,6 +776,26 @@ static UINT8 K_GetSpeedometerStyle(void) return SPEEDO_VANILLA; } +static boolean K_UseColorSpeedo(int speedostyle) +{ + if (!K_UseColorHud()) + return false; + + switch (speedostyle) + { + case SPEEDO_EXTRA: + return xtra_speedo_clr; + case SPEEDO_ACHII: + return achi_speedo_clr; + case SPEEDO_DIAL: + return dial_speedo_clr; + case SPEEDO_EXTRA3: + return xtra_speedo_clr3; + default: + return false; + } +} + static boolean K_IsHighResolution(void) { return (vid.width >= 640 && vid.height >= 400); @@ -9739,33 +9761,33 @@ static void K_drawKartSpeedometer(void) } else if (speedostyle == SPEEDO_EXTRA) // why bother if we dont? { - if (K_UseColorHud() && xtra_speedo_clr) //Colourized hud + if (K_UseColorSpeedo(SPEEDO_EXTRA)) //Colourized hud { UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE); - V_DrawMappedPatch(SPDM_X + 1, SPDM_Y + 4, (V_HUDTRANS|splitflags), (skp_smallstickerclr), colormap); + V_DrawMappedPatch(SPDM_X + 1, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_smallstickerclr, colormap); } else - V_DrawScaledPatch(SPDM_X + 1, SPDM_Y + 4, (V_HUDTRANS|splitflags), (skp_smallsticker)); + V_DrawScaledPatch(SPDM_X + 1, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_smallsticker); V_DrawRankNum(SPDM_X + 26, SPDM_Y + 4, V_HUDTRANS|splitflags, convSpeed[1], 3, NULL); V_DrawScaledPatch(SPDM_X + 31, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_speedpatches[cv_kartspeedometer.value]); } else if (speedostyle == SPEEDO_ACHII) // why bother if we dont? { - if (K_UseColorHud() && achi_speedo_clr) //Colourized hud + if (K_UseColorSpeedo(SPEEDO_ACHII)) //Colourized hud { UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE); - V_DrawMappedPatch(SPDM_X + 1, SPDM_Y + 4, (V_HUDTRANS|splitflags), (skp_smallstickerachiclr), colormap); + V_DrawMappedPatch(SPDM_X + 1, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_smallstickerachiclr, colormap); V_DrawRankNum(SPDM_X + 26, SPDM_Y + 4, V_HUDTRANS|splitflags, convSpeed[1], 3, NULL); V_DrawMappedPatch(SPDM_X + 31, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_speedpatchesachiclr[cv_kartspeedometer.value], colormap); } else { - V_DrawScaledPatch(SPDM_X + 1, SPDM_Y + 4, (V_HUDTRANS|splitflags), (skp_smallstickerachi)); + V_DrawScaledPatch(SPDM_X + 1, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_smallstickerachi); V_DrawRankNum(SPDM_X + 26, SPDM_Y + 4, V_HUDTRANS|splitflags, convSpeed[1], 3, NULL); V_DrawScaledPatch(SPDM_X + 31, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_speedpatchesachi[cv_kartspeedometer.value]); } - } + } #ifdef ROTSPRITE else if (speedostyle == SPEEDO_DIAL) // why bother if we dont? { @@ -9774,18 +9796,18 @@ static void K_drawKartSpeedometer(void) splitflags, (boolean)(G_BattleGametype()), (LUA_HudEnabled(hud_gametypeinfo)), - (boolean)(K_UseColorHud() && dial_speedo_clr)); + (K_UseColorSpeedo(SPEEDO_DIAL))); } #endif else if (speedostyle == SPEEDO_EXTRA3) // why bother if we dont? { - if (K_UseColorHud() && xtra_speedo_clr3) //Colourized hud + if (K_UseColorSpeedo(SPEEDO_EXTRA3)) //Colourized hud { UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE); - V_DrawStretchyFixedPatch((SPDM_X-1)< 54) || (fuspeed < 60 && fuspeed > 56) || (fuspeed > 59)) && !(leveltime & 4)) spdpatch = 23; - patch_t *patch = NULL; - - if (speedostyle == SPEEDO_PMETER) - patch = kp_kartzspeedo[spdpatch]; - else if (speedostyle == SPEEDO_PMETERSMOL) - patch = kp_kartzspeedo_smol[spdpatch]; - - V_DrawScaledPatch(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, patch); + V_DrawScaledPatch(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, (speedostyle == SPEEDO_PMETER) ? kp_kartzspeedo[spdpatch] : kp_kartzspeedo_smol[spdpatch]); } } @@ -10346,13 +10361,13 @@ skipcrap: if (usescaledpatch) // i hate hud code i hate hud code i hate hud code i hate hud code i hate hud code..... { - if (K_UseColorHud() && xtra_speedo_clr3) // Colourized hud + if (K_UseColorSpeedo(SPEEDO_EXTRA3)) // Colourized hud { UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE); - V_DrawStretchyFixedPatch((basex - dup*30)<localskin = &skins[i]; mo->skinlocal = false; @@ -483,7 +483,6 @@ int mobj_localskin_setter(lua_State *L) } } - return 0; } diff --git a/src/m_menu.c b/src/m_menu.c index bcd406e4c..283870f7c 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3887,8 +3887,8 @@ boolean M_Responder(event_t *ev) { if (currentMenu == &MISC_ChangeLevelDef || currentMenu == &MP_OfflineServerDef || currentMenu == &MP_ServerDef) { - if (ch == gamecontrol[gc_fire][0] - || ch == gamecontrol[gc_fire][1]) + if (ch == gamecontrol[0][gc_fire][0] + || ch == gamecontrol[0][gc_fire][1]) { COM_ImmedExecute("add kartencore 1"); } @@ -4021,9 +4021,9 @@ boolean M_Responder(event_t *ev) if (ch == -1) return false; - else if (ch == gamecontrol[gc_systemmenu][0] || ch == gamecontrol[gc_systemmenu][1]) // allow remappable ESC key + else if (ch == gamecontrol[0][gc_systemmenu][0] || ch == gamecontrol[0][gc_systemmenu][1]) // allow remappable ESC key ch = KEY_ESCAPE; - else if ((ch == gamecontrol[gc_accelerate][0] || ch == gamecontrol[gc_accelerate][1]) && ch >= KEY_MOUSE1) + else if ((ch == gamecontrol[0][gc_accelerate][0] || ch == gamecontrol[0][gc_accelerate][1]) && ch >= KEY_MOUSE1) ch = KEY_ENTER; // F-Keys @@ -4099,7 +4099,7 @@ boolean M_Responder(event_t *ev) return false; } - if ((ch == gamecontrol[gc_brake][0] || ch == gamecontrol[gc_brake][1]) && ch >= KEY_MOUSE1) // do this here, otherwise brake opens the menu mid-game + if ((ch == gamecontrol[0][gc_brake][0] || ch == gamecontrol[0][gc_brake][1]) && ch >= KEY_MOUSE1) // do this here, otherwise brake opens the menu mid-game ch = KEY_ESCAPE; routine = currentMenu->menuitems[itemOn].itemaction; @@ -6719,7 +6719,7 @@ static void M_HandleAddons(INT32 choice) { if (DumbStartsWith("KC_", dirmenu[dir_on[menudepthleft]]+DIR_STRING) || DumbStartsWith("kc_", dirmenu[dir_on[menudepthleft]]+DIR_STRING)) { M_StartMessage(va("%c%s\x80\nYou are loading a local skin.\nLocal skins will not be usable\nafter going back from\nthe title screen.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING); - COM_BufAddText(va("addskins \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING)); + COM_BufAddText(va("addfilelocal \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING)); } else S_StartSound(NULL, sfx_s26d); @@ -9290,7 +9290,7 @@ static void M_TimeAttack(INT32 choice) if (M_CountLevelsToShowInList() == 0) { - M_StartMessage(M_GetText("No record-attackable levels found.\n"),NULL,MM_NOTHING); + M_StartMessage(M_GetText("No record-attackable levels found.\n"), NULL, MM_NOTHING); return; } @@ -10097,7 +10097,7 @@ static void M_HandleMasterServerResetChoice(event_t *ev) if (ev->type == ev_keydown) { - if (choice == ' ' || choice == 'y' || choice == KEY_ENTER || choice == gamecontrol[gc_accelerate][0] || choice == gamecontrol[gc_accelerate][1]) + if (choice == ' ' || choice == 'y' || choice == KEY_ENTER || choice == gamecontrol[0][gc_accelerate][0] || choice == gamecontrol[0][gc_accelerate][1]) { CV_Set(&cv_masterserver, cv_masterserver.defaultvalue); CV_Set(&cv_masterserver_nagattempts, cv_masterserver_nagattempts.defaultvalue); @@ -10251,8 +10251,8 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade) if (levellistmode != LLM_RECORDATTACK) // so it doesent show in record attack menu { char encoretoggle[32] = {0}; - const char *item1 = gamecontrol[gc_fire][0] != 0 ? G_KeynumToString(gamecontrol[gc_fire][0]) : NULL; - const char *item2 = gamecontrol[gc_fire][1] != 0 ? G_KeynumToString(gamecontrol[gc_fire][1]) : NULL; + const char *item1 = gamecontrol[0][gc_fire][0] != 0 ? G_KeynumToString(gamecontrol[0][gc_fire][0]) : NULL; + const char *item2 = gamecontrol[0][gc_fire][1] != 0 ? G_KeynumToString(gamecontrol[0][gc_fire][1]) : NULL; if (item1 != NULL && item2 != NULL) snprintf(encoretoggle, 32, "%s/%s - Toggle Encore", item1, item2); @@ -11445,7 +11445,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice) boolean exitmenu = false; // exit to previous menu and send name change const boolean gridselect = (cv_skinselectmenu.value == SKINMENUTYPE_GRID || cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED); // menus with "grids" - if ((choice == gamecontrol[gc_fire][0] || choice == gamecontrol[gc_fire][1]) && (itemOn == 2 || (gridselect && itemOn == 1))) + if ((choice == gamecontrol[0][gc_fire][0] || choice == gamecontrol[0][gc_fire][1]) && (itemOn == 2 || (gridselect && itemOn == 1))) choice = KEY_BACKSPACE; // Hack to allow resetting prefcolor on controllers #define BREAKWHENLOCKED {\ @@ -11741,8 +11741,8 @@ static void M_HandleSetupMultiPlayer(INT32 choice) break; //c why????? - //case gamecontrol[gc_accelerate][0]: - //case gamecontrol[gc_accelerate][1]: + //case gamecontrol[0][gc_accelerate][0]: + //case gamecontrol[0][gc_accelerate][1]: case KEY_ENTER: if (cv_skinselectmenu.value == SKINMENUTYPE_2D) { @@ -12356,7 +12356,7 @@ static void M_Setup1PControlsMenu(INT32 choice) { (void)choice; setupcontrolplayer = 1; - setupcontrols = gamecontrol; // was called from main Options (for console player, then) + setupcontrols = gamecontrol[0]; // was called from main Options (for console player, then) currentMenu->lastOn = itemOn; // Set proper gamepad options @@ -12379,7 +12379,7 @@ static void M_Setup2PControlsMenu(INT32 choice) { (void)choice; setupcontrolplayer = 2; - setupcontrols = gamecontrolbis; + setupcontrols = gamecontrol[1]; currentMenu->lastOn = itemOn; // Set proper gamepad options @@ -12402,7 +12402,7 @@ static void M_Setup3PControlsMenu(INT32 choice) { (void)choice; setupcontrolplayer = 3; - setupcontrols = gamecontrol3; + setupcontrols = gamecontrol[2]; currentMenu->lastOn = itemOn; // Set proper gamepad options @@ -12425,7 +12425,7 @@ static void M_Setup4PControlsMenu(INT32 choice) { (void)choice; setupcontrolplayer = 4; - setupcontrols = gamecontrol4; + setupcontrols = gamecontrol[3]; currentMenu->lastOn = itemOn; // Set proper gamepad options @@ -12673,17 +12673,17 @@ static void M_ResetControlsResponse(INT32 ch) switch (setupcontrolplayer) { case 4: - G_ClearControlKeys(gamecontrol4, i); + G_ClearControlKeys(gamecontrol[3], i); break; case 3: - G_ClearControlKeys(gamecontrol3, i); + G_ClearControlKeys(gamecontrol[2], i); break; case 2: - G_ClearControlKeys(gamecontrolbis, i); + G_ClearControlKeys(gamecontrol[1], i); break; case 1: default: - G_ClearControlKeys(gamecontrol, i); + G_ClearControlKeys(gamecontrol[0], i); break; } } diff --git a/src/m_misc.c b/src/m_misc.c index ff9892464..6b9699243 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1577,9 +1577,9 @@ boolean M_ScreenshotResponder(event_t *ev) if (ch >= KEY_MOUSE1 && menuactive) // If it's not a keyboard key, then don't allow it in the menus! return false; - if (ch == KEY_F8 || ch == gamecontrol[gc_screenshot][0] || ch == gamecontrol[gc_screenshot][1]) // remappable F8 + if (ch == KEY_F8 || ch == gamecontrol[0][gc_screenshot][0] || ch == gamecontrol[0][gc_screenshot][1]) // remappable F8 M_ScreenShot(); - else if (ch == KEY_F9 || ch == gamecontrol[gc_recordgif][0] || ch == gamecontrol[gc_recordgif][1]) // remappable F9 + else if (ch == KEY_F9 || ch == gamecontrol[0][gc_recordgif][0] || ch == gamecontrol[0][gc_recordgif][1]) // remappable F9 ((moviemode) ? M_StopMovie : M_StartMovie)(); else return false; diff --git a/src/p_mobj.c b/src/p_mobj.c index fb34b335d..3fd74f4a7 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10174,21 +10174,13 @@ void P_RemoveSavegameMobj(mobj_t *mobj) thinker_t *th = (thinker_t*)mobj; // unlink from sector and block lists - if (th->function.acp1 == (actionf_p1)P_NullPrecipThinker) - { - P_UnsetPrecipThingPosition((precipmobj_t *)mobj); - } - else - { - // unlink from sector and block lists - P_UnsetThingPosition(mobj); + P_UnsetThingPosition(mobj); - // Remove touching_sectorlist from mobj. - if (sector_list) - { - P_DelSeclist(sector_list); - sector_list = NULL; - } + // Remove touching_sectorlist from mobj. + if (sector_list) + { + P_DelSeclist(sector_list); + sector_list = NULL; } // stop any playing sound @@ -10252,7 +10244,7 @@ void P_SpawnPrecipitation(void) continue; // Exists, but is too small for reasonable precipitation. - if (!(precipsector->sector->floorheight <= precipsector->sector->ceilingheight - (32<sector->ceilingheight - precipsector->sector->floorheight, mapobjectscale) < 64<type == MT_HOOP) - return; - - // These are NEVER saved. - if (mobj->type == MT_HOOPCOLLIDE) + if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE) // These are NEVER saved. return; // This hoop has already been collected. @@ -1905,13 +1901,13 @@ static inline mobj_t *LoadMobj(UINT32 mobjnum) return (mobj_t *)(size_t)mobjnum; } -static sector_t *LoadSector(UINT32 sector) +static inline sector_t *LoadSector(UINT32 sector) { if (sector >= numsectors) return NULL; return §ors[sector]; } -static line_t *LoadLine(UINT32 line) +static inline line_t *LoadLine(UINT32 line) { if (line >= numlines) return NULL; return &lines[line]; @@ -2669,8 +2665,6 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save) { thinker_t *currentthinker; thinker_t *next; - thinker_t *currentprecipthinker; - thinker_t *nextprecip; UINT8 tclass; UINT8 restoreNum = false; UINT32 i; @@ -2696,22 +2690,7 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save) } // remove all the current precip thinkers - currentprecipthinker = precipcap.next; - for (currentprecipthinker = precipcap.next; currentprecipthinker != &precipcap; currentprecipthinker = nextprecip) - { - nextprecip = currentprecipthinker->next; - -#ifdef PARANOIA - if (currentprecipthinker->function.acp1 != (actionf_p1)P_NullPrecipThinker) - { - (next->prev = currentprecipthinker->prev)->next = nextprecip; - R_DestroyLevelInterpolators(currentprecipthinker); - Z_Free(currentprecipthinker); - } - else -#endif - P_RemoveSavegameMobj((mobj_t *)currentprecipthinker); // item isn't saved, don't remove it - } + P_PurgePrecipitation(); // we don't want the removed mobjs to come back iquetail = iquehead = 0; @@ -3039,7 +3018,7 @@ static void P_RelinkPointers(void) mobj = (mobj_t *)currentthinker; - if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER) + if (UNLIKELY(mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER)) continue; #define RELINK(obj, name) if ((obj) && !RelinkMobj(&(obj))) \ @@ -3456,7 +3435,7 @@ void P_SaveNetGame(savebuffer_t *save, boolean resending) mobj = (mobj_t *)th; - if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER) + if (UNLIKELY(mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER)) continue; mobj->mobjnum = i++; diff --git a/src/p_setup.c b/src/p_setup.c index e4c22f253..399276474 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; @@ -354,6 +357,7 @@ void P_AllocMapHeader(INT16 i) mapheaderinfo[i] = Z_Malloc(sizeof(mapheader_t), PU_STATIC, NULL); mapheaderinfo[i]->grades = NULL; } + P_ClearSingleMapHeaderInfo(i + 1); } @@ -431,8 +435,10 @@ UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare) if (pscore >= mapheaderinfo[map-1]->grades[mare].grade[i]) ++pgrade; } + return (UINT8)pgrade; } + return 0; } @@ -440,10 +446,8 @@ UINT8 P_HasGrades(INT16 map, UINT8 mare) { // Determining the grade // Mare 0 is treated as overall and is true if ANY grades exist - if (mapheaderinfo[map-1] && mapheaderinfo[map-1]->grades - && (mare == 0 || mapheaderinfo[map-1]->numGradedMares >= mare)) - return true; - return false; + return (mapheaderinfo[map-1] && mapheaderinfo[map-1]->grades + && (mare == 0 || mapheaderinfo[map-1]->numGradedMares >= mare)); } UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade) @@ -752,7 +756,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 @@ -793,7 +797,7 @@ INT32 P_AddLevelFlatRuntime(const char *flatname) // 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 @@ -834,7 +838,7 @@ INT32 P_CheckLevelFlat(const char *flatname) // 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; if (i == numlevelflats) @@ -947,6 +951,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]); @@ -1347,10 +1352,180 @@ static void P_LoadLineDefs2(void) } } +static void P_LoadSideColormaps(mapsidedef_t *msd, side_t *sd, sector_t *sec) +{ + INT32 num; + +#ifdef HWRENDER + if (rendermode == render_opengl) + { + // for now, full support of toptexture only + if ((msd->toptexture[0] == '#' && msd->toptexture[1] && msd->toptexture[2] && msd->toptexture[3] && msd->toptexture[4] && msd->toptexture[5] && msd->toptexture[6]) + || (msd->bottomtexture[0] == '#' && msd->bottomtexture[1] && msd->bottomtexture[2] && msd->bottomtexture[3] && msd->bottomtexture[4] && msd->bottomtexture[5] && msd->bottomtexture[6])) + { + char *col; + RGBA_t color; + size_t j; + + sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture, + msd->bottomtexture); + sd->toptexture = sd->bottomtexture = 0; +#define HEX2INT(x) (x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0) +#define ALPHA2INT(x) (x >= 'a' && x <= 'z' ? x - 'a' : x >= 'A' && x <= 'Z' ? x - 'A' : x >= '0' && x <= '9' ? 25 : 0) + sec->extra_colormap = &extra_colormaps[sec->midmap]; + + if (msd->toptexture[0] == '#' && msd->toptexture[1] && msd->toptexture[2] && msd->toptexture[3] && msd->toptexture[4] && msd->toptexture[5] && msd->toptexture[6]) + { + col = msd->toptexture; + + // encore mode colormaps! + // do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code. + // do this for both the start and fade colormaps. + + color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); + color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); + color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); + +#ifdef GLENCORE + if (encoremap) + { + j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)]; + color = pLocalPalette[j]; // note: this sets alpha to 255, we will reset it below + } +#endif + color.s.alpha = 0; // reset/init the alpha, so the addition below will work correctly + sec->extra_colormap->rgba = color.rgba; + + // alpha + if (msd->toptexture[7]) + sec->extra_colormap->rgba += (ALPHA2INT(col[7]) << 24); + else + sec->extra_colormap->rgba += (25 << 24); + } + else + sec->extra_colormap->rgba = 0; + + if (msd->bottomtexture[0] == '#' && msd->bottomtexture[1] && msd->bottomtexture[2] && msd->bottomtexture[3] && msd->bottomtexture[4] && msd->bottomtexture[5] && msd->bottomtexture[6]) + { + col = msd->bottomtexture; + + // do the exact same thing as above here. + + color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); + color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); + color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); + +#ifdef GLENCORE + if (encoremap) + { + j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)]; + color = pLocalPalette[j]; // note: this sets alpha to 255, we will reset it below + } +#endif + color.s.alpha = 0; // reset/init the alpha, so the addition below will work correctly + sec->extra_colormap->fadergba = color.rgba; + + // alpha + if (msd->bottomtexture[7]) + sec->extra_colormap->fadergba += (ALPHA2INT(col[7]) << 24); + else + sec->extra_colormap->fadergba += (25 << 24); + } + else + sec->extra_colormap->fadergba = 0x19000000; // default alpha, (25 << 24) +#undef ALPHA2INT +#undef HEX2INT + } + else + { + if ((num = R_CheckTextureNumForName(msd->toptexture)) == -1) + sd->toptexture = 0; + else + sd->toptexture = num; + + if ((num = R_CheckTextureNumForName(msd->midtexture)) == -1) + sd->midtexture = 0; + else + sd->midtexture = num; + + if ((num = R_CheckTextureNumForName(msd->bottomtexture)) == -1) + sd->bottomtexture = 0; + else + sd->bottomtexture = num; + } + } +#endif +#ifdef HWRENDER + else +#endif + { + if (msd->toptexture[0] == '#' || msd->bottomtexture[0] == '#') + { + sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture, + msd->bottomtexture); + sd->toptexture = sd->bottomtexture = 0; + } + else + { + if ((num = R_CheckTextureNumForName(msd->toptexture)) == -1) + sd->toptexture = 0; + else + sd->toptexture = num; + if ((num = R_CheckTextureNumForName(msd->midtexture)) == -1) + sd->midtexture = 0; + else + sd->midtexture = num; + if ((num = R_CheckTextureNumForName(msd->bottomtexture)) == -1) + sd->bottomtexture = 0; + else + sd->bottomtexture = num; + } + } +} + +static void P_LoadSideChangeMusic(boolean firstside, mapsidedef_t *msd, side_t *sd) +{ + char process[8+1]; + + sd->toptexture = sd->midtexture = sd->bottomtexture = 0; + + if (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0') + { + M_Memcpy(process,msd->bottomtexture,8); + process[8] = '\0'; + sd->bottomtexture = get_number(process); + } + + if (!(msd->midtexture[0] == '-' && msd->midtexture[1] == '\0') || msd->midtexture[1] != '\0') + { + M_Memcpy(process,msd->midtexture,8); + process[8] = '\0'; + sd->midtexture = get_number(process); + } + + // always process if back sidedef, because we need that - symbol + sd->text = Z_Malloc(7, PU_LEVEL, NULL); + + if (firstside || msd->toptexture[0] != '-' || msd->toptexture[1] != '\0') + { + M_Memcpy(process,msd->toptexture,8); + process[8] = '\0'; + + // If they type in O_ or D_ and their music name, just shrug, + // then copy the rest instead. + if ((process[0] == 'O' || process[0] == 'D') && process[7]) + M_Memcpy(sd->text, process+2, 6); + else // Assume it's a proper music name. + M_Memcpy(sd->text, process, 6); + sd->text[6] = 0; + } + else + sd->text[0] = 0; +} + static void P_LoadRawSideDefs2(void *data) { UINT16 i; - INT32 num; for (i = 0; i < numsides; i++) { @@ -1384,186 +1559,11 @@ static void P_LoadRawSideDefs2(void *data) case 606: //SoM: 4/4/2000: Just colormap transfer // SoM: R_CreateColormap will only create a colormap in software mode... // Perhaps we should just call it instead of doing the calculations here. -#ifdef HWRENDER - if (rendermode != render_opengl) -#endif - { - if (msd->toptexture[0] == '#' || msd->bottomtexture[0] == '#') - { - sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture, - msd->bottomtexture); - sd->toptexture = sd->bottomtexture = 0; - } - else - { - if ((num = R_CheckTextureNumForName(msd->toptexture)) == -1) - sd->toptexture = 0; - else - sd->toptexture = num; - if ((num = R_CheckTextureNumForName(msd->midtexture)) == -1) - sd->midtexture = 0; - else - sd->midtexture = num; - if ((num = R_CheckTextureNumForName(msd->bottomtexture)) == -1) - sd->bottomtexture = 0; - else - sd->bottomtexture = num; - } - break; - } -#ifdef HWRENDER - else - { - // for now, full support of toptexture only - if ((msd->toptexture[0] == '#' && msd->toptexture[1] && msd->toptexture[2] && msd->toptexture[3] && msd->toptexture[4] && msd->toptexture[5] && msd->toptexture[6]) - || (msd->bottomtexture[0] == '#' && msd->bottomtexture[1] && msd->bottomtexture[2] && msd->bottomtexture[3] && msd->bottomtexture[4] && msd->bottomtexture[5] && msd->bottomtexture[6])) - { - char *col; - RGBA_t color; - size_t j; - - sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture, - msd->bottomtexture); - sd->toptexture = sd->bottomtexture = 0; -#define HEX2INT(x) (x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0) -#define ALPHA2INT(x) (x >= 'a' && x <= 'z' ? x - 'a' : x >= 'A' && x <= 'Z' ? x - 'A' : x >= '0' && x <= '9' ? 25 : 0) - sec->extra_colormap = &extra_colormaps[sec->midmap]; - - if (msd->toptexture[0] == '#' && msd->toptexture[1] && msd->toptexture[2] && msd->toptexture[3] && msd->toptexture[4] && msd->toptexture[5] && msd->toptexture[6]) - { - col = msd->toptexture; - - // encore mode colormaps! - // do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code. - // do this for both the start and fade colormaps. - - color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); - color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); - color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); - -#ifdef GLENCORE - if (encoremap) - { - j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)]; - //CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation - color = pLocalPalette[j]; // note: this sets alpha to 255, we will reset it below - } -#endif - color.s.alpha = 0; // reset/init the alpha, so the addition below will work correctly - sec->extra_colormap->rgba = color.rgba; - - // alpha - if (msd->toptexture[7]) - sec->extra_colormap->rgba += (ALPHA2INT(col[7]) << 24); - else - sec->extra_colormap->rgba += (25 << 24); - - /*nearest = NearestColor( - (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0), - (HEX2INT(col[3]) << 4) + (HEX2INT(col[4]) << 0), - (HEX2INT(col[5]) << 4) + (HEX2INT(col[6]) << 0) - ); - - sec->extra_colormap->rgba = - pLocalPalette[nearest].s.red + - (pLocalPalette[nearest].s.green << 8) + - (pLocalPalette[nearest].s.blue << 16);*/ - } - else - sec->extra_colormap->rgba = 0; - - if (msd->bottomtexture[0] == '#' && msd->bottomtexture[1] && msd->bottomtexture[2] && msd->bottomtexture[3] && msd->bottomtexture[4] && msd->bottomtexture[5] && msd->bottomtexture[6]) - { - col = msd->bottomtexture; - - // do the exact same thing as above here. - - color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]); - color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]); - color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]); - -#ifdef GLENCORE - if (encoremap) - { - j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)]; - //CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation - color = pLocalPalette[j]; // note: this sets alpha to 255, we will reset it below - } -#endif - color.s.alpha = 0; // reset/init the alpha, so the addition below will work correctly - sec->extra_colormap->fadergba = color.rgba; - - // alpha - if (msd->bottomtexture[7]) - sec->extra_colormap->fadergba += (ALPHA2INT(col[7]) << 24); - else - sec->extra_colormap->fadergba += (25 << 24); - } - else - sec->extra_colormap->fadergba = 0x19000000; // default alpha, (25 << 24) -#undef ALPHA2INT -#undef HEX2INT - } - else - { - if ((num = R_CheckTextureNumForName(msd->toptexture)) == -1) - sd->toptexture = 0; - else - sd->toptexture = num; - - if ((num = R_CheckTextureNumForName(msd->midtexture)) == -1) - sd->midtexture = 0; - else - sd->midtexture = num; - - if ((num = R_CheckTextureNumForName(msd->bottomtexture)) == -1) - sd->bottomtexture = 0; - else - sd->bottomtexture = num; - } - break; - } -#endif - + P_LoadSideColormaps(msd, sd, sec); + break; case 413: // Change music - { - char process[8+1]; - - sd->toptexture = sd->midtexture = sd->bottomtexture = 0; - if (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0') - { - M_Memcpy(process,msd->bottomtexture,8); - process[8] = '\0'; - sd->bottomtexture = get_number(process); - } - - if (!(msd->midtexture[0] == '-' && msd->midtexture[1] == '\0') || msd->midtexture[1] != '\0') - { - M_Memcpy(process,msd->midtexture,8); - process[8] = '\0'; - sd->midtexture = get_number(process); - } - - // always process if back sidedef, because we need that - symbol - sd->text = Z_Malloc(7, PU_LEVEL, NULL); - if (i == 1 || msd->toptexture[0] != '-' || msd->toptexture[1] != '\0') - { - M_Memcpy(process,msd->toptexture,8); - process[8] = '\0'; - - // If they type in O_ or D_ and their music name, just shrug, - // then copy the rest instead. - if ((process[0] == 'O' || process[0] == 'D') && process[7]) - M_Memcpy(sd->text, process+2, 6); - else // Assume it's a proper music name. - M_Memcpy(sd->text, process, 6); - sd->text[6] = 0; - } - else - sd->text[0] = 0; + P_LoadSideChangeMusic((i == 1), msd, sd); break; - } - case 4: // Speed pad parameters case 414: // Play SFX { @@ -1577,7 +1577,6 @@ static void P_LoadRawSideDefs2(void *data) } break; } - case 9: // Mace parameters case 14: // Bustable block parameters case 15: // Fan particle spawner parameters @@ -1597,9 +1596,9 @@ static void P_LoadRawSideDefs2(void *data) if (msd->bottomtexture[0] != '-' || msd->bottomtexture[1] != '\0') M_Memcpy(process+strlen(process), msd->bottomtexture, 8); sd->toptexture = get_number(process); + break; } - case 443: // Calls a named Lua function { char process[8*3+1]; @@ -1615,9 +1614,9 @@ static void P_LoadRawSideDefs2(void *data) M_Memcpy(process+strlen(process), msd->bottomtexture, 8); sd->text = Z_Malloc(strlen(process)+1, PU_LEVEL, NULL); M_Memcpy(sd->text, process, strlen(process)+1); + break; } - default: // normal cases if (msd->toptexture[0] == '#') { @@ -1637,6 +1636,7 @@ static void P_LoadRawSideDefs2(void *data) break; } } + R_ClearTextureNumCache(true); } @@ -2313,6 +2313,7 @@ static void P_LevelInitStuff(boolean reloadinggamestate) gamespeed = 0; else gamespeed = (UINT8)cv_kartspeed.value; + franticitems = (boolean)cv_kartfrantic.value; comeback = (boolean)cv_kartcomeback.value; } @@ -2321,43 +2322,6 @@ static void P_LevelInitStuff(boolean reloadinggamestate) battlewanted[i] = -1; } -// -// P_LoadThingsOnly -// -// "Reloads" a level, but only reloads all of the mobjs. -// -void P_LoadThingsOnly(void) -{ - // Search through all the thinkers. - mobj_t *mo; - thinker_t *think; - - virtres_t* virt = vres_GetMap(lastloadedmaplumpnum); - virtlump_t* vth = vres_Find(virt, "THINGS"); - - for (think = thinkercap.next; think != &thinkercap; think = think->next) - { - if (think->function.acp1 != (actionf_p1)P_MobjThinker) - continue; // not a mobj thinker - - mo = (mobj_t *)think; - - if (mo) - P_RemoveMobj(mo); - } - - P_LevelInitStuff(false); - - memset(localaiming, 0, sizeof(localaiming)); - - P_PrepareRawThings(vth->data); - P_LoadThings(); - - vres_Free(virt); - - P_SpawnSecretItems(true); -} - /** Compute MD5 message digest for bytes read from memory source * * The resulting message digest number will be written into the 16 bytes @@ -2376,10 +2340,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 +2428,7 @@ static void P_RunLevelScript(const char *scriptname) { COM_BufAddText(va("exec %s\n", scriptname)); } + COM_BufExecute(); // Run it! } @@ -2663,11 +2632,6 @@ static void P_InitCamera(void) displayplayers[0] = consoleplayer; // Start with your OWN view, please! } -static boolean P_CanSave(void) -{ - return false; // SRB2Kart: no SP, no saving. -} - struct minimapinfo minimapinfo; static void P_InitMinimapInfo(void) { @@ -2760,7 +2724,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 +2742,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 +2763,7 @@ static void P_SetupPlayer(void) INT32 i; for (i = 0; i < MAXPLAYERS; i++) + { if (playeringame[i]) { players[i].pflags &= ~PF_NIGHTSMODE; @@ -2812,15 +2779,10 @@ static void P_SetupPlayer(void) else // gametype is GT_COOP or GT_RACE { players[i].mo = NULL; - - if (players[i].starposttime) - { - G_SpawnPlayer(i, true); - } - else - G_SpawnPlayer(i, false); + G_SpawnPlayer(i, (players[i].starposttime)); } } + } if (modeattacking == ATTACKING_RECORD && !demo.playback) P_LoadRecordGhosts(); @@ -3077,10 +3039,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(); @@ -3113,9 +3073,8 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate) if (rendermode == render_opengl) { HWR_FreeExtraSubsectors(); - - // stuff like HWR_CreatePlanePolygons is called there - HWR_LoadLevel(); + // Create plane polygons. + HWR_LoadLevel(reloadinggamestate); } #endif @@ -3158,9 +3117,6 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate) P_RunCachedActions(); - if (P_CanSave()) - G_SaveGame((UINT32)cursaveslot); - if (savedata.lives > 0) { players[consoleplayer].continues = savedata.continues; @@ -3180,12 +3136,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)); } @@ -3238,17 +3197,6 @@ boolean P_AddWadFile(const char *wadfilename, boolean local) return true; } -boolean P_AddWadFileLocal(const char *wadfilename) -{ - UINT16 wadnum; - - if ((wadnum = P_PartialAddWadFile(wadfilename, true)) == UINT16_MAX) - return false; - - P_MultiSetupWadFiles(true); - return true; -} - // check for replacement votescreen backgrounds boolean wideracereplaced = false; boolean racereplaced = false; @@ -3273,7 +3221,8 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local) CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename); return UINT16_MAX; } - else wadnum = (UINT16)(numwadfiles-1); + + wadnum = (UINT16)(numwadfiles-1); if (wadfiles[wadnum]->important) partadd_important = true; diff --git a/src/p_setup.h b/src/p_setup.h index 723b48d18..97209e154 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -60,13 +60,13 @@ extern size_t nummapthings; extern mapthing_t *mapthings; void P_SetupLevelSky(INT32 skynum, boolean global); -void P_LoadThingsOnly(void); boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate); + #ifdef HWRENDER -void HWR_LoadLevel(void); +void HWR_LoadLevel(boolean reloadinggamestate); #endif + boolean P_AddWadFile(const char *wadfilename, boolean local); -boolean P_AddWadFileLocal(const char *wadfilename); extern boolean wideracereplaced; extern boolean racereplaced; diff --git a/src/p_slopes.c b/src/p_slopes.c index e64cd6f6b..b4ebf0284 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -500,6 +500,7 @@ void P_SpawnSlope_Line(int linenum) P_CalculateSlopeNormal(cslope); } } + if (backfloor || backceil) { line->backsector->hasslope = true; // Tell the software renderer that we're sloped @@ -511,7 +512,7 @@ void P_SpawnSlope_Line(int linenum) extent = P_GetExtent(line->backsector, line); - if(extent < 0) + if (extent < 0) { CONS_Printf("P_SpawnSlope_Line failed to get backsector extent on line number %i\n", linenum); return; @@ -678,8 +679,6 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag return ret; } - - // // P_CopySectorSlope // diff --git a/src/p_spec.c b/src/p_spec.c index 670289fcf..e14d09333 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1721,6 +1721,19 @@ static boolean is_rain_type (INT32 weathernum) } } +void P_PurgePrecipitation(void) +{ + thinker_t *think; + thinker_t *next; + + for (think = precipcap.next; think != NULL && think != &precipcap;) + { + next = think->next; + P_FreePrecipMobj((precipmobj_t *)think); + think = next; + } +} + // // P_SwitchWeather // @@ -1729,6 +1742,7 @@ static boolean is_rain_type (INT32 weathernum) void P_SwitchWeather(INT32 weathernum) { boolean purge = true; + boolean spawnprecip = false; if (weathernum == curWeather) return; @@ -1739,22 +1753,7 @@ void P_SwitchWeather(INT32 weathernum) if (purge) { - thinker_t *think; - thinker_t *next; - precipmobj_t *precipmobj; - - for (think = precipcap.next; think != &precipcap; think = next) - { - next = think->next; - -#ifdef PARANOIA - if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) - continue; // not a precipmobj thinker -#endif - - precipmobj = (precipmobj_t *)think; - P_FreePrecipMobj(precipmobj); - } + P_PurgePrecipitation(); } else // Rather than respawn all that crap, reuse it! { @@ -1764,11 +1763,6 @@ void P_SwitchWeather(INT32 weathernum) for (think = precipcap.next; think != &precipcap; think = think->next) { -#ifdef PARANOIA - if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) - continue; // not a precipmobj thinker -#endif - precipmobj = (precipmobj_t *)think; INT32 z = 0; @@ -1813,8 +1807,6 @@ void P_SwitchWeather(INT32 weathernum) } } - boolean spawnprecip = false; - switch (weathernum) { case PRECIP_SNOW: // snow @@ -1822,23 +1814,17 @@ void P_SwitchWeather(INT32 weathernum) spawnprecip = true; break; case PRECIP_RAIN: // rain - { curWeather = PRECIP_RAIN; spawnprecip = true; break; - } case PRECIP_STORM: // storm - { curWeather = PRECIP_STORM; spawnprecip = true; break; - } case PRECIP_STORM_NOSTRIKES: // storm w/o lightning - { curWeather = PRECIP_STORM_NOSTRIKES; spawnprecip = true; break; - } case PRECIP_STORM_NORAIN: // storm w/o rain curWeather = PRECIP_STORM_NORAIN; break; diff --git a/src/p_spec.h b/src/p_spec.h index c89d024d2..60b10a8f4 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -74,6 +74,7 @@ INT32 P_FindMinSurroundingLight(sector_t *sector, INT32 max); void P_SetupSignExit(player_t *player); boolean P_IsFlagAtBase(mobjtype_t flag); +void P_PurgePrecipitation(void); void P_SwitchWeather(INT32 weathernum); boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller); diff --git a/src/p_user.c b/src/p_user.c index c9712048e..31e6a52ef 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4436,40 +4436,38 @@ DoABarrelRoll (player_t *player) player->tilt = slope; } -#define SPINOUTROTSPEED (24 * FRACUNIT) -#define MAXSPINROT (360 * FRACUNIT) - -static void P_DoFunnyDance (player_t *player) +// mhhm this is definitely not mostly copy pasted code from SRB2s music test (: +// TODO: make this sane lmao +static void P_DoFunnyDance(player_t *player) { - static tic_t time = 0; - fixed_t bounce; - fixed_t work, bpm; - angle_t ang; + static const fixed_t bpm = 983040; // 140bpm ish if (player->spectator || !player->mo || player->kartstuff[k_respawn] || player->mo->salty_jump) // this looks jank as hell during hop return; - bounce = 0; + player->squishdance.bounce = 0; - // bpm = FLOAT_TO_FIXED(mapmusic.bpm) << maybe can get the tempo and beat detection lib to work for bpm autodetection - bpm = FixedDiv((60*TICRATE)<squishdance.work = (player->squishdance.time << FRACBITS) % bpm; - if (time >= (FRACUNIT>>1)) // prevent overflow jump - takes about 15 minutes - time = (work>>FRACBITS); + if (player->squishdance.time >= (FRACUNIT >> 1)) // prevent overflow jump - takes about 15 minutes + player->squishdance.time = (player->squishdance.work >> FRACBITS); - work = FixedDiv(work*180, bpm); + player->squishdance.work = FixedDiv(player->squishdance.work*180, bpm); - ang = (FixedAngle(work)>>ANGLETOFINESHIFT) & FINEMASK; - bounce = (FINESINE(ang) - FRACUNIT/2); + player->squishdance.ang = ((FixedAngle(player->squishdance.work) >> ANGLETOFINESHIFT) & FINEMASK); + player->squishdance.bounce = ((FINESINE(player->squishdance.ang) - FRACUNIT/2) / 2); - player->mo->spritexscale -= bounce/2; - player->mo->spriteyscale += bounce/2; + player->mo->spritexscale -= player->squishdance.bounce; + player->mo->spriteyscale += player->squishdance.bounce; - time++; // bruh + player->squishdance.time++; } +#define SPINOUTROTSPEED (24 * FRACUNIT) +#define MAXSPINROT (360 * FRACUNIT) + // // P_PlayerThink // @@ -5009,13 +5007,16 @@ void P_PlayerThink(player_t *player) if (cv_squishdance.value && (cmd->buttons & BT_CUSTOM3)) { - player->dancetime++; + player->squishdance.countdown++; - if (player->dancetime > TICRATE*2) + if (player->squishdance.countdown > TICRATE*2) P_DoFunnyDance(player); } else - player->dancetime = 0; + { + player->squishdance.countdown = 0; + player->squishdance.time = 0; + } // Flash player after being hit. if (!(player->kartstuff[k_hyudorotimer] // SRB2kart - fixes Hyudoro not flashing when it should. diff --git a/src/r_main.c b/src/r_main.c index 4ff9a96ff..b1b707d1d 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -295,27 +295,11 @@ static void FlipCam4_OnChange(void) static void Precipstuff_OnChange(void) { - if (gamestate != GS_LEVEL) - return; - - thinker_t *think; - thinker_t *next; - precipmobj_t *precipmobj; - - for (think = precipcap.next; think != &precipcap; think = next) + if (gamestate == GS_LEVEL) { - next = think->next; - -#ifdef PARANOIA - if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) - continue; // not a precipmobj thinker -#endif - - precipmobj = (precipmobj_t *)think; - P_FreePrecipMobj(precipmobj); + P_PurgePrecipitation(); + P_SpawnPrecipitation(); } - - P_SpawnPrecipitation(); } // diff --git a/src/r_things.c b/src/r_things.c index ddae1d7ec..45afd824d 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2856,7 +2856,7 @@ void R_ClipSprites(void) /* Check if thing may be drawn from our current view. */ boolean R_ThingVisible (mobj_t *thing) { - if (UNLIKELY(thing->sprite == SPR_NULL) || UNLIKELY((thing->flags2 & MF2_DONTDRAW))) + if (UNLIKELY((thing->sprite == SPR_NULL) || (thing->flags2 & MF2_DONTDRAW))) return false; if (splitscreen) @@ -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; @@ -3163,11 +3163,11 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar) INT32 i; player_t *player = &players[playernum]; - if (strcasecmp(skinname, "none")) + if (stricmp(skinname, "none")) { for (i = 0; i < numlocalskins; i++) { - // search in the skin list + // search in the localskin list if (stricmp(localskins[i].name, skinname) == 0) { player->localskin = 1 + i; @@ -3177,9 +3177,11 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar) player->mo->localskin = &localskins[i]; player->mo->skinlocal = true; } - break; + + goto setcvar; } } + for (i = 0; i < numskins; i++) { // search in the skin list @@ -3192,7 +3194,8 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar) player->mo->localskin = &skins[i]; player->mo->skinlocal = false; } - break; + + goto setcvar; } } } @@ -3207,6 +3210,7 @@ void SetLocalPlayerSkin(INT32 playernum, const char *skinname, consvar_t *cvar) } } +setcvar: if (cvar != NULL) { if (player->localskin > 0) @@ -3254,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 } @@ -3700,7 +3705,6 @@ next_token: numallskins++; } -#undef lskin #undef lnumskins //sortSkinGrid(); diff --git a/src/st_stuff.c b/src/st_stuff.c index 6e39661e7..aac9b7fa7 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -506,8 +506,8 @@ static void ST_drawLevelTitle(void) static const char *ST_GetButtonName(INT32 control, const char *inputtext, boolean unbound, boolean gamectrl) { static char buttname[32] = ""; - const char *butt1 = (gamecontrol[control][0] != 0 ? G_KeynumToString(gamecontrol[control][0]) : NULL); - const char *butt2 = (gamecontrol[control][1] != 0 ? G_KeynumToString(gamecontrol[control][1]) : NULL); // alternative bind + const char *butt1 = (gamecontrol[0][control][0] != 0 ? G_KeynumToString(gamecontrol[0][control][0]) : NULL); + const char *butt2 = (gamecontrol[0][control][1] != 0 ? G_KeynumToString(gamecontrol[0][control][1]) : NULL); // alternative bind if (butt1 == NULL && butt2 == NULL) // not bound to a button snprintf(buttname, 32, (unbound ? "%s - %s" : (gamectrl ? "-%s - %s" : "%s - %s")), (unbound ? "Unbound" : ""), inputtext); diff --git a/src/tables.c b/src/tables.c index e293842bc..98a2c8a17 100644 --- a/src/tables.c +++ b/src/tables.c @@ -274,7 +274,7 @@ boolean FV2_InsidePolygon(const vector2_t *vIntersection, const vector2_t *Poly, // with floating point numbers. It usually won't always be perfectly 2 * PI, so we need // to use a little twiddling. I use .9999, but you can change this to fit your own desired accuracy. - if(Angle >= ANGLE_MAX) // If the angle is greater than 2 PI, (360 degrees) + if (Angle >= ANGLE_MAX) // If the angle is greater than 2 PI, (360 degrees) return 1; // The point is inside of the polygon return 0; // If you get here, it obviously wasn't inside the polygon. diff --git a/src/w_wad.c b/src/w_wad.c index 6432c3223..3a9ab6c6c 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -898,8 +898,10 @@ INT32 W_InitMultipleFiles(char **filenames, boolean addons) //CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames); rc = W_InitFile(*filenames, false); + if (rc == INT16_MAX) CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames); + overallrc &= (rc != INT16_MAX) ? 1 : 0; } @@ -918,8 +920,10 @@ INT32 W_AddAutoloadedLocalFiles(char **filenames) for (; *filenames; filenames++) { rc = P_PartialAddWadFile(*filenames, true); + if (rc == UINT16_MAX) CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames); + overallrc &= (rc != UINT16_MAX) ? 1 : 0; } @@ -928,6 +932,7 @@ INT32 W_AddAutoloadedLocalFiles(char **filenames) if (P_PartialAddGetStage() >= 0) P_MultiSetupWadFiles(true); + return overallrc; }