From bf8a39f7eedcf8011e3f19015d22bdde9b3e7589 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 11 Jan 2020 15:40:18 -0800 Subject: [PATCH 01/68] 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/68] 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/68] 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/68] 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 bbbe76d2ca4a12745bb54e35be48fd1b3714cfe0 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 16 Jan 2020 03:09:02 -0800 Subject: [PATCH 05/68] Expose viewmobj as r_viewmobj --- src/r_main.c | 55 +++++++++++++++++++++++++-------------------------- src/r_state.h | 1 + 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 4cbf101b7..f25ea96fd 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -71,6 +71,7 @@ angle_t viewangle, aimingangle; fixed_t viewcos, viewsin; sector_t *viewsector; player_t *viewplayer; +mobj_t *r_viewmobj; // // precalculated math tables @@ -741,8 +742,6 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y) // R_SetupFrame // -static mobj_t *viewmobj; - // WARNING: a should be unsigned but to add with 2048, it isn't! #define AIMINGTODY(a) FixedDiv((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)>>FRACBITS, fovtan) @@ -799,16 +798,16 @@ void R_SetupFrame(player_t *player) if (player->awayviewtics) { // cut-away view stuff - viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN - I_Assert(viewmobj != NULL); - viewz = viewmobj->z + 20*FRACUNIT; + r_viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN + I_Assert(r_viewmobj != NULL); + viewz = r_viewmobj->z + 20*FRACUNIT; aimingangle = player->awayviewaiming; - viewangle = viewmobj->angle; + viewangle = r_viewmobj->angle; } else if (!player->spectator && chasecam) // use outside cam view { - viewmobj = NULL; + r_viewmobj = NULL; viewz = thiscam->z + (thiscam->height>>1); aimingangle = thiscam->aiming; viewangle = thiscam->angle; @@ -818,11 +817,11 @@ void R_SetupFrame(player_t *player) { viewz = player->viewz; - viewmobj = player->mo; - I_Assert(viewmobj != NULL); + r_viewmobj = player->mo; + I_Assert(r_viewmobj != NULL); aimingangle = player->aiming; - viewangle = viewmobj->angle; + viewangle = r_viewmobj->angle; if (!demoplayback && player->playerstate != PST_DEAD) { @@ -856,13 +855,13 @@ void R_SetupFrame(player_t *player) } else { - viewx = viewmobj->x; - viewy = viewmobj->y; + viewx = r_viewmobj->x; + viewy = r_viewmobj->y; viewx += quake.x; viewy += quake.y; - if (viewmobj->subsector) - viewsector = viewmobj->subsector->sector; + if (r_viewmobj->subsector) + viewsector = r_viewmobj->subsector->sector; else viewsector = R_PointInSubsector(viewx, viewy)->sector; } @@ -884,12 +883,12 @@ void R_SkyboxFrame(player_t *player) thiscam = &camera; // cut-away view stuff - viewmobj = skyboxmo[0]; + r_viewmobj = skyboxmo[0]; #ifdef PARANOIA - if (!viewmobj) + if (!r_viewmobj) { const size_t playeri = (size_t)(player - players); - I_Error("R_SkyboxFrame: viewmobj null (player %s)", sizeu1(playeri)); + I_Error("R_SkyboxFrame: r_viewmobj null (player %s)", sizeu1(playeri)); } #endif if (player->awayviewtics) @@ -920,13 +919,13 @@ void R_SkyboxFrame(player_t *player) } } } - viewangle += viewmobj->angle; + viewangle += r_viewmobj->angle; viewplayer = player; - viewx = viewmobj->x; - viewy = viewmobj->y; - viewz = viewmobj->z; // 26/04/17: use actual Z position instead of spawnpoint angle! + viewx = r_viewmobj->x; + viewy = r_viewmobj->y; + viewz = r_viewmobj->z; // 26/04/17: use actual Z position instead of spawnpoint angle! if (mapheaderinfo[gamemap-1]) { @@ -966,29 +965,29 @@ void R_SkyboxFrame(player_t *player) else if (mh->skybox_scaley < 0) y = (campos.y - skyboxmo[1]->y) * -mh->skybox_scaley; - if (viewmobj->angle == 0) + if (r_viewmobj->angle == 0) { viewx += x; viewy += y; } - else if (viewmobj->angle == ANGLE_90) + else if (r_viewmobj->angle == ANGLE_90) { viewx -= y; viewy += x; } - else if (viewmobj->angle == ANGLE_180) + else if (r_viewmobj->angle == ANGLE_180) { viewx -= x; viewy -= y; } - else if (viewmobj->angle == ANGLE_270) + else if (r_viewmobj->angle == ANGLE_270) { viewx += y; viewy -= x; } else { - angle_t ang = viewmobj->angle>>ANGLETOFINESHIFT; + angle_t ang = r_viewmobj->angle>>ANGLETOFINESHIFT; viewx += FixedMul(x,FINECOSINE(ang)) - FixedMul(y, FINESINE(ang)); viewy += FixedMul(x, FINESINE(ang)) + FixedMul(y,FINECOSINE(ang)); } @@ -999,8 +998,8 @@ void R_SkyboxFrame(player_t *player) viewz += campos.z * -mh->skybox_scalez; } - if (viewmobj->subsector) - viewsector = viewmobj->subsector->sector; + if (r_viewmobj->subsector) + viewsector = r_viewmobj->subsector->sector; else viewsector = R_PointInSubsector(viewx, viewy)->sector; diff --git a/src/r_state.h b/src/r_state.h index 75566923b..e7838e9fb 100644 --- a/src/r_state.h +++ b/src/r_state.h @@ -83,6 +83,7 @@ extern fixed_t viewx, viewy, viewz; extern angle_t viewangle, aimingangle; extern sector_t *viewsector; extern player_t *viewplayer; +extern mobj_t *r_viewmobj; extern consvar_t cv_allowmlook; extern consvar_t cv_maxportals; From 542e38e717e2a8cf38a9ce5b9fa2affe56424781 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 16 Jan 2020 03:09:16 -0800 Subject: [PATCH 06/68] Don't draw player mobj in first person This solves that annoying albeit slightly amusing bug where your sprite clips into your view during a quake. For OpenGL, this also solves the player's model rendering while in first person. So you'll no longer be looking through Sonic's body! --- src/hardware/hw_main.c | 6 ++++-- src/r_things.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index f5f3edfc1..e658051a6 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5422,7 +5422,8 @@ static void HWR_AddSprites(sector_t *sec) { for (thing = sec->thinglist; thing; thing = thing->snext) { - if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) + if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW || + thing == r_viewmobj) continue; approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); @@ -5445,7 +5446,8 @@ static void HWR_AddSprites(sector_t *sec) { // Draw everything in sector, no checks for (thing = sec->thinglist; thing; thing = thing->snext) - if (!(thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)) + if (!(thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW || + thing == r_viewmobj)) HWR_ProjectSprite(thing); } diff --git a/src/r_things.c b/src/r_things.c index ef496335e..2a18c06a4 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1845,7 +1845,8 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) { for (thing = sec->thinglist; thing; thing = thing->snext) { - if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) + if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW || + thing == r_viewmobj) continue; approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); @@ -1868,7 +1869,8 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) { // Draw everything in sector, no checks for (thing = sec->thinglist; thing; thing = thing->snext) - if (!(thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)) + if (!(thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW || + thing == r_viewmobj)) R_ProjectSprite(thing); } From 28c466a0a5fe36172026b0376c7cc6868e7dbdd0 Mon Sep 17 00:00:00 2001 From: lachwright Date: Thu, 16 Jan 2020 22:56:01 +0800 Subject: [PATCH 07/68] 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 762223db7ceca9ed428da723c84f121c6292bf4c Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 17 Jan 2020 20:45:55 -0800 Subject: [PATCH 08/68] Duplicated code is gone, so sad --- src/hardware/hw_main.c | 44 +++----------------- src/r_things.c | 93 ++++++++++++++++++++++++------------------ src/r_things.h | 9 ++++ 3 files changed, 68 insertions(+), 78 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index e658051a6..7ab0929da 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5399,7 +5399,7 @@ static void HWR_AddSprites(sector_t *sec) #ifdef HWPRECIP precipmobj_t *precipthing; #endif - fixed_t approx_dist, limit_dist, hoop_limit_dist; + fixed_t limit_dist, hoop_limit_dist; // BSP is traversed by subsector. // A sector might have been split into several @@ -5418,37 +5418,10 @@ static void HWR_AddSprites(sector_t *sec) // If a limit exists, handle things a tiny bit different. limit_dist = (fixed_t)(cv_drawdist.value) << FRACBITS; hoop_limit_dist = (fixed_t)(cv_drawdist_nights.value) << FRACBITS; - if (limit_dist || hoop_limit_dist) + for (thing = sec->thinglist; thing; thing = thing->snext) { - for (thing = sec->thinglist; thing; thing = thing->snext) - { - if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW || - thing == r_viewmobj) - continue; - - approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); - - if (thing->sprite == SPR_HOOP) - { - if (hoop_limit_dist && approx_dist > hoop_limit_dist) - continue; - } - else - { - if (limit_dist && approx_dist > limit_dist) - continue; - } - + if (R_ThingVisibleWithinDist(thing, limit_dist, hoop_limit_dist)) HWR_ProjectSprite(thing); - } - } - else - { - // Draw everything in sector, no checks - for (thing = sec->thinglist; thing; thing = thing->snext) - if (!(thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW || - thing == r_viewmobj)) - HWR_ProjectSprite(thing); } #ifdef HWPRECIP @@ -5457,15 +5430,8 @@ static void HWR_AddSprites(sector_t *sec) { for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext) { - if (precipthing->precipflags & PCF_INVISIBLE) - continue; - - approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y); - - if (approx_dist > limit_dist) - continue; - - HWR_ProjectPrecipitationSprite(precipthing); + if (R_PrecipThingVisible(precipthing, limit_dist)) + HWR_ProjectPrecipitationSprite(precipthing); } } #endif diff --git a/src/r_things.c b/src/r_things.c index 2a18c06a4..2a2872a34 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1808,7 +1808,7 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) mobj_t *thing; precipmobj_t *precipthing; // Tails 08-25-2002 INT32 lightnum; - fixed_t approx_dist, limit_dist, hoop_limit_dist; + fixed_t limit_dist, hoop_limit_dist; if (rendermode != render_soft) return; @@ -1841,37 +1841,10 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) // If a limit exists, handle things a tiny bit different. limit_dist = (fixed_t)(cv_drawdist.value) << FRACBITS; hoop_limit_dist = (fixed_t)(cv_drawdist_nights.value) << FRACBITS; - if (limit_dist || hoop_limit_dist) + for (thing = sec->thinglist; thing; thing = thing->snext) { - for (thing = sec->thinglist; thing; thing = thing->snext) - { - if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW || - thing == r_viewmobj) - continue; - - approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); - - if (thing->sprite == SPR_HOOP) - { - if (hoop_limit_dist && approx_dist > hoop_limit_dist) - continue; - } - else - { - if (limit_dist && approx_dist > limit_dist) - continue; - } - + if (R_ThingVisibleWithinDist(thing, limit_dist, hoop_limit_dist)) R_ProjectSprite(thing); - } - } - else - { - // Draw everything in sector, no checks - for (thing = sec->thinglist; thing; thing = thing->snext) - if (!(thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW || - thing == r_viewmobj)) - R_ProjectSprite(thing); } // no, no infinite draw distance for precipitation. this option at zero is supposed to turn it off @@ -1879,15 +1852,8 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) { for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext) { - if (precipthing->precipflags & PCF_INVISIBLE) - continue; - - approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y); - - if (approx_dist > limit_dist) - continue; - - R_ProjectPrecipitationSprite(precipthing); + if (R_PrecipThingVisible(precipthing, limit_dist)) + R_ProjectPrecipitationSprite(precipthing); } } } @@ -2582,6 +2548,55 @@ void R_ClipSprites(drawseg_t* dsstart, portal_t* portal) } } +/* Check if thing may be drawn from our current view. */ +boolean R_ThingVisible (mobj_t *thing) +{ + return (!( + thing->sprite == SPR_NULL || + ( thing->flags2 & (MF2_DONTDRAW) ) || + thing == r_viewmobj + )); +} + +boolean R_ThingVisibleWithinDist (mobj_t *thing, + fixed_t limit_dist, + fixed_t hoop_limit_dist) +{ + fixed_t approx_dist; + + if (! R_ThingVisible(thing)) + return false; + + approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); + + if (thing->sprite == SPR_HOOP) + { + if (hoop_limit_dist && approx_dist > hoop_limit_dist) + return false; + } + else + { + if (limit_dist && approx_dist > limit_dist) + return false; + } + + return true; +} + +/* Check if precipitation may be drawn from our current view. */ +boolean R_PrecipThingVisible (precipmobj_t *precipthing, + fixed_t limit_dist) +{ + fixed_t approx_dist; + + if (( precipthing->precipflags & PCF_INVISIBLE )) + return false; + + approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y); + + return ( approx_dist <= limit_dist ); +} + // // R_DrawMasked // diff --git a/src/r_things.h b/src/r_things.h index 1b74dd74e..76587868d 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -61,6 +61,15 @@ void R_InitSprites(void); void R_ClearSprites(void); void R_ClipSprites(drawseg_t* dsstart, portal_t* portal); +boolean R_ThingVisible (mobj_t *thing); + +boolean R_ThingVisibleWithinDist (mobj_t *thing, + fixed_t draw_dist, + fixed_t nights_draw_dist); + +boolean R_PrecipThingVisible (precipmobj_t *precipthing, + fixed_t precip_draw_dist); + /** Used to count the amount of masked elements * per portal to later group them in separate * drawnode lists. From 94a2f0bb4fd40562262f2e37a7fc392b2aa42e75 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 17 Jan 2020 20:56:32 -0800 Subject: [PATCH 09/68] Don't draw Tails' tails in first person (MF2_LINKDRAW) --- src/hardware/hw_main.c | 2 +- src/r_things.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 7ab0929da..d4682fc9d 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5695,7 +5695,7 @@ static void HWR_ProjectSprite(mobj_t *thing) if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer) { // bodge support - not nearly as comprehensive as r_things.c, but better than nothing - if (thing->tracer->sprite == SPR_NULL || thing->tracer->flags2 & MF2_DONTDRAW) + if (! R_ThingVisible(thing->tracer)) return; } diff --git a/src/r_things.c b/src/r_things.c index 2a2872a34..cba080448 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1413,7 +1413,7 @@ static void R_ProjectSprite(mobj_t *thing) thing = thing->tracer; - if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW) + if (! R_ThingVisible(thing)) return; tr_x = thing->x - viewx; From dfcd058c80db463c4564e1bc7db746e25cc7819e Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 21 Jan 2020 02:29:29 -0800 Subject: [PATCH 10/68] (BRUH MOMENT) activettscale was -1, so do recache after it's set --- src/f_finale.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index bc904d8f2..e37eab764 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -2693,8 +2693,18 @@ static void F_FigureActiveTtScale(void) SINT8 newttscale = max(1, min(6, vid.dupx)); SINT8 oldttscale = activettscale; - if (newttscale == testttscale) - return; + if (needpatchrecache) + ttloaded[0] = ttloaded[1] = ttloaded[2] = ttloaded[3] = ttloaded[4] = ttloaded[5] = 0; + else + { + if (newttscale == testttscale) + return; + + // We have a new ttscale, so load gfx + if(oldttscale > 0) + F_UnloadAlacroixGraphics(oldttscale); + } + testttscale = newttscale; // If ttscale is unavailable: look for lower scales, then higher scales. @@ -2712,10 +2722,6 @@ static void F_FigureActiveTtScale(void) activettscale = (newttscale >= 1 && newttscale <= 6) ? newttscale : 0; - // We have a new ttscale, so load gfx - if(oldttscale > 0) - F_UnloadAlacroixGraphics(oldttscale); - if(activettscale > 0) F_LoadAlacroixGraphics(activettscale); } @@ -2757,12 +2763,6 @@ void F_TitleScreenDrawer(void) return; #endif - if (needpatchrecache && (curttmode == TTMODE_ALACROIX)) - { - ttloaded[0] = ttloaded[1] = ttloaded[2] = ttloaded[3] = ttloaded[4] = ttloaded[5] = 0; - F_LoadAlacroixGraphics(activettscale); - } - switch(curttmode) { case TTMODE_OLD: From 332b22a87ae42acea8b0c938170983195cd726d3 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Fri, 24 Jan 2020 23:54:54 -0600 Subject: [PATCH 11/68] 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 2dd13bb2a4f434a6436cb341fccb68cd95e0c6dd Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 25 Jan 2020 11:31:06 -0500 Subject: [PATCH 12/68] Fix damagetype for Cybrak flamethrower. --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index de6ff475c..ef1d161de 100644 --- a/src/info.c +++ b/src/info.c @@ -6487,7 +6487,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 24*FRACUNIT, // radius 24*FRACUNIT, // height 0, // display offset - 0, // mass + DMG_FIRE, // mass 1, // damage sfx_None, // activesound MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY, // flags From f90c70ebe287e215415164dc341fe7905ceb2dae Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 25 Jan 2020 11:34:30 -0500 Subject: [PATCH 13/68] Make the DMG actually *applied*. Consequence: flame will continue flying through player instead of dying in midair and dropping a flame, but this is actually desirable given the current behaviour looks kind of shitty. --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index ef1d161de..45034fe37 100644 --- a/src/info.c +++ b/src/info.c @@ -6490,7 +6490,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_FIRE, // mass 1, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY, // flags + MF_NOBLOCKMAP|MF_MISSILE|MF_PAIN|MF_NOGRAVITY, // flags S_NULL // raisestate }, From 65e84978fa4bf86f6563367641c26ac6feba9fc0 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sun, 26 Jan 2020 04:51:00 +0800 Subject: [PATCH 14/68] 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 e57589b1068ea3dec70bd3aa501f38371d409b24 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 25 Jan 2020 19:03:15 -0600 Subject: [PATCH 15/68] Fix the minecart angle thing --- src/p_user.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 901cd8ae6..fd3f860cf 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -10790,12 +10790,23 @@ static void P_MinecartThink(player_t *player) else if (angdiff > ANGLE_180 && angdiff < InvAngle(MINECARTCONEMAX)) player->mo->angle = minecart->angle - MINECARTCONEMAX; - if (angdiff + minecart->angle != player->mo->angle && (!demoplayback || P_AnalogMove(player))) + if (!demoplayback || P_AnalogMove(player)) { + angle_t *ang = NULL; + if (player == &players[consoleplayer]) - localangle = player->mo->angle; + ang = &localangle; else if (player == &players[secondarydisplayplayer]) - localangle2 = player->mo->angle; + ang = &localangle2; + + if (ang) + { + angdiff = *ang - minecart->angle; + if (angdiff < ANGLE_180 && angdiff > MINECARTCONEMAX) + *ang = minecart->angle + MINECARTCONEMAX; + else if (angdiff > ANGLE_180 && angdiff < InvAngle(MINECARTCONEMAX)) + *ang = minecart->angle - MINECARTCONEMAX; + } } } From ea28304d8c291ece7b8e489a932fc4c862241fb3 Mon Sep 17 00:00:00 2001 From: Zwip-Zwap Zapony Date: Sun, 26 Jan 2020 10:53:37 +0100 Subject: [PATCH 16/68] Fix missing "RINGSNUMTICS" in dehacked.c This fixes 16/20 of the HUD items in dehacked.c being off by one (Same case as the MFE_ flags thing) Also fixes dehacked.c mentioning "LAPS", which doesn't exist --- src/dehacked.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 4c36639a2..45f00b8cf 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -9143,6 +9143,7 @@ static const char *const HUDITEMS_LIST[] = { "RINGS", "RINGSNUM", + "RINGSNUMTICS", "SCORE", "SCORENUM", @@ -9162,8 +9163,7 @@ static const char *const HUDITEMS_LIST[] = { "TIMELEFTNUM", "TIMEUP", "HUNTPICS", - "POWERUPS", - "LAP" + "POWERUPS" }; static const char *const MENUTYPES_LIST[] = { From d08929b3d77d9e5686abddf8e07c0b2cdd927949 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 26 Jan 2020 22:46:57 -0300 Subject: [PATCH 17/68] 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 18/68] 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 19/68] 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 20/68] 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 21/68] 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 22/68] 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 23/68] "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 cf7b4d826a82d561b6981dd1fdce106e57fbc234 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 26 Jan 2020 23:46:07 -0300 Subject: [PATCH 24/68] Remove redundancy --- src/g_game.c | 4 ++++ src/p_setup.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index f5d7cd2fb..8383782cb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1941,6 +1941,10 @@ boolean G_IsTitleCardAvailable(void) if (gametyperules & GTR_NOTITLECARD) return false; + // The current level has no name. + if (!mapheaderinfo[gamemap-1]->lvlttl[0]) + return false; + // The title card is available. return true; } diff --git a/src/p_setup.c b/src/p_setup.c index 2b0a5efa3..c291dc7c3 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3684,8 +3684,7 @@ boolean P_LoadLevel(boolean fromnetsave) return true; // If so... - if ((!(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)) && (*mapheaderinfo[gamemap-1]->lvlttl != '\0')) - G_PreLevelTitleCard(); + G_PreLevelTitleCard(); return true; } From 1774ba22b6ea77fbc0442573d08e00439e9b6fbb Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 26 Jan 2020 23:50:36 -0300 Subject: [PATCH 25/68] Fix title card not showing up at all if focus lost --- src/st_stuff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 4676506fc..d99d564c8 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1278,13 +1278,15 @@ void ST_preDrawTitleCard(void) // void ST_runTitleCard(void) { + boolean run = !(paused || P_AutoPause()); + if (!G_IsTitleCardAvailable()) return; if (lt_ticker >= (lt_endtime + TICRATE)) return; - if (!(paused || P_AutoPause())) + if (run || (lt_ticker < PRELEVELTIME)) { // tick lt_ticker++; From 1548a22ea902a201de6779a6877bd225c7cf735e Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 27 Jan 2020 00:44:10 -0300 Subject: [PATCH 26/68] Fix M_DrawNightsAttackMountains being broken for obvious reasons --- src/m_menu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index f8c14dd69..049b66d67 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5388,7 +5388,8 @@ static void M_DrawNightsAttackMountains(void) static INT32 bgscrollx; INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); patch_t *background = W_CachePatchName(curbgname, PU_PATCH); - INT32 x = FixedInt(bgscrollx) % SHORT(background->width); + INT16 w = SHORT(background->width); + INT32 x = FixedInt(-bgscrollx) % w; INT32 y = BASEVIDHEIGHT - SHORT(background->height)*2; if (vid.height != BASEVIDHEIGHT * dupz) @@ -5396,11 +5397,13 @@ static void M_DrawNightsAttackMountains(void) V_DrawFill(0, y+50, vid.width, BASEVIDHEIGHT, V_SNAPTOLEFT|31); V_DrawScaledPatch(x, y, V_SNAPTOLEFT, background); - x += SHORT(background->width); + x += w; if (x < BASEVIDWIDTH) V_DrawScaledPatch(x, y, V_SNAPTOLEFT, background); - bgscrollx -= (FRACUNIT/2); + bgscrollx += (FRACUNIT/2); + if (bgscrollx > w< Date: Mon, 27 Jan 2020 13:28:07 -0300 Subject: [PATCH 27/68] Fix F_StartContinue fading out incorrectly in OpenGL --- src/f_finale.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index bc904d8f2..ed89e05cd 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -3628,7 +3628,6 @@ void F_StartContinue(void) } wipestyleflags = WSF_FADEOUT; - F_TryColormapFade(31); G_SetGamestate(GS_CONTINUING); gameaction = ga_nothing; From 636093a59ddd95b25d79c4ebff51dc6412de1956 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 27 Jan 2020 13:55:13 -0300 Subject: [PATCH 28/68] 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: Tue, 28 Jan 2020 14:02:36 +0100 Subject: [PATCH 29/68] Only call P_CheckSurvivors() in tag gametypes --- src/p_tick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_tick.c b/src/p_tick.c index 0b30ff42d..74472b71f 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -600,7 +600,7 @@ void P_Ticker(boolean run) { players[i].quittime++; - if (players[i].quittime == 30 * TICRATE) + if (players[i].quittime == 30 * TICRATE && G_TagGametype()) P_CheckSurvivors(); if (server && players[i].quittime >= (tic_t)FixedMul(cv_rejointimeout.value, 60 * TICRATE) From f4de1938098067327731d8502ff4ec68e74ee027 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Thu, 30 Jan 2020 22:11:50 -0500 Subject: [PATCH 30/68] Fix memory leak while chat is on screen --- src/hu_stuff.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 274c2bdfd..69e8c99ff 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1437,7 +1437,7 @@ static void HU_drawMiniChat(void) for (; i>0; i--) { - const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]); + char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]); size_t j = 0; INT32 linescount = 0; @@ -1479,6 +1479,9 @@ static void HU_drawMiniChat(void) dy = 0; dx = 0; msglines += linescount+1; + + if (msg) + Z_Free(msg); } y = chaty - charheight*(msglines+1); @@ -1501,7 +1504,7 @@ static void HU_drawMiniChat(void) INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below... INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one. size_t j = 0; - const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it. + char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it. UINT8 *colormap = NULL; while(msg[j]) // iterate through msg @@ -1547,6 +1550,9 @@ static void HU_drawMiniChat(void) } dy += charheight; dx = 0; + + if (msg) + Z_Free(msg); } // decrement addy and make that shit smooth: @@ -1598,7 +1604,7 @@ static void HU_drawChatLog(INT32 offset) { INT32 clrflag = 0; INT32 j = 0; - const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_log[i]); // get the current message, and word wrap it. + char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_log[i]); // get the current message, and word wrap it. UINT8 *colormap = NULL; while(msg[j]) // iterate through msg { @@ -1638,6 +1644,9 @@ static void HU_drawChatLog(INT32 offset) } dy += charheight; dx = 0; + + if (msg) + Z_Free(msg); } From 3afc766f5e36d094395fe0da41e7142be070e8c1 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 30 Jan 2020 23:58:35 -0800 Subject: [PATCH 31/68] 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 7c83e5e420fb91ddde3c464e667b2474d3b02f2f Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Fri, 31 Jan 2020 16:37:55 -0500 Subject: [PATCH 32/68] Implement folder blacklisting --- src/w_wad.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/w_wad.c b/src/w_wad.c index dc400987f..b0c901302 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1746,6 +1746,18 @@ W_VerifyWAD (FILE *fp, lumpchecklist_t *checklist, boolean status) return true; } +// List of blacklisted folders to use when checking the PK3 +static lumpchecklist_t folderblacklist[] = +{ + {"Lua/", 4}, + {"SOC/", 4}, + {"Sprites/", 8}, + {"Textures/", 9}, + {"Patches/", 8}, + {"Flats/", 6}, + {"Fades/", 6} +}; + static int W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status) { @@ -1791,6 +1803,13 @@ W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status) if (fgets(fullname, zentry.namelen + 1, fp) != fullname) return true; + // Check for folders first, if it's blacklisted it will return false + if (W_VerifyName(fullname, folderblacklist, status)) + { + CONS_Printf("Blacklisted folder found - %s\n", fullname); + return false; + } + // Strip away file address and extension for the 8char name. if ((trimname = strrchr(fullname, '/')) != 0) trimname++; From 71707e6dca569abc5ea62a27f614ec962741f00b Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 31 Jan 2020 14:32:47 -0800 Subject: [PATCH 33/68] 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 34/68] 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 a2c15c5cb2c9d070e5a20420d8c45fd1db0c1832 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Fri, 31 Jan 2020 20:21:09 -0500 Subject: [PATCH 35/68] Only check if the directory is not empty, use strncasecmp for case insensitive comparing, and remove debug print --- src/w_wad.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index b0c901302..12d912c92 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1691,7 +1691,7 @@ W_VerifyName (const char *name, lumpchecklist_t *checklist, boolean status) size_t j; for (j = 0; checklist[j].len && checklist[j].name; ++j) { - if (( strncmp(name, checklist[j].name, + if (( strncasecmp(name, checklist[j].name, checklist[j].len) != false ) == status) { return true; @@ -1803,20 +1803,13 @@ W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status) if (fgets(fullname, zentry.namelen + 1, fp) != fullname) return true; - // Check for folders first, if it's blacklisted it will return false - if (W_VerifyName(fullname, folderblacklist, status)) - { - CONS_Printf("Blacklisted folder found - %s\n", fullname); - return false; - } - // Strip away file address and extension for the 8char name. if ((trimname = strrchr(fullname, '/')) != 0) trimname++; else trimname = fullname; // Care taken for root files. - if (*trimname) // Ignore directories + if (*trimname) // Ignore directories, well kinda { if ((dotpos = strrchr(trimname, '.')) == 0) dotpos = fullname + strlen(fullname); // Watch for files without extension. @@ -1826,6 +1819,10 @@ W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status) if (! W_VerifyName(lumpname, checklist, status)) return false; + + // Check for directories next, if it's blacklisted it will return false + if (W_VerifyName(fullname, folderblacklist, status)) + return false; } free(fullname); From ec02a90ebc2d9edcbc1c71d46234d6700ec25932 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sat, 1 Feb 2020 14:29:49 +0800 Subject: [PATCH 36/68] 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 37/68] 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 38/68] 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 39/68] 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 40/68] 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 41/68] 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 17949496964e850128a562d0dc57b5f484b87556 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 2 Feb 2020 18:52:41 -0500 Subject: [PATCH 42/68] Add empty entry --- src/w_wad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/w_wad.c b/src/w_wad.c index 12d912c92..c9426b46c 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1755,7 +1755,8 @@ static lumpchecklist_t folderblacklist[] = {"Textures/", 9}, {"Patches/", 8}, {"Flats/", 6}, - {"Fades/", 6} + {"Fades/", 6}, + {NULL, 0}, }; static int From bd90c203668eb4350e9df69b4eb834ef420ababe Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 1 Feb 2020 16:24:13 -0800 Subject: [PATCH 43/68] Turn the shadow scale if-else into a switch statement, for sake of editing and in case object types ever change :sweat_drops: --- src/p_mobj.c | 70 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index f02ed4f84..10898f70e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10461,6 +10461,61 @@ void P_SceneryThinker(mobj_t *mobj) // GAME SPAWN FUNCTIONS // +static fixed_t P_DefaultMobjShadowScale (mobj_t *thing) +{ + switch (thing->type) + { + case MT_PLAYER: + case MT_ROLLOUTROCK: + + case MT_EGGMOBILE4_MACE: + case MT_SMALLMACE: + case MT_BIGMACE: + + case MT_SMALLGRABCHAIN: + case MT_BIGGRABCHAIN: + + case MT_YELLOWSPRINGBALL: + case MT_REDSPRINGBALL: + + return FRACUNIT; + + case MT_RING: + case MT_FLINGRING: + + case MT_BLUESPHERE: + case MT_FLINGBLUESPHERE: + case MT_BOMBSPHERE: + + case MT_REDTEAMRING: + case MT_BLUETEAMRING: + case MT_REDFLAG: + case MT_BLUEFLAG: + + case MT_EMBLEM: + + case MT_TOKEN: + case MT_EMERALD1: + case MT_EMERALD2: + case MT_EMERALD3: + case MT_EMERALD4: + case MT_EMERALD5: + case MT_EMERALD6: + case MT_EMERALD7: + case MT_EMERHUNT: + case MT_FLINGEMERALD: + + return 2*FRACUNIT/3; + + default: + + if (thing->flags & (MF_ENEMY|MF_BOSS)) + return FRACUNIT; + else + return 0; + } +} + // // P_SpawnMobj // @@ -10562,20 +10617,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) mobj->z = z; // Set shadowscale here, before spawn hook so that Lua can change it - if ( - type == MT_PLAYER || - type == MT_ROLLOUTROCK || - type == MT_EGGMOBILE4_MACE || - (type >= MT_SMALLMACE && type <= MT_REDSPRINGBALL) || - (mobj->flags & (MF_ENEMY|MF_BOSS)) - ) - mobj->shadowscale = FRACUNIT; - else if ( - type >= MT_RING && type <= MT_FLINGEMERALD && type != MT_EMERALDSPAWN - ) - mobj->shadowscale = 2*FRACUNIT/3; - else - mobj->shadowscale = 0; + mobj->shadowscale = P_DefaultMobjShadowScale(mobj); #ifdef HAVE_BLUA // DANGER! This can cause P_SpawnMobj to return NULL! From 01433c3648955308c42fef563d97c870d747fda6 Mon Sep 17 00:00:00 2001 From: colette Date: Mon, 3 Feb 2020 23:09:18 -0500 Subject: [PATCH 44/68] Fix title/card hud hooks grabbing the wrong functions --- src/lua_hudlib.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index f451944e3..d08b69ffc 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -1214,7 +1214,7 @@ void LUAh_GameHUD(player_t *stplayr) lua_getfield(gL, LUA_REGISTRYINDEX, "HUD"); I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, 2); // HUD[2] = rendering funcs + lua_rawgeti(gL, -1, 2+hudhook_game); // HUD[2] = rendering funcs I_Assert(lua_istable(gL, -1)); lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw @@ -1248,7 +1248,7 @@ void LUAh_ScoresHUD(void) lua_getfield(gL, LUA_REGISTRYINDEX, "HUD"); I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, 3); // HUD[3] = rendering funcs + lua_rawgeti(gL, -1, 2+hudhook_scores); // HUD[3] = rendering funcs I_Assert(lua_istable(gL, -1)); lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw @@ -1273,7 +1273,7 @@ void LUAh_TitleHUD(void) lua_getfield(gL, LUA_REGISTRYINDEX, "HUD"); I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, 4); // HUD[4] = rendering funcs + lua_rawgeti(gL, -1, 2+hudhook_title); // HUD[5] = rendering funcs I_Assert(lua_istable(gL, -1)); lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw @@ -1298,7 +1298,7 @@ void LUAh_TitleCardHUD(player_t *stplayr) lua_getfield(gL, LUA_REGISTRYINDEX, "HUD"); I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, 5); // HUD[5] = rendering funcs + lua_rawgeti(gL, -1, 2+hudhook_titlecard); // HUD[6] = rendering funcs I_Assert(lua_istable(gL, -1)); lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw @@ -1332,7 +1332,7 @@ void LUAh_IntermissionHUD(void) lua_getfield(gL, LUA_REGISTRYINDEX, "HUD"); I_Assert(lua_istable(gL, -1)); - lua_rawgeti(gL, -1, 4); // HUD[4] = rendering funcs + lua_rawgeti(gL, -1, 2+hudhook_intermission); // HUD[4] = rendering funcs I_Assert(lua_istable(gL, -1)); lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw From f1bdaa2fda5bacd0098663b8a597f99ebd13c43e Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 5 Feb 2020 19:55:40 +0000 Subject: [PATCH 45/68] Updated version number to 2.2.1, increment MODVERSION. Also updated CMakeLists.txt, appveyor.yml and this one Xcode project file as usual --- CMakeLists.txt | 2 +- appveyor.yml | 2 +- src/doomdef.h | 8 ++++---- src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bbf46945..855393de1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0) # DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string. # Version change is fine. project(SRB2 - VERSION 2.2.0 + VERSION 2.2.1 LANGUAGES C) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) diff --git a/appveyor.yml b/appveyor.yml index d33d3d3a3..20b18d7d5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.2.0.{branch}-{build} +version: 2.2.1.{branch}-{build} os: MinGW environment: diff --git a/src/doomdef.h b/src/doomdef.h index 3d02871e4..071090285 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -143,9 +143,9 @@ extern char logfilename[1024]; // we use comprevision and compbranch instead. #else #define VERSION 202 // Game version -#define SUBVERSION 0 // more precise version number -#define VERSIONSTRING "v2.2.0" -#define VERSIONSTRINGW L"v2.2.0" +#define SUBVERSION 1 // more precise version number +#define VERSIONSTRING "v2.2.1" +#define VERSIONSTRINGW L"v2.2.1" // Hey! If you change this, add 1 to the MODVERSION below! // Otherwise we can't force updates! #endif @@ -210,7 +210,7 @@ extern char logfilename[1024]; // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.2.0 is not version "1". -#define MODVERSION 40 +#define MODVERSION 41 // To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically. // Increment MINOREXECVERSION whenever a config change is needed that does not correspond diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj index ab3157c44..2b03cb8d4 100644 --- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1219,7 +1219,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.2.0; + CURRENT_PROJECT_VERSION = 2.2.1; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1231,7 +1231,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.2.0; + CURRENT_PROJECT_VERSION = 2.2.1; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( From d03d09f397e1ff07c7b430e028cf9b2f1f53a0c5 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Wed, 5 Feb 2020 15:20:35 -0500 Subject: [PATCH 46/68] 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 47/68] 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 5e516eb98d5f1ddff1afcb2bb9247349d244d533 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 8 Feb 2020 18:50:05 -0300 Subject: [PATCH 48/68] 1 left shifted by zero is still 1 --- src/dehacked.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 45f00b8cf..5fd12b774 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1293,10 +1293,7 @@ static void readgametype(MYFILE *f, char *gtname) UINT32 wordgt = 0; for (j = 0; GAMETYPERULE_LIST[j]; j++) if (fastcmp(word, GAMETYPERULE_LIST[j])) { - if (!j) // GTR_CAMPAIGN - wordgt |= 1; - else - wordgt |= (1< Date: Sat, 8 Feb 2020 21:40:30 -0300 Subject: [PATCH 49/68] 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 50/68] 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; From e5a325994e086a541744c9ee6642b7c734078985 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 9 Feb 2020 19:15:04 +0000 Subject: [PATCH 51/68] Use the provided Regex strings to properly turn the entire info.h states/mobjtypes lists into strings for dehacked.c ...it's surprising what we actually missed in the states list, apart from just the missing state (yes this makes the states fix branch redundant) --- src/dehacked.c | 74 +++++++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 45f00b8cf..e7ff6e400 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4945,19 +4945,19 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PLAY_SUPER_TRANS3", "S_PLAY_SUPER_TRANS4", "S_PLAY_SUPER_TRANS5", - "S_PLAY_SUPER_TRANS6", // This has special significance in the code. If you add more frames, search for it and make the appropriate changes. + "S_PLAY_SUPER_TRANS6", // technically the player goes here but it's an infinite tic state "S_OBJPLACE_DUMMY", - // 1-Up Box Sprites (uses player sprite) + // 1-Up Box Sprites overlay (uses player sprite) "S_PLAY_BOX1", "S_PLAY_BOX2", "S_PLAY_ICON1", "S_PLAY_ICON2", "S_PLAY_ICON3", - // Level end sign (uses player sprite) + // Level end sign overlay (uses player sprite) "S_PLAY_SIGN", // NiGHTS character (uses player sprite) @@ -5205,7 +5205,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ROBOHOOD_JUMP2", "S_ROBOHOOD_JUMP3", - // CastleBot FaceStabber + // Castlebot Facestabber "S_FACESTABBER_STND1", "S_FACESTABBER_STND2", "S_FACESTABBER_STND3", @@ -5425,6 +5425,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE_FLEE2", "S_EGGMOBILE_BALL", "S_EGGMOBILE_TARGET", + "S_BOSSEGLZ1", "S_BOSSEGLZ2", @@ -5477,7 +5478,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_EGGMOBILE3_FLEE1", "S_EGGMOBILE3_FLEE2", - // Boss 3 pinch + // Boss 3 Pinch "S_FAKEMOBILE_INIT", "S_FAKEMOBILE", "S_FAKEMOBILE_ATK1", @@ -5493,7 +5494,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_BOSSSEBH2", // Boss 3 Shockwave - "S_SHOCKWAVE1", "S_SHOCKWAVE2", @@ -5530,9 +5530,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_JETFLAME", // Boss 4 Spectator Eggrobo - "S_EGGROBO1_IDLE", + "S_EGGROBO1_STND", "S_EGGROBO1_BSLAP1", - "S_EGGROBO2_BSLAP2", + "S_EGGROBO1_BSLAP2", "S_EGGROBO1_PISSED", // Boss 4 Spectator Eggrobo jet flame @@ -5776,7 +5776,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_CYBRAKDEMON_NAPALM_ATTACK1", "S_CYBRAKDEMON_NAPALM_ATTACK2", "S_CYBRAKDEMON_NAPALM_ATTACK3", - "S_CYBRAKDEMON_FINISH_ATTACK", // If just attacked, remove MF2_FRET w/out going back to spawnstate + "S_CYBRAKDEMON_FINISH_ATTACK1", // If just attacked, remove MF2_FRET w/out going back to spawnstate "S_CYBRAKDEMON_FINISH_ATTACK2", // Force a delay between attacks so you don't get bombarded with them back-to-back "S_CYBRAKDEMON_PAIN1", "S_CYBRAKDEMON_PAIN2", @@ -6470,7 +6470,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_LITTLETUMBLEWEED_ROLL7", "S_LITTLETUMBLEWEED_ROLL8", - // Cacti Sprites + // Cacti "S_CACTI1", "S_CACTI2", "S_CACTI3", @@ -6485,7 +6485,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_CACTITINYSEG", "S_CACTISMALLSEG", - // Warning signs sprites + // Warning signs "S_ARIDSIGN_CAUTION", "S_ARIDSIGN_CACTI", "S_ARIDSIGN_SHARPTURN", @@ -6502,6 +6502,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_TNTBARREL_EXPL4", "S_TNTBARREL_EXPL5", "S_TNTBARREL_EXPL6", + "S_TNTBARREL_EXPL7", "S_TNTBARREL_FLYING", // TNT proximity shell @@ -7047,7 +7048,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ZAPSB10", "S_ZAPSB11", // blank frame - // Thunder spark + //Thunder spark "S_THUNDERCOIN_SPARK", // Invincibility Sparkles @@ -7348,6 +7349,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_BHORIZ7", "S_BHORIZ8", + // Booster "S_BOOSTERSOUND", "S_YELLOWBOOSTERROLLER", "S_YELLOWBOOSTERSEG_LEFT", @@ -7378,7 +7380,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPLISH8", "S_SPLISH9", - // Lava splish + // Lava Splish "S_LAVASPLISH", // added water splash @@ -7974,6 +7976,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ROCKCRUMBLEN", "S_ROCKCRUMBLEO", "S_ROCKCRUMBLEP", + + // Level debris "S_GFZDEBRIS", "S_BRICKDEBRIS", "S_WOODDEBRIS", @@ -7993,7 +7997,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_THOK", // Thok! mobj "MT_PLAYER", "MT_TAILSOVERLAY", // c: - "MT_METALJETFUME", // [: + "MT_METALJETFUME", // Enemies "MT_BLUECRAWLA", // Crawla (Blue) @@ -8110,7 +8114,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_CYBRAKDEMON_NAPALM_FLAMES", "MT_CYBRAKDEMON_VILE_EXPLOSION", - // Metal Sonic + // Metal Sonic (Boss 9) "MT_METALSONIC_RACE", "MT_METALSONIC_BATTLE", "MT_MSSHIELD_FRONT", @@ -8124,7 +8128,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_BOMBSPHERE", "MT_REDTEAMRING", //Rings collectable by red team. "MT_BLUETEAMRING", //Rings collectable by blue team. - "MT_TOKEN", // Special Stage Token + "MT_TOKEN", // Special Stage token for special stage "MT_REDFLAG", // Red CTF Flag "MT_BLUEFLAG", // Blue CTF Flag "MT_EMBLEM", @@ -8350,22 +8354,22 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s // Arid Canyon Scenery "MT_BIGTUMBLEWEED", "MT_LITTLETUMBLEWEED", - "MT_CACTI1", - "MT_CACTI2", - "MT_CACTI3", - "MT_CACTI4", - "MT_CACTI5", - "MT_CACTI6", - "MT_CACTI7", - "MT_CACTI8", - "MT_CACTI9", - "MT_CACTI10", - "MT_CACTI11", - "MT_CACTITINYSEG", - "MT_CACTISMALLSEG", - "MT_ARIDSIGN_CAUTION", - "MT_ARIDSIGN_CACTI", - "MT_ARIDSIGN_SHARPTURN", + "MT_CACTI1", // Tiny Red Flower Cactus + "MT_CACTI2", // Small Red Flower Cactus + "MT_CACTI3", // Tiny Blue Flower Cactus + "MT_CACTI4", // Small Blue Flower Cactus + "MT_CACTI5", // Prickly Pear + "MT_CACTI6", // Barrel Cactus + "MT_CACTI7", // Tall Barrel Cactus + "MT_CACTI8", // Armed Cactus + "MT_CACTI9", // Ball Cactus + "MT_CACTI10", // Tiny Cactus + "MT_CACTI11", // Small Cactus + "MT_CACTITINYSEG", // Tiny Cactus Segment + "MT_CACTISMALLSEG", // Small Cactus Segment + "MT_ARIDSIGN_CAUTION", // Caution Sign + "MT_ARIDSIGN_CACTI", // Cacti Sign + "MT_ARIDSIGN_SHARPTURN", // Sharp Turn Sign "MT_OILLAMP", "MT_TNTBARREL", "MT_PROXIMITYTNT", @@ -8420,7 +8424,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_GLAREGOYLEUP", "MT_GLAREGOYLEDOWN", "MT_GLAREGOYLELONG", - "MT_TARGET", + "MT_TARGET", // AKA Red Crystal "MT_GREENFLAME", "MT_BLUEGARGOYLE", @@ -8471,7 +8475,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_HHZSTALAGMITE_TALL", "MT_HHZSTALAGMITE_SHORT", - // Botanic Serenity + // Botanic Serenity scenery "MT_BSZTALLFLOWER_RED", "MT_BSZTALLFLOWER_PURPLE", "MT_BSZTALLFLOWER_BLUE", @@ -8751,6 +8755,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_ROCKCRUMBLE14", "MT_ROCKCRUMBLE15", "MT_ROCKCRUMBLE16", + + // Level debris "MT_GFZDEBRIS", "MT_BRICKDEBRIS", "MT_WOODDEBRIS", From 4281de3b89e4ace77bff9dca003feb26d9e4dbc5 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 9 Feb 2020 21:29:46 -0500 Subject: [PATCH 52/68] Update file hashes --- src/config.h.in | 8 ++++---- src/d_main.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index 233cbdc53..d4a613fdc 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -26,12 +26,12 @@ #else /* Manually defined asset hashes for non-CMake builds - * Last updated 2019 / 12 / 06 - v2.2.0 - main assets + * Last updated 2020 / 02 / 09 - v2.2.1 - main assets * Last updated 20?? / ?? / ?? - v2.2.? - patch.pk3 */ -#define ASSET_HASH_SRB2_PK3 "51419a33b4982d840c6772c159ba7c0a" -#define ASSET_HASH_ZONES_PK3 "df74843919fd51af26a0baa8e21e4c19" -#define ASSET_HASH_PLAYER_DTA "56a247e074dd0dc794b6617efef1e918" +#define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28" +#define ASSET_HASH_ZONES_PK3 "89627822f5a5c7fb022d836b138144b2" +#define ASSET_HASH_PLAYER_DTA "129fa7d4b273a4b3dcacaa44eccead4f" #ifdef USE_PATCH_DTA #define ASSET_HASH_PATCH_PK3 "there is no patch.pk3, only zuul" #endif diff --git a/src/d_main.c b/src/d_main.c index dc9bfbfea..27f250017 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1213,7 +1213,7 @@ void D_SRB2Main(void) #endif D_CleanFile(); -#ifndef DEVELOP // md5s last updated 06/12/19 (ddmmyy) +#ifndef DEVELOP // md5s last updated 09/02/20 (ddmmyy) // Check MD5s of autoloaded files W_VerifyFileMD5(0, ASSET_HASH_SRB2_PK3); // srb2.pk3 From a63e9fe00247de03fe466cf510cdfc54d62d7de6 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Mon, 10 Feb 2020 00:06:16 -0600 Subject: [PATCH 53/68] Improvements to polyobjects carrying things: - Fixed loss of precision in rotate carry causing objects to slide off - Adjusted player carrying logic to make platforms less slippery - Finally obsoleted the player-specific rotate hack now that I found the actual problem :] --- src/p_polyobj.c | 52 ++++++++++++++++++++++++++++++------------------- src/p_user.c | 4 +++- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/p_polyobj.c b/src/p_polyobj.c index cd0a44bb4..a206d0171 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1001,15 +1001,35 @@ static void Polyobj_pushThing(polyobj_t *po, line_t *line, mobj_t *mo) // static void Polyobj_slideThing(mobj_t *mo, fixed_t dx, fixed_t dy) { - if (mo->player) { // Do something similar to conveyor movement. -Red - mo->player->cmomx += dx; - mo->player->cmomy += dy; + if (mo->player) { // Finally this doesn't suck eggs -fickle + fixed_t cdx, cdy; - dx = FixedMul(dx, CARRYFACTOR); - dy = FixedMul(dy, CARRYFACTOR); + cdx = FixedMul(dx, FRACUNIT-CARRYFACTOR); + cdy = FixedMul(dy, FRACUNIT-CARRYFACTOR); - mo->player->cmomx -= dx; - mo->player->cmomy -= dy; + if (mo->player->onconveyor == 1) + { + mo->momx += cdx; + mo->momy += cdy; + + // Multiple slides in the same tic, somehow + mo->player->cmomx += cdx; + mo->player->cmomy += cdy; + } + else + { + if (mo->player->onconveyor == 3) + { + mo->momx += cdx - mo->player->cmomx; + mo->momy += cdy - mo->player->cmomy; + } + + mo->player->cmomx = cdx; + mo->player->cmomy = cdy; + } + + dx = FixedMul(dx, FRACUNIT - mo->friction); + dy = FixedMul(dy, FRACUNIT - mo->friction); if (mo->player->pflags & PF_SPINNING && (mo->player->rmomx || mo->player->rmomy) && !(mo->player->pflags & PF_STARTDASH)) { #define SPINMULT 5184 // Consider this a substitute for properly calculating FRACUNIT-friction. I'm tired. -Red @@ -1282,7 +1302,8 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, { static INT32 pomovecount = 10000; INT32 x, y; - angle_t deltafine = delta >> ANGLETOFINESHIFT; + angle_t deltafine = (((po->angle + delta) >> ANGLETOFINESHIFT) - (po->angle >> ANGLETOFINESHIFT)) & FINEMASK; + // This fineshift trickery replaces the old delta>>ANGLETOFINESHIFT; doing it this way avoids loss of precision causing objects to slide off -fickle pomovecount++; @@ -1334,19 +1355,10 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta, oldxoff = mo->x-origin.x; oldyoff = mo->y-origin.y; - if (mo->player) // Hack to fix players sliding off of spinning polys -Red - { - fixed_t temp; + newxoff = FixedMul(oldxoff, c)-FixedMul(oldyoff, s) - oldxoff; + newyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s) - oldyoff; - temp = FixedMul(oldxoff, c)-FixedMul(oldyoff, s); - oldyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s); - oldxoff = temp; - } - - newxoff = FixedMul(oldxoff, c)-FixedMul(oldyoff, s); - newyoff = FixedMul(oldyoff, c)+FixedMul(oldxoff, s); - - Polyobj_slideThing(mo, newxoff-oldxoff, newyoff-oldyoff); + Polyobj_slideThing(mo, newxoff, newyoff); if (turnthings == 2 || (turnthings == 1 && !mo->player)) { mo->angle += delta; diff --git a/src/p_user.c b/src/p_user.c index 176b07d0a..a63022986 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12174,7 +12174,9 @@ void P_PlayerThink(player_t *player) #ifdef POLYOBJECTS if (player->onconveyor == 1) - player->cmomy = player->cmomx = 0; + player->onconveyor = 3; + else if (player->onconveyor == 3) + player->cmomy = player->cmomx = 0; #endif P_DoSuperStuff(player); From c417ffae4c61e5fa4a389b2d1f0c4183a699a6f2 Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 11 Feb 2020 15:53:25 +0800 Subject: [PATCH 54/68] Add proper support for animated signpost --- src/info.c | 2 +- src/p_enemy.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/info.c b/src/info.c index 758f137c2..a634bd8d3 100644 --- a/src/info.c +++ b/src/info.c @@ -762,7 +762,7 @@ state_t states[NUMSTATES] = {SPR_PLAY, SPR2_LIFE, 20, {NULL}, 0, 4, S_NULL}, // S_PLAY_ICON3 // Level end sign (uses player sprite) - {SPR_PLAY, SPR2_SIGN|FF_PAPERSPRITE, -1, {NULL}, 0, 29, S_PLAY_SIGN}, // S_PLAY_SIGN + {SPR_PLAY, SPR2_SIGN|FF_PAPERSPRITE, 2, {NULL}, 0, 29, S_PLAY_SIGN}, // S_PLAY_SIGN // NiGHTS Player, transforming {SPR_PLAY, SPR2_TRNS|FF_ANIMATE, 7, {NULL}, 0, 4, S_PLAY_NIGHTS_TRANS2}, // S_PLAY_NIGHTS_TRANS1 diff --git a/src/p_enemy.c b/src/p_enemy.c index db297e684..8ff490a05 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5198,8 +5198,8 @@ void A_SignPlayer(mobj_t *actor) player_t *player = actor->target ? actor->target->player : NULL; UINT8 skinnum; UINT8 skincount = 0; - for (skincount = 0; skincount < numskins; skincount++) - if (!skincheck(skincount)) + for (skinnum = 0; skinnum < numskins; skinnum++) + if (!skincheck(skinnum)) skincount++; skinnum = P_RandomKey(skincount); for (skincount = 0; skincount < numskins; skincount++) @@ -5232,20 +5232,23 @@ void A_SignPlayer(mobj_t *actor) { ov->color = facecolor; ov->skin = skin; - P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN + if (ov->state-states != actor->info->seestate) + P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN } else // CLEAR! sign { ov->color = SKINCOLOR_NONE; ov->skin = NULL; // needs to be NULL in the case of SF_HIRES characters - P_SetMobjState(ov, actor->info->missilestate); // S_CLEARSIGN + if (ov->state-states != actor->info->missilestate) + P_SetMobjState(ov, actor->info->missilestate); // S_CLEARSIGN } } else // Eggman face { ov->color = SKINCOLOR_NONE; ov->skin = NULL; - P_SetMobjState(ov, actor->info->meleestate); // S_EGGMANSIGN + if (ov->state-states != actor->info->meleestate) + P_SetMobjState(ov, actor->info->meleestate); // S_EGGMANSIGN if (!signcolor) signcolor = SKINCOLOR_CARBON; } From 248a80cac48be372effa0e92170a70007dcdbdd4 Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 11 Feb 2020 20:36:48 +0800 Subject: [PATCH 55/68] Cast to statenum_t for 32-bit compatibility --- src/p_enemy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 8ff490a05..2ddbd8d29 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5232,14 +5232,14 @@ void A_SignPlayer(mobj_t *actor) { ov->color = facecolor; ov->skin = skin; - if (ov->state-states != actor->info->seestate) + if ((statenum_t)(ov->state-states) != actor->info->seestate) P_SetMobjState(ov, actor->info->seestate); // S_PLAY_SIGN } else // CLEAR! sign { ov->color = SKINCOLOR_NONE; ov->skin = NULL; // needs to be NULL in the case of SF_HIRES characters - if (ov->state-states != actor->info->missilestate) + if ((statenum_t)(ov->state-states) != actor->info->missilestate) P_SetMobjState(ov, actor->info->missilestate); // S_CLEARSIGN } } @@ -5247,7 +5247,7 @@ void A_SignPlayer(mobj_t *actor) { ov->color = SKINCOLOR_NONE; ov->skin = NULL; - if (ov->state-states != actor->info->meleestate) + if ((statenum_t)(ov->state-states) != actor->info->meleestate) P_SetMobjState(ov, actor->info->meleestate); // S_EGGMANSIGN if (!signcolor) signcolor = SKINCOLOR_CARBON; From aeab33ee030cd6de9a4e86298a22fcf98b6b19d7 Mon Sep 17 00:00:00 2001 From: lachwright Date: Wed, 12 Feb 2020 01:41:11 +0800 Subject: [PATCH 56/68] Defuse minecarts --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 758f137c2..dc7b7659a 100644 --- a/src/info.c +++ b/src/info.c @@ -2395,7 +2395,7 @@ state_t states[NUMSTATES] = // Minecart {SPR_NULL, 0, 1, {NULL}, 0, 0, S_MINECART_IDLE}, // S_MINECART_IDLE - {SPR_NULL, 0, 0, {A_KillSegments}, 0, 0, S_TNTBARREL_EXPL3}, // S_MINECART_DTH1 + {SPR_NULL, 0, 0, {A_KillSegments}, 0, 0, S_TNTBARREL_EXPL4}, // S_MINECART_DTH1 {SPR_MCRT, 8|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_MINECARTEND {SPR_MCRT, 0|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_MINECARTSEG_FRONT {SPR_MCRT, 1|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_MINECARTSEG_BACK From 9f7bfd901b591bd180d6b77b5241dd789303670c Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Tue, 11 Feb 2020 19:07:48 -0600 Subject: [PATCH 57/68] I broke SHIFT in the Connect IP Textbox.. whoops. It's okay, I literally had to remove one line lmao. --- src/m_menu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 049b66d67..01db26148 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -10585,7 +10585,6 @@ static void M_HandleConnectIP(INT32 choice) default: // otherwise do nothing. break; } - break; // don't check for typed keys } if (l >= 28-1) From ae2041d68633e3d089c29b6f146669d3f97b738a Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 11 Feb 2020 19:36:09 -0800 Subject: [PATCH 58/68] Remove extra tokens if we got all 7 emeroods --- src/g_game.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index efc96a50f..aaab89163 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3739,7 +3739,10 @@ static void G_DoCompleted(void) } if (i == 7) + { gottoken = false; + token = 0; + } } if (spec && !gottoken) From b7a6773ff5c7e22b5c4a0a7a86dfa6e0c6e84598 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 11 Feb 2020 23:24:43 -0600 Subject: [PATCH 59/68] Don't error when checking patch.valid on invalid patches --- src/lua_hudlib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index f451944e3..b58a82299 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -270,8 +270,13 @@ static int patch_get(lua_State *L) // patches are CURRENTLY always valid, expected to be cached with PU_STATIC // this may change in the future, so patch.valid still exists - if (!patch) + if (!patch) { + if (field == patch_valid) { + lua_pushboolean(L, 0); + return 1; + } return LUA_ErrInvalid(L, "patch_t"); + } switch (field) { From d3e5cbffbad67766b0b559f631b68da22d80d44d Mon Sep 17 00:00:00 2001 From: colette Date: Wed, 12 Feb 2020 08:54:20 -0500 Subject: [PATCH 60/68] comment --- src/lua_hudlib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index b58a82299..6e3c1181d 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -268,8 +268,7 @@ static int patch_get(lua_State *L) #endif enum patch field = luaL_checkoption(L, 2, NULL, patch_opt); - // patches are CURRENTLY always valid, expected to be cached with PU_STATIC - // this may change in the future, so patch.valid still exists + // patches are invalidated when switching renderers if (!patch) { if (field == patch_valid) { lua_pushboolean(L, 0); From 841094976b8a84ed56942cea96515cb9b19245e5 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 12 Feb 2020 18:02:36 -0800 Subject: [PATCH 61/68] Add flag name variant of SF_NONIGHTSROTATION to S_SKIN --- src/r_things.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/r_things.c b/src/r_things.c index 7f0f43281..ca285644f 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -3463,6 +3463,7 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value) GETFLAG(DASHMODE) GETFLAG(FASTEDGE) GETFLAG(MULTIABILITY) + GETFLAG(NONIGHTSROTATION) #undef GETFLAG else // let's check if it's a sound, otherwise error out From e7a0fc65bde8a0429d1ca12508f6f0142cb0c10c Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 15 Feb 2020 12:44:03 +0100 Subject: [PATCH 62/68] Update hashes (again) --- src/config.h.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index d4a613fdc..6c909890b 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -30,8 +30,8 @@ * Last updated 20?? / ?? / ?? - v2.2.? - patch.pk3 */ #define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28" -#define ASSET_HASH_ZONES_PK3 "89627822f5a5c7fb022d836b138144b2" -#define ASSET_HASH_PLAYER_DTA "129fa7d4b273a4b3dcacaa44eccead4f" +#define ASSET_HASH_ZONES_PK3 "04fcff3b888ebb4970139166e75c08e9" +#define ASSET_HASH_PLAYER_DTA "ad49e07b17cc662f1ad70c454910b4ae" #ifdef USE_PATCH_DTA #define ASSET_HASH_PATCH_PK3 "there is no patch.pk3, only zuul" #endif From 7b13f0a2dea61dc38b90d8718f843c14b1020d79 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Sat, 15 Feb 2020 23:47:11 +0100 Subject: [PATCH 63/68] Fix dedicated servers not running gamelogic Note to future testers: Remember to test dedicated servers before merging. And splitscreen also. --- src/d_clisrv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index c4b5f6677..77118110e 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -404,8 +404,8 @@ static void ExtraDataTicker(void) } // If you are a client, you can safely forget the net commands for this tic - // If you are the server, you need to remember them until every client has been aknowledged, - // because if you need to resend a PT_SERVERTICS packet, you need to put the commands in it + // If you are the server, you need to remember them until every client has been acknowledged, + // because if you need to resend a PT_SERVERTICS packet, you will need to put the commands in it if (client) D_FreeTextcmd(gametic); } @@ -4510,7 +4510,7 @@ static void CL_SendClientCmd(void) packetsize = sizeof (clientcmd_pak) - sizeof (ticcmd_t) - sizeof (INT16); HSendPacket(servernode, false, 0, packetsize); } - else if (gamestate != GS_NULL && addedtogame) + else if (gamestate != GS_NULL && (addedtogame || dedicated)) { G_MoveTiccmd(&netbuffer->u.clientpak.cmd, &localcmds, 1); netbuffer->u.clientpak.consistancy = SHORT(consistancy[gametic%BACKUPTICS]); From 3a82864ce9de523af5cc62daef20957343b1f5f4 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 16 Feb 2020 11:34:02 -0500 Subject: [PATCH 64/68] Update comment --- src/config.h.in | 2 +- src/d_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index 6c909890b..3b501c97a 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -26,7 +26,7 @@ #else /* Manually defined asset hashes for non-CMake builds - * Last updated 2020 / 02 / 09 - v2.2.1 - main assets + * Last updated 2020 / 02 / 15 - v2.2.1 - main assets * Last updated 20?? / ?? / ?? - v2.2.? - patch.pk3 */ #define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28" diff --git a/src/d_main.c b/src/d_main.c index 27f250017..ccf2d1428 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1213,7 +1213,7 @@ void D_SRB2Main(void) #endif D_CleanFile(); -#ifndef DEVELOP // md5s last updated 09/02/20 (ddmmyy) +#ifndef DEVELOP // md5s last updated 15/02/20 (ddmmyy) // Check MD5s of autoloaded files W_VerifyFileMD5(0, ASSET_HASH_SRB2_PK3); // srb2.pk3 From cb97aafd054a1f888a89db53232c135feb282205 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 16 Feb 2020 18:45:49 -0500 Subject: [PATCH 65/68] Fix object shadow not appearing for mid-joiners --- src/p_saveg.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/p_saveg.c b/src/p_saveg.c index 853856880..7d755edc6 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1255,6 +1255,7 @@ typedef enum #endif MD2_COLORIZED = 1<<12, MD2_ROLLANGLE = 1<<13, + MD2_SHADOWSCALE = 1<<14, } mobj_diff2_t; typedef enum @@ -1476,6 +1477,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 |= MD2_COLORIZED; if (mobj->rollangle) diff2 |= MD2_ROLLANGLE; + if (mobj->shadowscale) + diff2 |= MD2_SHADOWSCALE; if (diff2 != 0) diff |= MD_MORE; @@ -1642,6 +1645,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, mobj->colorized); if (diff2 & MD2_ROLLANGLE) WRITEANGLE(save_p, mobj->rollangle); + if (diff2 & MD2_SHADOWSCALE) + WRITEFIXED(save_p, mobj->shadowscale); WRITEUINT32(save_p, mobj->mobjnum); } @@ -2721,6 +2726,8 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->colorized = READUINT8(save_p); if (diff2 & MD2_ROLLANGLE) mobj->rollangle = READANGLE(save_p); + if (diff2 & MD2_SHADOWSCALE) + mobj->shadowscale = READFIXED(save_p); if (diff & MD_REDFLAG) { From b44358df637ebaf6e35528a7106d3e1d299a0a20 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 16 Feb 2020 18:54:19 -0500 Subject: [PATCH 66/68] Update file hash yet again --- src/config.h.in | 2 +- src/d_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index 3b501c97a..498f3086d 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -30,7 +30,7 @@ * Last updated 20?? / ?? / ?? - v2.2.? - patch.pk3 */ #define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28" -#define ASSET_HASH_ZONES_PK3 "04fcff3b888ebb4970139166e75c08e9" +#define ASSET_HASH_ZONES_PK3 "f7e88afb6af7996a834c7d663144bead" #define ASSET_HASH_PLAYER_DTA "ad49e07b17cc662f1ad70c454910b4ae" #ifdef USE_PATCH_DTA #define ASSET_HASH_PATCH_PK3 "there is no patch.pk3, only zuul" diff --git a/src/d_main.c b/src/d_main.c index ccf2d1428..149fb3071 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1213,7 +1213,7 @@ void D_SRB2Main(void) #endif D_CleanFile(); -#ifndef DEVELOP // md5s last updated 15/02/20 (ddmmyy) +#ifndef DEVELOP // md5s last updated 16/02/20 (ddmmyy) // Check MD5s of autoloaded files W_VerifyFileMD5(0, ASSET_HASH_SRB2_PK3); // srb2.pk3 From 773ed0a0563ae31f5650f73e1e1bd1a3ab5e768a Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 16 Feb 2020 20:10:30 -0500 Subject: [PATCH 67/68] Update credit at Rob's request --- 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 d6ffed26f..66f963bbb 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1261,7 +1261,7 @@ static const char *credits[] = { "Cody \"SRB2 Playah\" Koester", "Skye \"OmegaVelocity\" Meredith", "Stephen \"HEDGESMFG\" Moellering", - "Nick \"ST218\" Molina", + "Rosalie \"ST218\" Molina", "Samuel \"Prime 2.0\" Peters", "Colin \"Sonict\" Pfaff", "Bill \"Tets\" Reed", From 705cf9fd4078ce34857d98043023612e9205773c Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 16 Feb 2020 17:14:54 -0800 Subject: [PATCH 68/68] Revert "Let the console open in menus" This reverts commit ef3d462eb7d6de12fb950894e3fa6aaece75ef1c. --- src/console.c | 11 ++++++++++- src/d_main.c | 15 ++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/console.c b/src/console.c index 8746bf036..59d2b3e6c 100644 --- a/src/console.c +++ b/src/console.c @@ -613,6 +613,15 @@ void CON_Ticker(void) con_tick++; con_tick &= 7; + // if the menu is open then close the console. + if (menuactive && con_destlines) + { + consoletoggle = false; + con_destlines = 0; + CON_ClearHUD(); + I_UpdateMouseGrab(); + } + // console key was pushed if (consoletoggle) { @@ -784,7 +793,7 @@ boolean CON_Responder(event_t *ev) // check other keys only if console prompt is active if (!consoleready && key < NUMINPUTS) // metzgermeister: boundary check!! { - if (! menuactive && bindtable[key]) + if (bindtable[key]) { COM_BufAddText(bindtable[key]); COM_BufAddText("\n"); diff --git a/src/d_main.c b/src/d_main.c index 32972c151..71ea946b6 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -188,14 +188,14 @@ void D_ProcessEvents(void) continue; } - // console input - if (CON_Responder(ev)) - continue; // ate the event - // Menu input if (M_Responder(ev)) continue; // menu ate the event + // console input + if (CON_Responder(ev)) + continue; // ate the event + G_Responder(ev); } } @@ -502,12 +502,13 @@ static void D_Display(void) // vid size change is now finished if it was on... vid.recalc = 0; - M_Drawer(); // menu is drawn even on top of everything - // focus lost moved to M_Drawer - + // FIXME: draw either console or menu, not the two if (gamestate != GS_TIMEATTACK) CON_Drawer(); + M_Drawer(); // menu is drawn even on top of everything + // focus lost moved to M_Drawer + // // wipe update //