From bf8a39f7eedcf8011e3f19015d22bdde9b3e7589 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 11 Jan 2020 15:40:18 -0800 Subject: [PATCH 01/28] Only exit if base files fail to load --- src/w_wad.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index bbb30d3fa..cfd2db50e 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -822,13 +822,11 @@ UINT16 W_InitFile(const char *filename, boolean mainfile) * backwards, so a later file overrides all earlier ones. * * \param filenames A null-terminated list of files to use. - * \return 1 if all files were loaded, 0 if at least one was missing or + * \return 1 if base files were loaded, 0 if at least one was missing or * invalid. */ INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles) { - INT32 rc = 1; - // open all the files, load headers, and count lumps numwadfiles = 0; @@ -836,13 +834,15 @@ INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles) for (; *filenames; filenames++) { //CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames); - rc &= (W_InitFile(*filenames, numwadfiles < mainfiles) != INT16_MAX) ? 1 : 0; + if (W_InitFile(*filenames, numwadfiles < mainfiles) == INT16_MAX) + { + CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames); + if (numwadfiles < mainfiles) + return 0; + } } - if (!numwadfiles) - I_Error("W_InitMultipleFiles: no files found"); - - return rc; + return 1; } /** Make sure a lump number is valid. From 1e2a4c2cce3b4b8490b3cc287eeb84d2c09c02c7 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 11 Jan 2020 22:26:20 -0600 Subject: [PATCH 02/28] Allow starpost Parameter to dictate order --- src/p_inter.c | 4 ++-- src/p_mobj.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 71740822e..4aa84ba84 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1441,8 +1441,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; } - // We could technically have 91.1 Star Posts. 90 is cleaner. - if (special->health > 90) + // With the parameter + angle setup, we can go up to 1365 star posts. Who needs that many? + if (special->health > 1365) { CONS_Debug(DBG_GAMELOGIC, "Bad Starpost Number!\n"); return; diff --git a/src/p_mobj.c b/src/p_mobj.c index a4231fa74..93a750997 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -12911,7 +12911,16 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean thinker_t* th; mobj_t* mo2; boolean foundanother = false; - mobj->health = (mthing->angle/360) + 1; + + if (mthing->extrainfo) + // Allow thing Parameter to define star post num too! + // For starposts above param 15 (the 16th), add 360 to the angle like before and start parameter from 1 (NOT 0)! + // So the 16th starpost is angle=0 param=15, the 17th would be angle=360 param=1. + // This seems more intuitive for mappers to use until UDMF is ready, since most SP maps won't have over 16 consecutive star posts. + mobj->health = mthing->extrainfo + (mthing->angle/360)*15 + 1; + else + // Old behavior if Parameter is 0; add 360 to the angle for each consecutive star post. + mobj->health = (mthing->angle/360) + 1; // See if other starposts exist in this level that have the same value. for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) From e60ba92a9211371ad89b7530959e556385ab65e2 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 11 Jan 2020 22:30:07 -0600 Subject: [PATCH 03/28] Checkpoint players at star post exact location with Ambush flag --- src/p_inter.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 4aa84ba84..d6a47c78f 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1453,6 +1453,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (cv_coopstarposts.value && G_GametypeUsesCoopStarposts() && (netgame || multiplayer)) { + mobj_t *checkbase = (special->spawnpoint && (special->spawnpoint->options & MTF_AMBUSH)) ? special : toucher; for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i]) @@ -1461,8 +1462,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) continue; players[i].starposttime = leveltime; - players[i].starpostx = player->mo->x>>FRACBITS; - players[i].starposty = player->mo->y>>FRACBITS; + players[i].starpostx = checkbase->x>>FRACBITS; + players[i].starposty = checkbase->y>>FRACBITS; players[i].starpostz = special->z>>FRACBITS; players[i].starpostangle = special->angle; players[i].starpostscale = player->mo->destscale; @@ -1483,8 +1484,16 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { // Save the player's time and position. player->starposttime = leveltime; - player->starpostx = toucher->x>>FRACBITS; - player->starposty = toucher->y>>FRACBITS; + if (special->spawnpoint && (special->spawnpoint->options & MTF_AMBUSH)) + { + player->starpostx = special->x>>FRACBITS; + player->starposty = special->y>>FRACBITS; + } + else + { + player->starpostx = toucher->x>>FRACBITS; + player->starposty = toucher->y>>FRACBITS; + } player->starpostz = special->z>>FRACBITS; player->starpostangle = special->angle; player->starpostscale = player->mo->destscale; From 8a6173a3f2f6980d64473966769eceec11e733a7 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 12 Jan 2020 09:11:57 -0600 Subject: [PATCH 04/28] Declare checkbase for both sides of the if statement --- src/p_inter.c | 79 ++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 42 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index d6a47c78f..9f53a46a0 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1451,59 +1451,54 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->starpostnum >= special->health) return; // Already hit this post - if (cv_coopstarposts.value && G_GametypeUsesCoopStarposts() && (netgame || multiplayer)) { mobj_t *checkbase = (special->spawnpoint && (special->spawnpoint->options & MTF_AMBUSH)) ? special : toucher; - for (i = 0; i < MAXPLAYERS; i++) + + if (cv_coopstarposts.value && G_GametypeUsesCoopStarposts() && (netgame || multiplayer)) { - if (playeringame[i]) + for (i = 0; i < MAXPLAYERS; i++) { - if (players[i].bot) // ignore dumb, stupid tails - continue; - - players[i].starposttime = leveltime; - players[i].starpostx = checkbase->x>>FRACBITS; - players[i].starposty = checkbase->y>>FRACBITS; - players[i].starpostz = special->z>>FRACBITS; - players[i].starpostangle = special->angle; - players[i].starpostscale = player->mo->destscale; - if (special->flags2 & MF2_OBJECTFLIP) + if (playeringame[i]) { - players[i].starpostscale *= -1; - players[i].starpostz += special->height>>FRACBITS; - } - players[i].starpostnum = special->health; + if (players[i].bot) // ignore dumb, stupid tails + continue; - if (cv_coopstarposts.value == 2 && (players[i].playerstate == PST_DEAD || players[i].spectator) && P_GetLives(&players[i])) - P_SpectatorJoinGame(&players[i]); //players[i].playerstate = PST_REBORN; + players[i].starposttime = leveltime; + players[i].starpostx = checkbase->x>>FRACBITS; + players[i].starposty = checkbase->y>>FRACBITS; + players[i].starpostz = special->z>>FRACBITS; + players[i].starpostangle = special->angle; + players[i].starpostscale = player->mo->destscale; + if (special->flags2 & MF2_OBJECTFLIP) + { + players[i].starpostscale *= -1; + players[i].starpostz += special->height>>FRACBITS; + } + players[i].starpostnum = special->health; + + if (cv_coopstarposts.value == 2 && (players[i].playerstate == PST_DEAD || players[i].spectator) && P_GetLives(&players[i])) + P_SpectatorJoinGame(&players[i]); //players[i].playerstate = PST_REBORN; + } } - } - S_StartSound(NULL, special->info->painsound); - } - else - { - // Save the player's time and position. - player->starposttime = leveltime; - if (special->spawnpoint && (special->spawnpoint->options & MTF_AMBUSH)) - { - player->starpostx = special->x>>FRACBITS; - player->starposty = special->y>>FRACBITS; + S_StartSound(NULL, special->info->painsound); } else { - player->starpostx = toucher->x>>FRACBITS; - player->starposty = toucher->y>>FRACBITS; + // Save the player's time and position. + player->starposttime = leveltime; + player->starpostx = checkbase->x>>FRACBITS; + player->starposty = checkbase->y>>FRACBITS; + player->starpostz = special->z>>FRACBITS; + player->starpostangle = special->angle; + player->starpostscale = player->mo->destscale; + if (special->flags2 & MF2_OBJECTFLIP) + { + player->starpostscale *= -1; + player->starpostz += special->height>>FRACBITS; + } + player->starpostnum = special->health; + S_StartSound(toucher, special->info->painsound); } - player->starpostz = special->z>>FRACBITS; - player->starpostangle = special->angle; - player->starpostscale = player->mo->destscale; - if (special->flags2 & MF2_OBJECTFLIP) - { - player->starpostscale *= -1; - player->starpostz += special->height>>FRACBITS; - } - player->starpostnum = special->health; - S_StartSound(toucher, special->info->painsound); } P_ClearStarPost(special->health); From 28c466a0a5fe36172026b0376c7cc6868e7dbdd0 Mon Sep 17 00:00:00 2001 From: lachwright Date: Thu, 16 Jan 2020 22:56:01 +0800 Subject: [PATCH 05/28] Reset pmomz after transfer to momz --- src/p_mobj.c | 4 ++++ src/p_user.c | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index a4231fa74..4ed19a9ff 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2350,6 +2350,7 @@ static void P_RingZMovement(mobj_t *mo) if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo)) { mo->momz += mo->pmomz; + mo->pmomz = 0; mo->eflags &= ~MFE_APPLYPMOMZ; } mo->z += mo->momz; @@ -2419,6 +2420,7 @@ static boolean P_ZMovement(mobj_t *mo) if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo)) { mo->momz += mo->pmomz; + mo->pmomz = 0; mo->eflags &= ~MFE_APPLYPMOMZ; } mo->z += mo->momz; @@ -2907,6 +2909,7 @@ static void P_PlayerZMovement(mobj_t *mo) if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo)) { mo->momz += mo->pmomz; + mo->pmomz = 0; mo->eflags &= ~MFE_APPLYPMOMZ; } @@ -3157,6 +3160,7 @@ static boolean P_SceneryZMovement(mobj_t *mo) if (mo->eflags & MFE_APPLYPMOMZ && !P_IsObjectOnGround(mo)) { mo->momz += mo->pmomz; + mo->pmomz = 0; mo->eflags &= ~MFE_APPLYPMOMZ; } mo->z += mo->momz; diff --git a/src/p_user.c b/src/p_user.c index 0c4d25554..fb59efab7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4530,16 +4530,14 @@ void P_DoJump(player_t *player, boolean soundandstate) player->mo->z--; if (player->mo->pmomz < 0) player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump. - else - player->mo->pmomz = 0; + player->mo->pmomz = 0; } else { player->mo->z++; if (player->mo->pmomz > 0) player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump. - else - player->mo->pmomz = 0; + player->mo->pmomz = 0; } player->mo->eflags &= ~MFE_APPLYPMOMZ; From 332b22a87ae42acea8b0c938170983195cd726d3 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Fri, 24 Jan 2020 23:54:54 -0600 Subject: [PATCH 06/28] Move spawnsnap to Special/ignore on sector trigger Also includes splitting the starpost logic into its own function. --- src/p_inter.c | 203 ++++++++++++++++++++++++++------------------------ src/p_local.h | 1 + src/p_spec.c | 2 +- 3 files changed, 109 insertions(+), 97 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 9f53a46a0..ddf90d72f 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1428,102 +1428,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Misc touchables // // *************** // case MT_STARPOST: - if (player->bot) - return; - // In circuit, player must have touched all previous starposts - if (circuitmap - && special->health - player->starpostnum > 1) - { - // blatant reuse of a variable that's normally unused in circuit - if (!player->tossdelay) - S_StartSound(toucher, sfx_lose); - player->tossdelay = 3; - return; - } - - // With the parameter + angle setup, we can go up to 1365 star posts. Who needs that many? - if (special->health > 1365) - { - CONS_Debug(DBG_GAMELOGIC, "Bad Starpost Number!\n"); - return; - } - - if (player->starpostnum >= special->health) - return; // Already hit this post - - { - mobj_t *checkbase = (special->spawnpoint && (special->spawnpoint->options & MTF_AMBUSH)) ? special : toucher; - - if (cv_coopstarposts.value && G_GametypeUsesCoopStarposts() && (netgame || multiplayer)) - { - for (i = 0; i < MAXPLAYERS; i++) - { - if (playeringame[i]) - { - if (players[i].bot) // ignore dumb, stupid tails - continue; - - players[i].starposttime = leveltime; - players[i].starpostx = checkbase->x>>FRACBITS; - players[i].starposty = checkbase->y>>FRACBITS; - players[i].starpostz = special->z>>FRACBITS; - players[i].starpostangle = special->angle; - players[i].starpostscale = player->mo->destscale; - if (special->flags2 & MF2_OBJECTFLIP) - { - players[i].starpostscale *= -1; - players[i].starpostz += special->height>>FRACBITS; - } - players[i].starpostnum = special->health; - - if (cv_coopstarposts.value == 2 && (players[i].playerstate == PST_DEAD || players[i].spectator) && P_GetLives(&players[i])) - P_SpectatorJoinGame(&players[i]); //players[i].playerstate = PST_REBORN; - } - } - S_StartSound(NULL, special->info->painsound); - } - else - { - // Save the player's time and position. - player->starposttime = leveltime; - player->starpostx = checkbase->x>>FRACBITS; - player->starposty = checkbase->y>>FRACBITS; - player->starpostz = special->z>>FRACBITS; - player->starpostangle = special->angle; - player->starpostscale = player->mo->destscale; - if (special->flags2 & MF2_OBJECTFLIP) - { - player->starpostscale *= -1; - player->starpostz += special->height>>FRACBITS; - } - player->starpostnum = special->health; - S_StartSound(toucher, special->info->painsound); - } - } - - P_ClearStarPost(special->health); - - // Find all starposts in the level with this value - INCLUDING this one! - if (!(netgame && circuitmap && player != &players[consoleplayer])) - { - thinker_t *th; - mobj_t *mo2; - - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) - { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - continue; - - mo2 = (mobj_t *)th; - - if (mo2->type != MT_STARPOST) - continue; - if (mo2->health != special->health) - continue; - - P_SetMobjState(mo2, mo2->info->painstate); - } - } + P_TouchStarPost(special, player, special->spawnpoint && (special->spawnpoint->options & MTF_OBJECTSPECIAL)); return; case MT_FAKEMOBILE: @@ -1875,6 +1780,112 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_KillMobj(special, NULL, toucher, 0); } +/** Saves a player's level progress at a star post + * + * \param post The star post to trigger + * \param player The player that should receive the checkpoint + * \param snaptopost If true, the respawn point will use the star post's position, otherwise player x/y and star post z + */ +void P_TouchStarPost(mobj_t *post, player_t *player, boolean snaptopost) +{ + size_t i; + mobj_t *toucher = player->mo; + mobj_t *checkbase = snaptopost ? post : toucher; + + if (player->bot) + return; + // In circuit, player must have touched all previous starposts + if (circuitmap + && post->health - player->starpostnum > 1) + { + // blatant reuse of a variable that's normally unused in circuit + if (!player->tossdelay) + S_StartSound(toucher, sfx_lose); + player->tossdelay = 3; + return; + } + + // With the parameter + angle setup, we can go up to 1365 star posts. Who needs that many? + if (post->health > 1365) + { + CONS_Debug(DBG_GAMELOGIC, "Bad Starpost Number!\n"); + return; + } + + if (player->starpostnum >= post->health) + return; // Already hit this post + + if (cv_coopstarposts.value && G_GametypeUsesCoopStarposts() && (netgame || multiplayer)) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i]) + { + if (players[i].bot) // ignore dumb, stupid tails + continue; + + players[i].starposttime = leveltime; + players[i].starpostx = checkbase->x>>FRACBITS; + players[i].starposty = checkbase->y>>FRACBITS; + players[i].starpostz = post->z>>FRACBITS; + players[i].starpostangle = post->angle; + players[i].starpostscale = player->mo->destscale; + if (post->flags2 & MF2_OBJECTFLIP) + { + players[i].starpostscale *= -1; + players[i].starpostz += post->height>>FRACBITS; + } + players[i].starpostnum = post->health; + + if (cv_coopstarposts.value == 2 && (players[i].playerstate == PST_DEAD || players[i].spectator) && P_GetLives(&players[i])) + P_SpectatorJoinGame(&players[i]); //players[i].playerstate = PST_REBORN; + } + } + S_StartSound(NULL, post->info->painsound); + } + else + { + // Save the player's time and position. + player->starposttime = leveltime; + player->starpostx = checkbase->x>>FRACBITS; + player->starposty = checkbase->y>>FRACBITS; + player->starpostz = post->z>>FRACBITS; + player->starpostangle = post->angle; + player->starpostscale = player->mo->destscale; + if (post->flags2 & MF2_OBJECTFLIP) + { + player->starpostscale *= -1; + player->starpostz += post->height>>FRACBITS; + } + player->starpostnum = post->health; + S_StartSound(toucher, post->info->painsound); + } + + P_ClearStarPost(post->health); + + // Find all starposts in the level with this value - INCLUDING this one! + if (!(netgame && circuitmap && player != &players[consoleplayer])) + { + thinker_t *th; + mobj_t *mo2; + + for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + { + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; + + mo2 = (mobj_t *)th; + + if (mo2->type != MT_STARPOST) + continue; + if (mo2->health != post->health) + continue; + + P_SetMobjState(mo2, mo2->info->painstate); + } + } +} + /** Prints death messages relating to a dying or hit player. * * \param player Affected player. diff --git a/src/p_local.h b/src/p_local.h index a5f3d313c..8056d137c 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -486,6 +486,7 @@ void P_PlayerWeaponPanelOrAmmoBurst(player_t *player); void P_PlayerEmeraldBurst(player_t *player, boolean toss); void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck); +void P_TouchStarPost(mobj_t *starpost, player_t *player, boolean snaptopost); void P_PlayerFlagBurst(player_t *player, boolean toss); void P_CheckTimeLimit(void); void P_CheckPointLimit(void); diff --git a/src/p_spec.c b/src/p_spec.c index 9defc33a0..a4076e513 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4684,7 +4684,7 @@ DoneSection2: if (!post) break; - P_TouchSpecialThing(post, player->mo, false); + P_TouchStarPost(post, player, false); break; } From 65e84978fa4bf86f6563367641c26ac6feba9fc0 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sun, 26 Jan 2020 04:51:00 +0800 Subject: [PATCH 07/28] Don't cancel Knuckles' landing animation on rising surfaces --- src/p_user.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index a5ccf467f..1fb5811f9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2380,6 +2380,8 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) } } } + else if (player->charability == CA_GLIDEANDCLIMB && (player->mo->state-states == S_PLAY_GLIDE_LANDING)) + ; else if (player->charability2 == CA2_GUNSLINGER && player->panim == PA_ABILITY2) ; else if (player->panim != PA_IDLE && player->panim != PA_WALK && player->panim != PA_RUN && player->panim != PA_DASH) From d08929b3d77d9e5686abddf8e07c0b2cdd927949 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 26 Jan 2020 22:46:57 -0300 Subject: [PATCH 08/28] Move line drawer setting to AM_Drawer --- src/am_map.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/am_map.c b/src/am_map.c index 7dfbf4ba4..0f8f0f74f 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -354,12 +354,6 @@ static void AM_LevelInit(void) f_w = vid.width; f_h = vid.height; - AM_drawFline = AM_drawFline_soft; -#ifdef HWRENDER - if (rendermode == render_opengl) - AM_drawFline = HWR_drawAMline; -#endif - AM_findMinMaxBoundaries(); scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT); if (scale_mtof > max_scale_mtof) @@ -1100,6 +1094,12 @@ void AM_Drawer(void) if (!automapactive) return; + AM_drawFline = AM_drawFline_soft; +#ifdef HWRENDER + if (rendermode == render_opengl) + AM_drawFline = HWR_drawAMline; +#endif + AM_clearFB(BACKGROUND); if (draw_grid) AM_drawGrid(GRIDCOLORS); AM_drawWalls(); From ba6018aea44ec6cdf0245acb116deec64a5941fa Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 26 Jan 2020 22:52:15 -0300 Subject: [PATCH 09/28] Optimise pixel drawing --- src/am_map.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/am_map.c b/src/am_map.c index 0f8f0f74f..c06bd2561 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -205,6 +205,7 @@ static boolean followplayer = true; // specifies whether to follow the player ar typedef void (*AMDRAWFLINEFUNC) (const fline_t *fl, INT32 color); static AMDRAWFLINEFUNC AM_drawFline; +static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc); static void AM_drawFline_soft(const fline_t *fl, INT32 color); static void AM_activateNewScale(void) @@ -712,6 +713,17 @@ static boolean AM_clipMline(const mline_t *ml, fline_t *fl) } #undef DOOUTCODE +// +// Draws a pixel. +// +static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc) +{ + UINT8 *dest = screens[0]; + if (xx < 0 || yy < 0 || xx >= vid.width || yy >= vid.height) + return; // off the screen + dest[(yy*vid.rowbytes) + (xx * vid.bpp)] = (cc & 0xFF); +} + // // Classic Bresenham w/ whatever optimizations needed for speed // @@ -733,8 +745,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color) } #endif - #define PUTDOT(xx,yy,cc) V_DrawFill(xx,yy,1,1,cc|V_NOSCALESTART); - dx = fl->b.x - fl->a.x; ax = 2 * (dx < 0 ? -dx : dx); sx = dx < 0 ? -1 : 1; @@ -751,7 +761,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color) d = ay - ax/2; for (;;) { - PUTDOT(x, y, color) + AM_drawPixel(x, y, color); if (x == fl->b.x) return; if (d >= 0) @@ -768,7 +778,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color) d = ax - ay/2; for (;;) { - PUTDOT(x, y, color) + AM_drawPixel(x, y, color); if (y == fl->b.y) return; if (d >= 0) @@ -780,8 +790,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color) d += ax; } } - - #undef PUTDOT } // From dd8166ca5f4f9dce7a4189a7e89992e42e0cbf9d Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 26 Jan 2020 22:57:14 -0300 Subject: [PATCH 10/28] Doesn't matter. --- src/am_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/am_map.c b/src/am_map.c index c06bd2561..4ad40b7aa 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -721,7 +721,7 @@ static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc) UINT8 *dest = screens[0]; if (xx < 0 || yy < 0 || xx >= vid.width || yy >= vid.height) return; // off the screen - dest[(yy*vid.rowbytes) + (xx * vid.bpp)] = (cc & 0xFF); + dest[(yy*vid.width) + xx] = cc; } // From 8f3855d09f93da34fbe56fe62b90c36c283f65ec Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 26 Jan 2020 23:12:28 -0300 Subject: [PATCH 11/28] Don't stop the automap (just restart it instead.) --- src/am_map.c | 24 +++++++++++++++++------- src/am_map.h | 3 +++ src/screen.c | 7 +++++-- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/am_map.c b/src/am_map.c index 4ad40b7aa..6cd9a3f0f 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -345,16 +345,22 @@ static void AM_initVariables(void) old_m_h = m_h; } +// +// Called when the screen size changed. +// +static void AM_FrameBufferInit(void) +{ + f_x = f_y = 0; + f_w = vid.width; + f_h = vid.height; +} + // // should be called at the start of every level // right now, i figure it out myself // static void AM_LevelInit(void) { - f_x = f_y = 0; - f_w = vid.width; - f_h = vid.height; - AM_findMinMaxBoundaries(); scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT); if (scale_mtof > max_scale_mtof) @@ -376,7 +382,7 @@ void AM_Stop(void) * * \sa AM_Stop */ -static inline void AM_Start(void) +void AM_Start(void) { static INT32 lastlevel = -1; @@ -385,8 +391,12 @@ static inline void AM_Start(void) am_stopped = false; if (lastlevel != gamemap || am_recalc) // screen size changed { - AM_LevelInit(); - lastlevel = gamemap; + AM_FrameBufferInit(); + if (lastlevel != gamemap) + { + AM_LevelInit(); + lastlevel = gamemap; + } am_recalc = false; } AM_initVariables(); diff --git a/src/am_map.h b/src/am_map.h index 462bb3d6d..0560207bb 100644 --- a/src/am_map.h +++ b/src/am_map.h @@ -38,6 +38,9 @@ void AM_Ticker(void); // Called by main loop, instead of view drawer if automap is active. void AM_Drawer(void); +// Enables the automap. +void AM_Start(void); + // Called to force the automap to quit if the level is completed while it is up. void AM_Stop(void); diff --git a/src/screen.c b/src/screen.c index 5bb304c08..fcf6c6b0b 100644 --- a/src/screen.c +++ b/src/screen.c @@ -360,10 +360,13 @@ void SCR_Recalc(void) vid.fsmalldupy = vid.smalldupy*FRACUNIT; #endif - // toggle off automap because some screensize-dependent values will + // toggle off (then back on) the automap because some screensize-dependent values will // be calculated next time the automap is activated. if (automapactive) - AM_Stop(); + { + am_recalc = true; + AM_Start(); + } // set the screen[x] ptrs on the new vidbuffers V_Init(); From 2cfeaa63d2e8262dec715748132cb29fac834334 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 26 Jan 2020 23:34:04 -0300 Subject: [PATCH 12/28] Fix movement to accomodate to window scale changes --- src/am_map.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 6 deletions(-) diff --git a/src/am_map.c b/src/am_map.c index 6cd9a3f0f..b1fad1b0c 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -160,6 +160,7 @@ static boolean am_stopped = true; static INT32 f_x, f_y; // location of window on screen (always zero for both) static INT32 f_w, f_h; // size of window on screen (always the screen width and height respectively) +static boolean m_keydown[4]; // which window panning keys are being pressed down? static mpoint_t m_paninc; // how far the window pans each tic (map coords) static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords) static fixed_t ftom_zoommul; // how far the window zooms in each tic (fb coords) @@ -422,6 +423,28 @@ static void AM_maxOutWindowScale(void) AM_activateNewScale(); } +// +// set window panning +// +static void AM_setWindowPanning(void) +{ + // up and down + if (m_keydown[2]) // pan up + m_paninc.y = FTOM(F_PANINC); + else if (m_keydown[3]) // pan down + m_paninc.y = -FTOM(F_PANINC); + else + m_paninc.y = 0; + + // left and right + if (m_keydown[0]) // pan right + m_paninc.x = FTOM(F_PANINC); + else if (m_keydown[1]) // pan left + m_paninc.x = -FTOM(F_PANINC); + else + m_paninc.x = 0; +} + /** Responds to user inputs in automap mode. * * \param ev Event to possibly respond to. @@ -454,35 +477,49 @@ boolean AM_Responder(event_t *ev) { case AM_PANRIGHTKEY: // pan right if (!followplayer) - m_paninc.x = FTOM(F_PANINC); + { + m_keydown[0] = true; + AM_setWindowPanning(); + } else rc = false; break; case AM_PANLEFTKEY: // pan left if (!followplayer) - m_paninc.x = -FTOM(F_PANINC); + { + m_keydown[1] = true; + AM_setWindowPanning(); + } else rc = false; break; case AM_PANUPKEY: // pan up if (!followplayer) - m_paninc.y = FTOM(F_PANINC); + { + m_keydown[2] = true; + AM_setWindowPanning(); + } else rc = false; break; case AM_PANDOWNKEY: // pan down if (!followplayer) - m_paninc.y = -FTOM(F_PANINC); + { + m_keydown[3] = true; + AM_setWindowPanning(); + } else rc = false; break; case AM_ZOOMOUTKEY: // zoom out mtof_zoommul = M_ZOOMOUT; ftom_zoommul = M_ZOOMIN; + AM_setWindowPanning(); break; case AM_ZOOMINKEY: // zoom in mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; + AM_setWindowPanning(); break; case AM_TOGGLEKEY: AM_Stop(); @@ -515,14 +552,32 @@ boolean AM_Responder(event_t *ev) switch (ev->data1) { case AM_PANRIGHTKEY: + if (!followplayer) + { + m_keydown[0] = false; + AM_setWindowPanning(); + } + break; case AM_PANLEFTKEY: if (!followplayer) - m_paninc.x = 0; + { + m_keydown[1] = false; + AM_setWindowPanning(); + } break; case AM_PANUPKEY: + if (!followplayer) + { + m_keydown[2] = false; + AM_setWindowPanning(); + } + break; case AM_PANDOWNKEY: if (!followplayer) - m_paninc.y = 0; + { + m_keydown[3] = false; + AM_setWindowPanning(); + } break; case AM_ZOOMOUTKEY: case AM_ZOOMINKEY: From 46cbe63b43f9cd3b4958c1c911907b4e6b9a6aa0 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 26 Jan 2020 23:39:31 -0300 Subject: [PATCH 13/28] Fix going big --- src/am_map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/am_map.c b/src/am_map.c index b1fad1b0c..f6bafe33b 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -533,6 +533,7 @@ boolean AM_Responder(event_t *ev) } else AM_restoreScaleAndLoc(); + AM_setWindowPanning(); break; case AM_FOLLOWKEY: followplayer = !followplayer; From 7f57327ff7b806e3aa118c745df142c187d75fc5 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 26 Jan 2020 23:41:34 -0300 Subject: [PATCH 14/28] "changes" not "changed" --- src/am_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/am_map.c b/src/am_map.c index f6bafe33b..b2c7de442 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -347,7 +347,7 @@ static void AM_initVariables(void) } // -// Called when the screen size changed. +// Called when the screen size changes. // static void AM_FrameBufferInit(void) { From 636093a59ddd95b25d79c4ebff51dc6412de1956 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 27 Jan 2020 13:55:13 -0300 Subject: [PATCH 15/28] Fix color LUT using the wrong palette --- src/m_anigif.c | 18 +++++------------- src/r_data.c | 12 ++++++++---- src/r_data.h | 3 ++- src/v_video.c | 3 +-- src/v_video.h | 5 +---- 5 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/m_anigif.c b/src/m_anigif.c index 32fc2746d..f062bc826 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -624,14 +624,6 @@ static void GIF_framewrite(void) // INT32 GIF_open(const char *filename) { -#if 0 - if (rendermode != render_soft) - { - CONS_Alert(CONS_WARNING, M_GetText("GIFs cannot be taken in non-software modes!\n")); - return 0; - } -#endif - gif_out = fopen(filename, "wb"); if (!gif_out) return 0; @@ -640,13 +632,13 @@ INT32 GIF_open(const char *filename) gif_downscale = (!!cv_gif_downscale.value); // GIF color table - // In hardware mode, uses the master palette - gif_palette = ((cv_screenshot_colorprofile.value + // In hardware mode, forces the local palette #ifdef HWRENDER - && (rendermode == render_soft) + if (rendermode == render_opengl) + gif_palette = pLocalPalette; + else #endif - ) ? pLocalPalette - : pMasterPalette); + gif_palette = ((cv_screenshot_colorprofile.value) ? pLocalPalette : pMasterPalette); GIF_headwrite(); gif_frames = 0; diff --git a/src/r_data.c b/src/r_data.c index 9f80e257b..e0a3d48d4 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -2465,16 +2465,20 @@ extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *ex // Thanks to quake2 source! // utils3/qdata/images.c -UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b) +UINT8 NearestPaletteColor(UINT8 r, UINT8 g, UINT8 b, RGBA_t *palette) { int dr, dg, db; int distortion, bestdistortion = 256 * 256 * 4, bestcolor = 0, i; + // Use master palette if none specified + if (palette == NULL) + palette = pMasterPalette; + for (i = 0; i < 256; i++) { - dr = r - pMasterPalette[i].s.red; - dg = g - pMasterPalette[i].s.green; - db = b - pMasterPalette[i].s.blue; + dr = r - palette[i].s.red; + dg = g - palette[i].s.green; + db = b - palette[i].s.blue; distortion = dr*dr + dg*dg + db*db; if (distortion < bestdistortion) { diff --git a/src/r_data.h b/src/r_data.h index f028f2f5d..145f0182b 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -171,7 +171,8 @@ const char *R_NameForColormap(extracolormap_t *extra_colormap); #define R_PutRgbaRGB(r, g, b) (R_PutRgbaR(r) + R_PutRgbaG(g) + R_PutRgbaB(b)) #define R_PutRgbaRGBA(r, g, b, a) (R_PutRgbaRGB(r, g, b) + R_PutRgbaA(a)) -UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b); +UINT8 NearestPaletteColor(UINT8 r, UINT8 g, UINT8 b, RGBA_t *palette); +#define NearestColor(r, g, b) NearestPaletteColor(r, g, b, NULL) extern INT32 numtextures; diff --git a/src/v_video.c b/src/v_video.c index 4785a1541..81625ff9e 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -3244,7 +3244,6 @@ Unoptimized version #endif } -// Taken from my videos-in-SRB2 project // Generates a color look-up table // which has up to 64 colors at each channel // (see the defines in v_video.h) @@ -3261,7 +3260,7 @@ void InitColorLUT(RGBA_t *palette) for (r = 0; r < CLUTSIZE; r++) for (g = 0; g < CLUTSIZE; g++) for (b = 0; b < CLUTSIZE; b++) - colorlookup[r][g][b] = NearestColor(r << SHIFTCOLORBITS, g << SHIFTCOLORBITS, b << SHIFTCOLORBITS); + colorlookup[r][g][b] = NearestPaletteColor(r << SHIFTCOLORBITS, g << SHIFTCOLORBITS, b << SHIFTCOLORBITS, palette); clutinit = true; lastpalette = palette; } diff --git a/src/v_video.h b/src/v_video.h index eb75a414f..bc19f6e99 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -37,10 +37,7 @@ cv_allcaps; // Allocates buffer screens, call before R_Init. void V_Init(void); -// Taken from my videos-in-SRB2 project -// Generates a color look-up table -// which has up to 64 colors at each channel - +// Color look-up table #define COLORBITS 6 #define SHIFTCOLORBITS (8-COLORBITS) #define CLUTSIZE (1< Date: Thu, 30 Jan 2020 23:58:35 -0800 Subject: [PATCH 16/28] Oops --- src/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console.c b/src/console.c index ba5ba71df..8746bf036 100644 --- a/src/console.c +++ b/src/console.c @@ -769,7 +769,7 @@ boolean CON_Responder(event_t *ev) // check for console toggle key if (ev->type != ev_console) { - if (modeattacking || metalrecording || menuactive) + if (modeattacking || metalrecording) return false; if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1]) From 71707e6dca569abc5ea62a27f614ec962741f00b Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 31 Jan 2020 14:32:47 -0800 Subject: [PATCH 17/28] Reset rollangle on TNT explosion This is the where the extreme lag when TNT Barrels explode came from. Probably because the sprites are big and there's four of 'em! It shouldn't matter that these aren't rotated--they're pretty round. --- src/info.c | 13 +++++++------ src/info.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/info.c b/src/info.c index 45034fe37..758f137c2 100644 --- a/src/info.c +++ b/src/info.c @@ -2343,12 +2343,13 @@ state_t states[NUMSTATES] = // TNT barrel {SPR_BARR, 0, -1, {NULL}, 0, 0, S_NULL}, // S_TNTBARREL_STND1 - {SPR_BARX, 0|FF_FULLBRIGHT, 3, {A_SetObjectFlags}, MF_NOCLIP|MF_NOGRAVITY|MF_NOBLOCKMAP, 0, S_TNTBARREL_EXPL2}, // S_TNTBARREL_EXPL1 - {SPR_BARX, 1|FF_FULLBRIGHT, 2, {A_TNTExplode}, MT_TNTDUST, 0, S_TNTBARREL_EXPL3}, // S_TNTBARREL_EXPL2 - {SPR_BARX, 1|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_TNTBARREL_EXPL4}, // S_TNTBARREL_EXPL3 - {SPR_BARX, 2|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_TNTBARREL_EXPL5}, // S_TNTBARREL_EXPL4 - {SPR_BARX, 3|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_TNTBARREL_EXPL6}, // S_TNTBARREL_EXPL5 - {SPR_NULL, 0, 35, {NULL}, 0, 0, S_NULL}, // S_TNTBARREL_EXPL6 + {SPR_BARX, 0, 0, {A_RollAngle}, 0, 1, S_TNTBARREL_EXPL2}, // S_TNTBARREL_EXPL1 + {SPR_BARX, 0|FF_FULLBRIGHT, 3, {A_SetObjectFlags}, MF_NOCLIP|MF_NOGRAVITY|MF_NOBLOCKMAP, 0, S_TNTBARREL_EXPL3}, // S_TNTBARREL_EXPL2 + {SPR_BARX, 1|FF_FULLBRIGHT, 2, {A_TNTExplode}, MT_TNTDUST, 0, S_TNTBARREL_EXPL4}, // S_TNTBARREL_EXPL3 + {SPR_BARX, 1|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_TNTBARREL_EXPL5}, // S_TNTBARREL_EXPL4 + {SPR_BARX, 2|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_TNTBARREL_EXPL6}, // S_TNTBARREL_EXPL5 + {SPR_BARX, 3|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_TNTBARREL_EXPL7}, // S_TNTBARREL_EXPL6 + {SPR_NULL, 0, 35, {NULL}, 0, 0, S_NULL}, // S_TNTBARREL_EXPL7 #ifndef ROTSPRITE {SPR_BARR, 1|FF_ANIMATE, -1, {NULL}, 7, 2, S_NULL}, // S_TNTBARREL_FLYING #else diff --git a/src/info.h b/src/info.h index 628335635..59b8eb68d 100644 --- a/src/info.h +++ b/src/info.h @@ -2503,6 +2503,7 @@ typedef enum state S_TNTBARREL_EXPL4, S_TNTBARREL_EXPL5, S_TNTBARREL_EXPL6, + S_TNTBARREL_EXPL7, S_TNTBARREL_FLYING, // TNT proximity shell From a46b3976593b2c33c60a90a6a203839958331c17 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 31 Jan 2020 14:35:19 -0800 Subject: [PATCH 18/28] Remove code that does effectively nothing --- src/r_patch.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/r_patch.c b/src/r_patch.c index b4127f825..80c0f846f 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -1196,7 +1196,7 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp INT32 angle; patch_t *patch; patch_t *newpatch; - UINT16 *rawsrc, *rawdst; + UINT16 *rawdst; size_t size; INT32 bflip = (flip != 0x00); @@ -1242,16 +1242,6 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp leftoffset = width - leftoffset; } - // Draw the sprite to a temporary buffer. - size = (width*height); - rawsrc = Z_Malloc(size * sizeof(UINT16), PU_STATIC, NULL); - - // can't memset here - for (i = 0; i < size; i++) - rawsrc[i] = 0xFF00; - - R_PatchToMaskedFlat(patch, rawsrc, bflip); - // Don't cache angle = 0 for (angle = 1; angle < ROTANGLES; angle++) { From ec02a90ebc2d9edcbc1c71d46234d6700ec25932 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sat, 1 Feb 2020 14:29:49 +0800 Subject: [PATCH 19/28] Make flight controls less bullshit --- src/p_user.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 17a4e2ed1..636448196 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5503,10 +5503,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) ; // Can't do anything if you're a fish out of water! else if (player->powers[pw_tailsfly]) // If currently flying, give an ascend boost. { - if (!player->fly1) - player->fly1 = 20; - else - player->fly1 = 2; + player->fly1 = 20; if (player->charability == CA_SWIM) player->fly1 /= 2; @@ -8487,7 +8484,10 @@ static void P_MovePlayer(player_t *player) // Descend if (cmd->buttons & BT_USE && !(player->pflags & PF_STASIS) && !player->exiting && !(player->mo->eflags & MFE_GOOWATER)) if (P_MobjFlip(player->mo)*player->mo->momz > -FixedMul(5*actionspd, player->mo->scale)) + { + player->fly1 = 0; P_SetObjectMomZ(player->mo, -actionspd/2, true); + } } else From f5e49ace00820969fbd74bea158935ed9fdc6649 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sat, 1 Feb 2020 14:49:48 +0800 Subject: [PATCH 20/28] Have spin set fly1 to 2 instead of 0, akin to the previous cutoff behavior --- src/p_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 636448196..221e22612 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8485,7 +8485,8 @@ static void P_MovePlayer(player_t *player) if (cmd->buttons & BT_USE && !(player->pflags & PF_STASIS) && !player->exiting && !(player->mo->eflags & MFE_GOOWATER)) if (P_MobjFlip(player->mo)*player->mo->momz > -FixedMul(5*actionspd, player->mo->scale)) { - player->fly1 = 0; + if (player->fly1 > 2) + player->fly1 = 2; P_SetObjectMomZ(player->mo, -actionspd/2, true); } From 7dd0f2b80847e4ca794457c38c52082628b20664 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Sat, 1 Feb 2020 20:19:39 +0100 Subject: [PATCH 21/28] Fix splitscreen player being unable to move --- src/d_clisrv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index ee4e62b91..79b63bb81 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4678,6 +4678,7 @@ static void Local_Maketic(INT32 realtics) G_BuildTiccmd(&localcmds2, realtics, 2); localcmds.angleturn |= TICCMD_RECEIVED; + localcmds2.angleturn |= TICCMD_RECEIVED; } // This function is utter bullshit and is responsible for From ab8eed6efbaabfb248c857b17d03d07a817d1345 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 1 Feb 2020 18:10:58 -0800 Subject: [PATCH 22/28] Add missing conditions to CleanupPlayerName --- src/d_netcmd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 23ec00b2e..b74a8a76d 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1010,6 +1010,17 @@ static void CleanupPlayerName(INT32 playernum, const char *newname) tmpname = p; + do + { + /* from EnsurePlayerNameIsGood */ + if (!isprint(*p) || *p == ';' || (UINT8)*p >= 0x80) + break; + } + while (*++p) ; + + if (*p)/* bad char found */ + break; + // Remove trailing spaces. p = &tmpname[strlen(tmpname)-1]; // last character while (*p == ' ' && p >= tmpname) From bf3b7fc5b03298cee514ab7e190de5bef99f614f Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 1 Feb 2020 18:20:35 -0800 Subject: [PATCH 23/28] Clean player name before joining!!! --- src/d_clisrv.c | 6 ++++++ src/d_netcmd.c | 2 +- src/d_netcmd.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 704fc0901..bcae17aa3 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1275,8 +1275,14 @@ static boolean CL_SendJoin(void) netbuffer->u.clientcfg.localplayers = localplayers; netbuffer->u.clientcfg.version = VERSION; netbuffer->u.clientcfg.subversion = SUBVERSION; + + CleanupPlayerName(consoleplayer, cv_playername.zstring); + if (splitscreen) + CleanupPlayerName(1, cv_playername2.zstring);/* 1 is a HACK? oh no */ + strncpy(netbuffer->u.clientcfg.names[0], cv_playername.zstring, MAXPLAYERNAME); strncpy(netbuffer->u.clientcfg.names[1], cv_playername2.zstring, MAXPLAYERNAME); + return HSendPacket(servernode, true, 0, sizeof (clientconfig_pak)); } diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b74a8a76d..cfd2162c5 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -982,7 +982,7 @@ boolean EnsurePlayerNameIsGood(char *name, INT32 playernum) * SetPlayerName * \author Graue */ -static void CleanupPlayerName(INT32 playernum, const char *newname) +void CleanupPlayerName(INT32 playernum, const char *newname) { char *buf; char *p; diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 8f857c6db..f258cde62 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -194,6 +194,7 @@ typedef union { // add game commands, needs cleanup void D_RegisterServerCommands(void); void D_RegisterClientCommands(void); +void CleanupPlayerName(INT32 playernum, const char *newname); boolean EnsurePlayerNameIsGood(char *name, INT32 playernum); void D_SendPlayerConfig(void); void Command_ExitGame_f(void); From d5ced42f06e9b75807b93a4c490ac69211bfc71c Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 1 Feb 2020 18:22:03 -0800 Subject: [PATCH 24/28] Remove Player 0 --- src/d_netcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index cfd2162c5..35f23ab27 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -624,7 +624,7 @@ void D_RegisterClientCommands(void) // Set default player names // Monster Iestyn (12/08/19): not sure where else I could have actually put this, but oh well for (i = 0; i < MAXPLAYERS; i++) - sprintf(player_names[i], "Player %d", i); + sprintf(player_names[i], "Player %d", 1 + i); if (dedicated) return; From d03d09f397e1ff07c7b430e028cf9b2f1f53a0c5 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Wed, 5 Feb 2020 15:20:35 -0500 Subject: [PATCH 25/28] Update credits again --- src/f_finale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index ce4ec0eb4..99ada119a 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1234,7 +1234,7 @@ static const char *credits[] = { "Thomas \"Shadow Hog\" Igoe", "Alexander \"DrTapeworm\" Moench-Ford", "\"Kaito Sinclaire\"", - "\"QueenDelta\"", + "Anna \"QueenDelta\" Sandlin", "Wessel \"sphere\" Smit", "\"Spazzo\"", "\"SSNTails\"", From 7a5d7afb30a428b22831f028b3ceb565452c9fa3 Mon Sep 17 00:00:00 2001 From: lachwright Date: Thu, 6 Feb 2020 23:06:15 +0800 Subject: [PATCH 26/28] Add Rob as the game's producer --- src/f_finale.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/f_finale.c b/src/f_finale.c index 99ada119a..d6ffed26f 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1120,6 +1120,9 @@ static const char *credits[] = { "\1Sonic Robo Blast II", "\1Credits", "", + "\1Producer", + "Rob Tisdell", + "", "\1Game Design", "Ben \"Mystic\" Geyer", "\"SSNTails\"", From 2d0e72d756213f4bdf942a668029a2652e8827cc Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 8 Feb 2020 21:40:30 -0300 Subject: [PATCH 27/28] Fix broken GT_ constants with custom gametypes --- src/g_game.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 8383782cb..efc96a50f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3256,8 +3256,8 @@ void G_AddGametypeConstant(INT16 gtype, const char *newgtconst) { size_t r = 0; // read size_t w = 0; // write - char *gtconst = Z_Calloc(strlen(newgtconst) + 3, PU_STATIC, NULL); - char *tmpconst = Z_Calloc(strlen(newgtconst), PU_STATIC, NULL); + char *gtconst = Z_Calloc(strlen(newgtconst) + 4, PU_STATIC, NULL); + char *tmpconst = Z_Calloc(strlen(newgtconst) + 1, PU_STATIC, NULL); // Copy the gametype name. strcpy(tmpconst, newgtconst); From 15c263e9c729c56f5c780656697898ec94e851b2 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 9 Feb 2020 10:35:23 -0500 Subject: [PATCH 28/28] Z_Zone: fixup Valgrind support --- src/z_zone.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/z_zone.c b/src/z_zone.c index 5a0ff638b..e0e37312a 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -232,12 +232,12 @@ void Z_Free(void *ptr) // Free the memory and get rid of the block. free(block->real); - block->prev->next = block->next; - block->next->prev = block->prev; - free(block); #ifdef VALGRIND_DESTROY_MEMPOOL VALGRIND_DESTROY_MEMPOOL(block); #endif + block->prev->next = block->next; + block->next->prev = block->prev; + free(block); } /** malloc() that doesn't accept failure. @@ -317,13 +317,9 @@ void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) // The mem header lives 'sizeof (memhdr_t)' bytes before given. hdr = (memhdr_t *)((UINT8 *)given - sizeof *hdr); -#ifdef VALGRIND_CREATE_MEMPOOL - VALGRIND_CREATE_MEMPOOL(block, padsize, Z_calloc); +#ifdef HAVE_VALGRIND Z_calloc = false; #endif -#ifdef VALGRIND_MEMPOOL_ALLOC - VALGRIND_MEMPOOL_ALLOC(block, hdr, size + sizeof *hdr); -#endif block->next = head.next; block->prev = &head; @@ -341,6 +337,13 @@ void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) block->size = blocksize; block->realsize = size; +#ifdef VALGRIND_CREATE_MEMPOOL + VALGRIND_CREATE_MEMPOOL(block, padsize, Z_calloc); +#endif +//#ifdef VALGRIND_MEMPOOL_ALLOC +// VALGRIND_MEMPOOL_ALLOC(block, hdr, size + sizeof *hdr); +//#endif + hdr->id = ZONEID; hdr->block = block;