From 340e2e48f93ae5e466829dfdfbc3948774e5dab4 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 19 Nov 2019 11:53:45 +0000 Subject: [PATCH 1/6] Fix crash in new fireflower. (resolves #305) Also, correct indentation on bounce ring fuse since I was here. --- src/p_user.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 47812744e..080d51e53 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4030,7 +4030,8 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) { player->pflags |= PF_ATTACKDOWN; mo = P_SpawnPlayerMissile(player->mo, MT_FIREBALL, 0); - P_InstaThrust(mo, player->mo->angle, ((mo->info->speed>>FRACBITS)*player->mo->scale) + player->speed); + if (mo) + P_InstaThrust(mo, player->mo->angle, ((mo->info->speed>>FRACBITS)*player->mo->scale) + player->speed); S_StartSound(player->mo, sfx_mario7); P_SetWeaponDelay(player, TICRATE); // Short delay between fireballs so you can't spam them everywhere return; @@ -4051,8 +4052,8 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) mo = P_SpawnPlayerMissile(player->mo, MT_THROWNBOUNCE, MF2_BOUNCERING); - if (mo) - mo->fuse = 3*TICRATE; // Bounce Ring time + if (mo) + mo->fuse = 3*TICRATE; // Bounce Ring time } // Rail ring else if (player->currentweapon == WEP_RAIL && player->powers[pw_railring]) From 2ac44240db77c0d6aa52855083f272be592aab22 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 19 Nov 2019 12:59:01 +0000 Subject: [PATCH 2/6] Fix the coords of the subtitle. --- src/st_stuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 4e8afa16a..42a89aab6 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1335,7 +1335,7 @@ void ST_drawTitleCard(void) V_DrawLevelTitle(lvlttlxpos - ttlscroll, 80, V_PERPLAYER, lvlttl); if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE)) V_DrawLevelTitle(zonexpos + ttlscroll, 104, V_PERPLAYER, M_GetText("Zone")); - V_DrawCenteredString(subttlxpos - ttlnumxpos, 128, V_PERPLAYER|V_ALLOWLOWERCASE, subttl); + V_DrawCenteredString(subttlxpos - ttlscroll, 135, V_PERPLAYER|V_ALLOWLOWERCASE, subttl); lt_lasttic = lt_ticker; From 3add9a9bd257d1d32b6739e393ca7faa5dbb6a0a Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 19 Nov 2019 13:00:10 +0000 Subject: [PATCH 3/6] Make the SPEEDING OFF TO ZONE text that appears while loading: * Use a mixed case "Zone" to match the mixed case level titles. * Have V_TRANSLUCENT to not stick out too much against pure black/white backgrounds. (Can revert this aspect if necessary, but I think you'll agree it's a good balance between readable and aesthetic.) --- src/p_setup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index bc0829670..e87a088d8 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2805,12 +2805,12 @@ boolean P_SetupLevel(boolean skipprecip) { // Don't include these in the fade! char tx[64]; - V_DrawSmallString(1, 191, V_ALLOWLOWERCASE, M_GetText("Speeding off to...")); + V_DrawSmallString(1, 191, V_ALLOWLOWERCASE|V_TRANSLUCENT, M_GetText("Speeding off to...")); snprintf(tx, 63, "%s%s%s", mapheaderinfo[gamemap-1]->lvlttl, - (mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE", - (mapheaderinfo[gamemap-1]->actnum > 0) ? va(", Act %d",mapheaderinfo[gamemap-1]->actnum) : ""); - V_DrawSmallString(1, 195, V_ALLOWLOWERCASE, tx); + (mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " Zone", + (mapheaderinfo[gamemap-1]->actnum > 0) ? va("%d",mapheaderinfo[gamemap-1]->actnum) : ""); + V_DrawSmallString(1, 195, V_ALLOWLOWERCASE|V_TRANSLUCENT, tx); I_UpdateNoVsync(); } From c5d73e37bbc0c9fa8fd1dd874ac782b655068576 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 19 Nov 2019 11:16:17 -0800 Subject: [PATCH 4/6] Fix strcasestr SIGSEGV in the case of only upper case strchr returning NULL --- src/strcasestr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strcasestr.c b/src/strcasestr.c index 2077dc3ff..86c7ec5b0 100644 --- a/src/strcasestr.c +++ b/src/strcasestr.c @@ -75,7 +75,7 @@ strcasestr (const char *s, const char *q) if (!( (intptr_t)up|(intptr_t)lp )) return 0; - if (!lp || up < lp) + if (!lp || ( up && up < lp )) { ppa = &up; ppb = &lp; From 9b96964cbbfc20565a8cfdb741f4927f36df7899 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 19 Nov 2019 12:25:50 -0800 Subject: [PATCH 5/6] Check for out of range gametype on map change --- src/d_netcmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 4de166e41..8917156d7 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2054,7 +2054,9 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) lastgametype = gametype; gametype = READUINT8(*cp); - if (gametype != lastgametype) + if (gametype < 0 || gametype >= NUMGAMETYPES) + gametype = lastgametype; + else if (gametype != lastgametype) D_GameTypeChanged(lastgametype); // emulate consvar_t behavior for gametype skipprecutscene = ((flags & (1<<2)) != 0); From 6ffb18c4b157f9efecec6a104ef930dd71f8b986 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 19 Nov 2019 12:32:02 -0800 Subject: [PATCH 6/6] Warn if gametype number is out of range to map command --- src/d_netcmd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 8917156d7..7a8cf539f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1939,6 +1939,17 @@ static void Command_Map_f(void) d = atoi(gametypename); if (d >= 0 && d < NUMGAMETYPES) newgametype = d; + else + { + CONS_Alert(CONS_ERROR, + "Gametype number %d is out of range. Use a number between" + " 0 and %d inclusive. ...Or just use the name. :v\n", + d, + NUMGAMETYPES-1); + Z_Free(realmapname); + Z_Free(mapname); + return; + } } else {