Merge remote-tracking branch 'STJrSRB2/master' into patch-1

This commit is contained in:
GoldenTails 2018-07-05 16:44:34 -05:00
commit 761a221840
10 changed files with 45 additions and 39 deletions

View File

@ -401,8 +401,7 @@ static void ExtraDataTicker(void)
DEBFILE(va("player %d kicked [gametic=%u] reason as follows:\n", i, gametic)); DEBFILE(va("player %d kicked [gametic=%u] reason as follows:\n", i, gametic));
} }
CONS_Alert(CONS_WARNING, M_GetText("Got unknown net command [%s]=%d (max %d)\n"), sizeu1(curpos - bufferstart), *curpos, bufferstart[0]); CONS_Alert(CONS_WARNING, M_GetText("Got unknown net command [%s]=%d (max %d)\n"), sizeu1(curpos - bufferstart), *curpos, bufferstart[0]);
D_FreeTextcmd(gametic); break;
return;
} }
} }
} }
@ -3308,7 +3307,7 @@ void SV_StopServer(void)
localtextcmd[0] = 0; localtextcmd[0] = 0;
localtextcmd2[0] = 0; localtextcmd2[0] = 0;
for (i = 0; i < BACKUPTICS; i++) for (i = firstticstosend; i < firstticstosend + BACKUPTICS; i++)
D_Clearticcmd(i); D_Clearticcmd(i);
consoleplayer = 0; consoleplayer = 0;

View File

@ -730,11 +730,6 @@ void D_StartTitle(void)
CON_ToggleOff(); CON_ToggleOff();
// Reset the palette // Reset the palette
#ifdef HWRENDER
if (rendermode == render_opengl)
HWR_SetPaletteColor(0);
else
#endif
if (rendermode != render_none) if (rendermode != render_none)
V_SetPaletteLump("PLAYPAL"); V_SetPaletteLump("PLAYPAL");
} }
@ -1056,15 +1051,6 @@ void D_SRB2Main(void)
if (M_CheckParm("-password") && M_IsNextParm()) if (M_CheckParm("-password") && M_IsNextParm())
D_SetPassword(M_GetNextParm()); D_SetPassword(M_GetNextParm());
else
{
size_t z;
char junkpw[25];
for (z = 0; z < 24; z++)
junkpw[z] = (char)(rand() & 64)+32;
junkpw[24] = '\0';
D_SetPassword(junkpw);
}
// add any files specified on the command line with -file wadfile // add any files specified on the command line with -file wadfile
// to the wad list // to the wad list
@ -1223,7 +1209,7 @@ void D_SRB2Main(void)
CONS_Printf("R_Init(): Init SRB2 refresh daemon.\n"); CONS_Printf("R_Init(): Init SRB2 refresh daemon.\n");
R_Init(); R_Init();
// setting up sound // setting up sound
if (dedicated) if (dedicated)
{ {
nosound = true; nosound = true;

View File

@ -2656,10 +2656,12 @@ static void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt,
#define BASESALT "basepasswordstorage" #define BASESALT "basepasswordstorage"
static UINT8 adminpassmd5[16]; static UINT8 adminpassmd5[16];
static boolean adminpasswordset = false;
void D_SetPassword(const char *pw) void D_SetPassword(const char *pw)
{ {
D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &adminpassmd5); D_MD5PasswordPass((const UINT8 *)pw, strlen(pw), BASESALT, &adminpassmd5);
adminpasswordset = true;
} }
// Remote Administration // Remote Administration
@ -2728,6 +2730,12 @@ static void Got_Login(UINT8 **cp, INT32 playernum)
READMEM(*cp, sentmd5, 16); READMEM(*cp, sentmd5, 16);
if (!adminpasswordset)
{
CONS_Printf(M_GetText("Password from %s failed (no password set).\n"), player_names[playernum]);
return;
}
if (client) if (client)
return; return;
@ -3951,7 +3959,7 @@ static void Command_RestartAudio_f(void)
I_ShutdownSound(); I_ShutdownSound();
I_StartupSound(); I_StartupSound();
I_InitMusic(); I_InitMusic();
// These must be called or no sound and music until manually set. // These must be called or no sound and music until manually set.
I_SetSfxVolume(cv_soundvolume.value); I_SetSfxVolume(cv_soundvolume.value);
@ -3959,7 +3967,7 @@ static void Command_RestartAudio_f(void)
I_SetMIDIMusicVolume(cv_midimusicvolume.value); I_SetMIDIMusicVolume(cv_midimusicvolume.value);
if (Playing()) // Gotta make sure the player is in a level if (Playing()) // Gotta make sure the player is in a level
P_RestoreMusic(&players[consoleplayer]); P_RestoreMusic(&players[consoleplayer]);
} }
/** Quits a game and returns to the title screen. /** Quits a game and returns to the title screen.

View File

@ -2901,8 +2901,8 @@ static boolean HWR_CheckBBox(fixed_t *bspcoord)
py2 = bspcoord[checkcoord[boxpos][3]]; py2 = bspcoord[checkcoord[boxpos][3]];
// check clip list for an open space // check clip list for an open space
angle1 = R_PointToAngle(px1, py1) - dup_viewangle; angle1 = R_PointToAngle2(dup_viewx>>1, dup_viewy>>1, px1>>1, py1>>1) - dup_viewangle;
angle2 = R_PointToAngle(px2, py2) - dup_viewangle; angle2 = R_PointToAngle2(dup_viewx>>1, dup_viewy>>1, px2>>1, py2>>1) - dup_viewangle;
span = angle1 - angle2; span = angle1 - angle2;
@ -4228,6 +4228,9 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
i = 0; i = 0;
temp = FLOAT_TO_FIXED(realtop); temp = FLOAT_TO_FIXED(realtop);
if (spr->mobj->frame & FF_FULLBRIGHT)
lightlevel = 255;
#ifdef ESLOPE #ifdef ESLOPE
for (i = 1; i < sector->numlights; i++) for (i = 1; i < sector->numlights; i++)
{ {
@ -4235,14 +4238,16 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
: sector->lightlist[i].height; : sector->lightlist[i].height;
if (h <= temp) if (h <= temp)
{ {
lightlevel = *list[i-1].lightlevel; if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *list[i-1].lightlevel;
colormap = list[i-1].extra_colormap; colormap = list[i-1].extra_colormap;
break; break;
} }
} }
#else #else
i = R_GetPlaneLight(sector, temp, false); i = R_GetPlaneLight(sector, temp, false);
lightlevel = *list[i].lightlevel; if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *list[i].lightlevel;
colormap = list[i].extra_colormap; colormap = list[i].extra_colormap;
#endif #endif
@ -4257,7 +4262,8 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
// even if we aren't changing colormap or lightlevel, we still need to continue drawing down the sprite // even if we aren't changing colormap or lightlevel, we still need to continue drawing down the sprite
if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES)) if (!(list[i].flags & FF_NOSHADE) && (list[i].flags & FF_CUTSPRITES))
{ {
lightlevel = *list[i].lightlevel; if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *list[i].lightlevel;
colormap = list[i].extra_colormap; colormap = list[i].extra_colormap;
} }

View File

@ -77,7 +77,9 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum)
deny: deny:
//must be hacked/buggy client //must be hacked/buggy client
lua_settop(gL, 0); // clear stack if (gL) // check if Lua is actually turned on first, you dummmy -- Monster Iestyn 04/07/18
lua_settop(gL, 0); // clear stack
CONS_Alert(CONS_WARNING, M_GetText("Illegal lua command received from %s\n"), player_names[playernum]); CONS_Alert(CONS_WARNING, M_GetText("Illegal lua command received from %s\n"), player_names[playernum]);
if (server) if (server)
{ {

View File

@ -33,7 +33,9 @@
*/ */
fixed_t FixedMul(fixed_t a, fixed_t b) fixed_t FixedMul(fixed_t a, fixed_t b)
{ {
return (fixed_t)((((INT64)a * b) ) / FRACUNIT); // Need to cast to unsigned before shifting to avoid undefined behaviour
// for negative integers
return (fixed_t)(((UINT64)((INT64)a * b)) >> FRACBITS);
} }
#endif //__USE_C_FIXEDMUL__ #endif //__USE_C_FIXEDMUL__

View File

@ -6543,7 +6543,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
if (choice < 32 || choice > 127 || itemOn != 0) if (choice < 32 || choice > 127 || itemOn != 0)
break; break;
l = strlen(setupm_name); l = strlen(setupm_name);
if (l < MAXPLAYERNAME-1) if (l < MAXPLAYERNAME)
{ {
S_StartSound(NULL,sfx_menu1); // Tails S_StartSound(NULL,sfx_menu1); // Tails
setupm_name[l] =(char)choice; setupm_name[l] =(char)choice;

View File

@ -2503,11 +2503,6 @@ boolean P_SetupLevel(boolean skipprecip)
// Reset the palette // Reset the palette
#ifdef HWRENDER
if (rendermode == render_opengl)
HWR_SetPaletteColor(0);
else
#endif
if (rendermode != render_none) if (rendermode != render_none)
V_SetPaletteLump("PLAYPAL"); V_SetPaletteLump("PLAYPAL");
@ -3003,7 +2998,7 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
if ((numlumps = W_LoadWadFile(wadfilename)) == INT16_MAX) if ((numlumps = W_LoadWadFile(wadfilename)) == INT16_MAX)
{ {
CONS_Printf(M_GetText("Errors occured while loading %s; not added.\n"), wadfilename); CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename);
return false; return false;
} }
else wadnum = (UINT16)(numwadfiles-1); else wadnum = (UINT16)(numwadfiles-1);

View File

@ -658,6 +658,14 @@ static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
SDL_memset(&event, 0, sizeof(event_t)); SDL_memset(&event, 0, sizeof(event_t));
// Ignore the event if the mouse is not actually focused on the window.
// This can happen if you used the mouse to restore keyboard focus;
// this apparently makes a mouse button down event but not a mouse button up event,
// resulting in whatever key was pressed down getting "stuck" if we don't ignore it.
// -- Monster Iestyn (28/05/18)
if (SDL_GetMouseFocus() != window)
return;
/// \todo inputEvent.button.which /// \todo inputEvent.button.which
if (USE_MOUSEINPUT) if (USE_MOUSEINPUT)
{ {

View File

@ -210,17 +210,17 @@ void ST_doPaletteStuff(void)
else else
palette = 0; palette = 0;
#ifdef HWRENDER
if (rendermode == render_opengl)
palette = 0; // No flashpals here in OpenGL
#endif
palette = min(max(palette, 0), 13); palette = min(max(palette, 0), 13);
if (palette != st_palette) if (palette != st_palette)
{ {
st_palette = palette; st_palette = palette;
#ifdef HWRENDER
if (rendermode == render_opengl)
HWR_SetPaletteColor(0);
else
#endif
if (rendermode != render_none) if (rendermode != render_none)
{ {
V_SetPaletteLump(GetPalette()); // Reset the palette V_SetPaletteLump(GetPalette()); // Reset the palette