From bf8a39f7eedcf8011e3f19015d22bdde9b3e7589 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 11 Jan 2020 15:40:18 -0800 Subject: [PATCH 001/139] 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 002/139] 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 003/139] 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 004/139] 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 c25e9696760afa898f24acab9ff43378e4156499 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 14 Jan 2020 23:29:56 -0600 Subject: [PATCH 005/139] wip viewroll stuff --- src/d_main.c | 6 ++ src/d_player.h | 2 + src/lua_playerlib.c | 4 ++ src/p_user.c | 2 + src/r_main.c | 141 +++++++++++++++++++++++++++++++++++++++++++- src/r_main.h | 3 + 6 files changed, 157 insertions(+), 1 deletion(-) diff --git a/src/d_main.c b/src/d_main.c index 8a7c446bb..763814a5a 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -266,6 +266,9 @@ static void D_Display(void) #endif } + if (rendermode == render_soft && !splitscreen) + R_CheckViewMorph(); + // change the view size if needed if (setsizeneeded || setrenderstillneeded) { @@ -446,6 +449,9 @@ static void D_Display(void) // Image postprocessing effect if (rendermode == render_soft) { + if (!splitscreen) + R_ApplyViewMorph(); + if (postimgtype) V_DoPostProcessor(0, postimgtype, postimgparam); if (postimgtype2) diff --git a/src/d_player.h b/src/d_player.h index 62f38193f..6a1750113 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -324,6 +324,8 @@ typedef struct player_s // bounded/scaled total momentum. fixed_t bob; + angle_t viewrollangle; + // Mouse aiming, where the guy is looking at! // It is updated with cmd->aiming. angle_t aiming; diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index c501fbbb2..8b9397663 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -120,6 +120,8 @@ static int player_get(lua_State *L) lua_pushfixed(L, plr->deltaviewheight); else if (fastcmp(field,"bob")) lua_pushfixed(L, plr->bob); + else if (fastcmp(field,"viewrollangle")) + lua_pushangle(L, plr->viewrollangle); else if (fastcmp(field,"aiming")) lua_pushangle(L, plr->aiming); else if (fastcmp(field,"drawangle")) @@ -415,6 +417,8 @@ static int player_set(lua_State *L) plr->deltaviewheight = luaL_checkfixed(L, 3); else if (fastcmp(field,"bob")) plr->bob = luaL_checkfixed(L, 3); + else if (fastcmp(field,"viewrollangle")) + plr->viewrollangle = luaL_checkangle(L, 3); else if (fastcmp(field,"aiming")) { plr->aiming = luaL_checkangle(L, 3); if (plr == &players[consoleplayer]) diff --git a/src/p_user.c b/src/p_user.c index 0c4d25554..5d7383c4b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7432,6 +7432,8 @@ static void P_NiGHTSMovement(player_t *player) else // AngleFixed(R_PointToAngle2()) results in slight inaccuracy! Don't use it unless movement is on both axises. newangle = (INT16)FixedInt(AngleFixed(R_PointToAngle2(0,0, cmd->sidemove*FRACUNIT, cmd->forwardmove*FRACUNIT))); + newangle -= player->viewrollangle / ANG1; + if (newangle < 0 && moved) newangle = (INT16)(360+newangle); } diff --git a/src/r_main.c b/src/r_main.c index 3c6aaf6a6..fbb3c7047 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -551,6 +551,145 @@ static inline void R_InitLightTables(void) } } +static struct { + angle_t rollangle; // pre-shifted by fineshift + fixed_t fisheye; + + fixed_t zoomneeded; + INT32 *scrmap; + size_t scrmapsize; + boolean use; +} viewmorph = {0, 0, FRACUNIT, NULL, 0, false}; + +void R_CheckViewMorph(void) +{ + float zoomfactor, rollcos, rollsin; + float x1, y1, x2, y2; + fixed_t temp; + size_t end, vx, vy, pos, usedpos; + INT32 usedx, usedy, halfwidth = vid.width/2, halfheight = vid.height/2; + + angle_t rollangle = players[displayplayer].viewrollangle; + //fixed_t fisheye = players[displayplayer].viewfisheye; + + // temp values + //angle_t rollangle = leveltime << (ANGLETOFINESHIFT); + fixed_t fisheye = 0; + + rollangle >>= ANGLETOFINESHIFT; + rollangle = (((rollangle+1)/2)*2) & FINEMASK; // Limit the distinct number of angles to reduce recalcs from angles changing a lot. + + fisheye &= ~0xFF; // Same limiter logic for fisheye + + if (rollangle == viewmorph.rollangle && fisheye == viewmorph.fisheye) + return; // No change + + viewmorph.rollangle = rollangle; + viewmorph.fisheye = fisheye; + + if (viewmorph.rollangle == 0 && viewmorph.fisheye == 0) + { + viewmorph.use = false; + if (viewmorph.zoomneeded != FRACUNIT) + R_SetViewSize(); + viewmorph.zoomneeded = FRACUNIT; + + return; + } + + if (viewmorph.scrmapsize != vid.width*vid.height) + { + if (viewmorph.scrmap) + free(viewmorph.scrmap); + viewmorph.scrmap = malloc(vid.width*vid.height * sizeof(INT32)); + viewmorph.scrmapsize = vid.width*vid.height; + } + + temp = FINECOSINE(rollangle); + rollcos = FIXED_TO_FLOAT(temp); + temp = FINESINE(rollangle); + rollsin = FIXED_TO_FLOAT(temp); + + // Calculate maximum zoom needed + x1 = (vid.width*fabsf(rollcos) + vid.height*fabsf(rollsin)) / vid.width; + y1 = (vid.height*fabsf(rollcos) + vid.width*fabsf(rollsin)) / vid.height; + + temp = max(x1, y1)*FRACUNIT; + if (temp < FRACUNIT) + temp = FRACUNIT; + else + temp |= 0xFFF; // Limit how many times the viewport needs to be recalculated + + //CONS_Printf("Setting zoom to %f\n", FIXED_TO_FLOAT(temp)); + + if (temp != viewmorph.zoomneeded) + { + viewmorph.zoomneeded = temp; + R_SetViewSize(); + } + + zoomfactor = FIXED_TO_FLOAT(viewmorph.zoomneeded); + + end = vid.width * vid.height - 1; + + pos = 0; + + // Pre-multiply rollcos and rollsin to use for positional stuff + rollcos /= zoomfactor; + rollsin /= zoomfactor; + + x1 = -(halfwidth * rollcos - halfheight * rollsin); + y1 = -(halfheight * rollcos + halfwidth * rollsin); + + //CONS_Printf("Top left corner is %f %f\n", x1, y1); + + for (vy = 0; vy < halfheight; vy++) + { + x2 = x1; + y2 = y1; + x1 -= rollsin; + y1 += rollcos; + + for (vx = 0; vx < vid.width; vx++) + { + usedx = halfwidth+x2; + usedy = halfheight+y2; + + if (usedx < 0) usedx = 0; + else if (usedx >= vid.width) usedx = vid.width-1; + if (usedy < 0) usedy = 0; + else if (usedy >= vid.height) usedy = vid.height-1; + + usedpos = usedx + usedy*vid.width; + + viewmorph.scrmap[pos] = usedpos; + viewmorph.scrmap[end-pos] = end-usedpos; + + x2 += rollcos; + y2 += rollsin; + pos++; + } + } + + viewmorph.use = true; +} + +void R_ApplyViewMorph(void) +{ + UINT8 *tmpscr = screens[4]; + UINT8 *srcscr = screens[0]; + INT32 p, end = vid.width * vid.height; + + if (!viewmorph.use) + return; + + for (p = 0; p < end; p++) + tmpscr[p] = srcscr[viewmorph.scrmap[p]]; + + VID_BlitLinearScreen(tmpscr, screens[0], + vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.width); +} + // // R_SetViewSize @@ -599,7 +738,7 @@ void R_ExecuteSetViewSize(void) centeryfrac = centery<> ANGLETOFINESHIFT); + fovtan = FixedMul(FINETANGENT(fov >> ANGLETOFINESHIFT), viewmorph.zoomneeded); if (splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view fovtan = 17*fovtan/10; diff --git a/src/r_main.h b/src/r_main.h index 998bb50ef..92876ce25 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -95,6 +95,9 @@ void R_InitHardwareMode(void); #endif void R_ReloadHUDGraphics(void); +void R_CheckViewMorph(void); +void R_ApplyViewMorph(void); + // just sets setsizeneeded true extern boolean setsizeneeded; void R_SetViewSize(void); From cd957d84f7332fc71ebd1924aaa2b533684cc07d Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 14 Jan 2020 23:30:19 -0600 Subject: [PATCH 006/139] LMAO fisheye --- src/r_main.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index fbb3c7047..6efc7d99b 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -564,7 +564,7 @@ static struct { void R_CheckViewMorph(void) { float zoomfactor, rollcos, rollsin; - float x1, y1, x2, y2; + float x1, y1, x2, y2, fisheyef; fixed_t temp; size_t end, vx, vy, pos, usedpos; INT32 usedx, usedy, halfwidth = vid.width/2, halfheight = vid.height/2; @@ -574,14 +574,14 @@ void R_CheckViewMorph(void) // temp values //angle_t rollangle = leveltime << (ANGLETOFINESHIFT); - fixed_t fisheye = 0; + fixed_t fisheye = FRACUNIT; rollangle >>= ANGLETOFINESHIFT; rollangle = (((rollangle+1)/2)*2) & FINEMASK; // Limit the distinct number of angles to reduce recalcs from angles changing a lot. fisheye &= ~0xFF; // Same limiter logic for fisheye - if (rollangle == viewmorph.rollangle && fisheye == viewmorph.fisheye) + if (rollangle == viewmorph.rollangle && fisheye == viewmorph.fisheye && viewmorph.scrmapsize == vid.width*vid.height) return; // No change viewmorph.rollangle = rollangle; @@ -614,6 +614,13 @@ void R_CheckViewMorph(void) x1 = (vid.width*fabsf(rollcos) + vid.height*fabsf(rollsin)) / vid.width; y1 = (vid.height*fabsf(rollcos) + vid.width*fabsf(rollsin)) / vid.height; + if (fisheye) + { + float dist = powf(2, (fisheyef = FIXED_TO_FLOAT(fisheye))/2); + x1 *= dist; + y1 *= dist; + } + temp = max(x1, y1)*FRACUNIT; if (temp < FRACUNIT) temp = FRACUNIT; @@ -652,8 +659,20 @@ void R_CheckViewMorph(void) for (vx = 0; vx < vid.width; vx++) { - usedx = halfwidth+x2; - usedy = halfheight+y2; + if (fisheye) + { + float dist = sqrtf(x2*x2 + y2*y2) * zoomfactor / sqrtf(halfwidth*halfwidth + halfheight*halfheight); + dist += (1 - sqrtf(1 - dist*dist)) / dist; + dist = powf(dist, fisheyef); + usedx = halfwidth+x2*dist; + usedy = halfheight+y2*dist; + + } + else + { + usedx = halfwidth+x2; + usedy = halfheight+y2; + } if (usedx < 0) usedx = 0; else if (usedx >= vid.width) usedx = vid.width-1; From cdbea0be26067a5774778ba51a18df7aa661ce80 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 14 Jan 2020 23:30:39 -0600 Subject: [PATCH 007/139] Revert "LMAO fisheye" This reverts commit cd957d84f7332fc71ebd1924aaa2b533684cc07d. --- src/r_main.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 6efc7d99b..fbb3c7047 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -564,7 +564,7 @@ static struct { void R_CheckViewMorph(void) { float zoomfactor, rollcos, rollsin; - float x1, y1, x2, y2, fisheyef; + float x1, y1, x2, y2; fixed_t temp; size_t end, vx, vy, pos, usedpos; INT32 usedx, usedy, halfwidth = vid.width/2, halfheight = vid.height/2; @@ -574,14 +574,14 @@ void R_CheckViewMorph(void) // temp values //angle_t rollangle = leveltime << (ANGLETOFINESHIFT); - fixed_t fisheye = FRACUNIT; + fixed_t fisheye = 0; rollangle >>= ANGLETOFINESHIFT; rollangle = (((rollangle+1)/2)*2) & FINEMASK; // Limit the distinct number of angles to reduce recalcs from angles changing a lot. fisheye &= ~0xFF; // Same limiter logic for fisheye - if (rollangle == viewmorph.rollangle && fisheye == viewmorph.fisheye && viewmorph.scrmapsize == vid.width*vid.height) + if (rollangle == viewmorph.rollangle && fisheye == viewmorph.fisheye) return; // No change viewmorph.rollangle = rollangle; @@ -614,13 +614,6 @@ void R_CheckViewMorph(void) x1 = (vid.width*fabsf(rollcos) + vid.height*fabsf(rollsin)) / vid.width; y1 = (vid.height*fabsf(rollcos) + vid.width*fabsf(rollsin)) / vid.height; - if (fisheye) - { - float dist = powf(2, (fisheyef = FIXED_TO_FLOAT(fisheye))/2); - x1 *= dist; - y1 *= dist; - } - temp = max(x1, y1)*FRACUNIT; if (temp < FRACUNIT) temp = FRACUNIT; @@ -659,20 +652,8 @@ void R_CheckViewMorph(void) for (vx = 0; vx < vid.width; vx++) { - if (fisheye) - { - float dist = sqrtf(x2*x2 + y2*y2) * zoomfactor / sqrtf(halfwidth*halfwidth + halfheight*halfheight); - dist += (1 - sqrtf(1 - dist*dist)) / dist; - dist = powf(dist, fisheyef); - usedx = halfwidth+x2*dist; - usedy = halfheight+y2*dist; - - } - else - { - usedx = halfwidth+x2; - usedy = halfheight+y2; - } + usedx = halfwidth+x2; + usedy = halfheight+y2; if (usedx < 0) usedx = 0; else if (usedx >= vid.width) usedx = vid.width-1; From e23f632cdbc687039ec25297ae0105142135e1a1 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 14 Jan 2020 23:44:21 -0600 Subject: [PATCH 008/139] Clean up fisheye and fix crashes --- src/r_main.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index fbb3c7047..628ba078f 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -553,13 +553,12 @@ static inline void R_InitLightTables(void) static struct { angle_t rollangle; // pre-shifted by fineshift - fixed_t fisheye; fixed_t zoomneeded; INT32 *scrmap; size_t scrmapsize; boolean use; -} viewmorph = {0, 0, FRACUNIT, NULL, 0, false}; +} viewmorph = {0, FRACUNIT, NULL, 0, false}; void R_CheckViewMorph(void) { @@ -570,24 +569,16 @@ void R_CheckViewMorph(void) INT32 usedx, usedy, halfwidth = vid.width/2, halfheight = vid.height/2; angle_t rollangle = players[displayplayer].viewrollangle; - //fixed_t fisheye = players[displayplayer].viewfisheye; - - // temp values - //angle_t rollangle = leveltime << (ANGLETOFINESHIFT); - fixed_t fisheye = 0; rollangle >>= ANGLETOFINESHIFT; rollangle = (((rollangle+1)/2)*2) & FINEMASK; // Limit the distinct number of angles to reduce recalcs from angles changing a lot. - fisheye &= ~0xFF; // Same limiter logic for fisheye - - if (rollangle == viewmorph.rollangle && fisheye == viewmorph.fisheye) + if (rollangle == viewmorph.rollangle && viewmorph.scrmapsize == vid.width*vid.height) return; // No change viewmorph.rollangle = rollangle; - viewmorph.fisheye = fisheye; - if (viewmorph.rollangle == 0 && viewmorph.fisheye == 0) + if (viewmorph.rollangle == 0) { viewmorph.use = false; if (viewmorph.zoomneeded != FRACUNIT) @@ -655,11 +646,6 @@ void R_CheckViewMorph(void) usedx = halfwidth+x2; usedy = halfheight+y2; - if (usedx < 0) usedx = 0; - else if (usedx >= vid.width) usedx = vid.width-1; - if (usedy < 0) usedy = 0; - else if (usedy >= vid.height) usedy = vid.height-1; - usedpos = usedx + usedy*vid.width; viewmorph.scrmap[pos] = usedpos; From 28c466a0a5fe36172026b0376c7cc6868e7dbdd0 Mon Sep 17 00:00:00 2001 From: lachwright Date: Thu, 16 Jan 2020 22:56:01 +0800 Subject: [PATCH 009/139] 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 7cf563eadd0c2a4e1977c7024ef40975159e5aff Mon Sep 17 00:00:00 2001 From: fickleheart Date: Fri, 17 Jan 2020 18:32:13 -0600 Subject: [PATCH 010/139] Un/archive viewrollangle in netsaves --- src/p_saveg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_saveg.c b/src/p_saveg.c index 2b6a474bf..e0b6d9579 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -116,6 +116,7 @@ static void P_NetArchivePlayers(void) WRITEANGLE(save_p, players[i].aiming); WRITEANGLE(save_p, players[i].drawangle); + WRITEANGLE(save_p, players[i].viewrollangle); WRITEANGLE(save_p, players[i].awayviewaiming); WRITEINT32(save_p, players[i].awayviewtics); WRITEINT16(save_p, players[i].rings); @@ -325,6 +326,7 @@ static void P_NetUnArchivePlayers(void) players[i].aiming = READANGLE(save_p); players[i].drawangle = READANGLE(save_p); + players[i].viewrollangle = READANGLE(save_p); players[i].awayviewaiming = READANGLE(save_p); players[i].awayviewtics = READINT32(save_p); players[i].rings = READINT16(save_p); From 84329fcd2677a42860f986e06b901434bc44966e Mon Sep 17 00:00:00 2001 From: fickleheart Date: Fri, 17 Jan 2020 19:01:45 -0600 Subject: [PATCH 011/139] OGL can have little a viewroll --- src/hardware/hw_main.c | 6 ++++++ src/hardware/r_opengl/r_opengl.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 74be53db5..e1b5d23ff 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5969,6 +5969,8 @@ static void HWR_DrawSkyBackground(player_t *player) dometransform.scalez = 1; dometransform.fovxangle = fpov; // Tails dometransform.fovyangle = fpov; // Tails + dometransform.roll = (player->viewrollangle != 0); + dometransform.rollangle = FIXED_TO_FLOAT(AngleFixed(player->viewrollangle)); dometransform.splitscreen = splitscreen; HWR_GetTexture(texturetranslation[skytexture]); @@ -6192,6 +6194,8 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) atransform.scalez = 1; atransform.fovxangle = fpov; // Tails atransform.fovyangle = fpov; // Tails + atransform.roll = (player->viewrollangle != 0); + atransform.rollangle = FIXED_TO_FLOAT(AngleFixed(player->viewrollangle)); atransform.splitscreen = splitscreen; gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); @@ -6412,6 +6416,8 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) atransform.scalez = 1; atransform.fovxangle = fpov; // Tails atransform.fovyangle = fpov; // Tails + atransform.roll = (player->viewrollangle != 0); + atransform.rollangle = FIXED_TO_FLOAT(AngleFixed(player->viewrollangle)); atransform.splitscreen = splitscreen; gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index becce9fa3..a3ed3c8d2 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2238,6 +2238,8 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) else pglScalef(stransform->scalex, stransform->scaley, -stransform->scalez); + if (stransform->roll) + pglRotatef(stransform->rollangle, 0.0f, 0.0f, 1.0f); pglRotatef(stransform->anglex , 1.0f, 0.0f, 0.0f); pglRotatef(stransform->angley+270.0f, 0.0f, 1.0f, 0.0f); pglTranslatef(-stransform->x, -stransform->z, -stransform->y); From 2b7d75126e8e8641a4b413c74b3c65da87e0d309 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Fri, 17 Jan 2020 20:39:15 -0600 Subject: [PATCH 012/139] Add DBG_VIEWMORPH to view pre-transformed view --- src/doomdef.h | 1 + src/r_main.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 3d02871e4..565d1aadf 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -490,6 +490,7 @@ extern INT32 cv_debug; #define DBG_SETUP 0x0400 #define DBG_LUA 0x0800 #define DBG_RANDOMIZER 0x1000 +#define DBG_VIEWMORPH 0x2000 // ======================= // Misc stuff for later... diff --git a/src/r_main.c b/src/r_main.c index d4d05ad44..91e1b3fe7 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -667,8 +667,34 @@ void R_ApplyViewMorph(void) if (!viewmorph.use) return; - for (p = 0; p < end; p++) - tmpscr[p] = srcscr[viewmorph.scrmap[p]]; + if (cv_debug & DBG_VIEWMORPH) + { + UINT8 border = 32; + UINT8 grid = 160; + INT32 ws = vid.width / 4; + INT32 hs = vid.width * (vid.height / 4); + + memcpy(tmpscr, srcscr, vid.width*vid.height); + for (p = 0; p < vid.width; p++) + { + tmpscr[viewmorph.scrmap[p]] = border; + tmpscr[viewmorph.scrmap[p + hs]] = grid; + tmpscr[viewmorph.scrmap[p + hs*2]] = grid; + tmpscr[viewmorph.scrmap[p + hs*3]] = grid; + tmpscr[viewmorph.scrmap[end - 1 - p]] = border; + } + for (p = vid.width; p < end; p += vid.width) + { + tmpscr[viewmorph.scrmap[p]] = border; + tmpscr[viewmorph.scrmap[p + ws]] = grid; + tmpscr[viewmorph.scrmap[p + ws*2]] = grid; + tmpscr[viewmorph.scrmap[p + ws*3]] = grid; + tmpscr[viewmorph.scrmap[end - 1 - p]] = border; + } + } + else + for (p = 0; p < end; p++) + tmpscr[p] = srcscr[viewmorph.scrmap[p]]; VID_BlitLinearScreen(tmpscr, screens[0], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.width); From 64c4a4c02c6a59264446e9a43593e7397b774baa Mon Sep 17 00:00:00 2001 From: fickleheart Date: Fri, 17 Jan 2020 20:39:38 -0600 Subject: [PATCH 013/139] Fisheye lens experiments --- src/r_main.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 3 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 91e1b3fe7..689f18f2b 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -549,14 +549,29 @@ static inline void R_InitLightTables(void) } } +//#define WOUGHMP_WOUGHMP // I got a fish-eye lens - I'll make a rap video with a couple of friends +// it's kinda laggy sometimes + static struct { angle_t rollangle; // pre-shifted by fineshift +#ifdef WOUGHMP_WOUGHMP + fixed_t fisheye; +#endif fixed_t zoomneeded; INT32 *scrmap; size_t scrmapsize; boolean use; -} viewmorph = {0, FRACUNIT, NULL, 0, false}; +} viewmorph = { + 0, +#ifdef WOUGHMP_WOUGHMP + 0, +#endif + FRACUNIT, + NULL, + 0, + false +}; void R_CheckViewMorph(void) { @@ -565,18 +580,39 @@ void R_CheckViewMorph(void) fixed_t temp; size_t end, vx, vy, pos, usedpos; INT32 usedx, usedy, halfwidth = vid.width/2, halfheight = vid.height/2; +#ifdef WOUGHMP_WOUGHMP + float fisheyemap[MAXVIDWIDTH/2 + 1]; +#endif angle_t rollangle = players[displayplayer].viewrollangle; +#ifdef WOUGHMP_WOUGHMP + fixed_t fisheye = cv_cam2_turnmultiplier.value; // temporary test value +#endif rollangle >>= ANGLETOFINESHIFT; rollangle = (((rollangle+1)/2)*2) & FINEMASK; // Limit the distinct number of angles to reduce recalcs from angles changing a lot. - if (rollangle == viewmorph.rollangle && viewmorph.scrmapsize == vid.width*vid.height) +#ifdef WOUGHMP_WOUGHMP + fisheye &= ~0x7FF; // Same +#endif + + if (rollangle == viewmorph.rollangle && +#ifdef WOUGHMP_WOUGHMP + fisheye == viewmorph.fisheye && +#endif + viewmorph.scrmapsize == vid.width*vid.height) return; // No change viewmorph.rollangle = rollangle; +#ifdef WOUGHMP_WOUGHMP + viewmorph.fisheye = fisheye; +#endif - if (viewmorph.rollangle == 0) + if (viewmorph.rollangle == 0 +#ifdef WOUGHMP_WOUGHMP + && viewmorph.fisheye == 0 +#endif + ) { viewmorph.use = false; if (viewmorph.zoomneeded != FRACUNIT) @@ -603,6 +639,22 @@ void R_CheckViewMorph(void) x1 = (vid.width*fabsf(rollcos) + vid.height*fabsf(rollsin)) / vid.width; y1 = (vid.height*fabsf(rollcos) + vid.width*fabsf(rollsin)) / vid.height; +#ifdef WOUGHMP_WOUGHMP + if (fisheye) + { + float f = FIXED_TO_FLOAT(fisheye); + for (vx = 0; vx <= halfwidth; vx++) + fisheyemap[vx] = 1.0f / cos(atan(vx * f / halfwidth)); + + f = cos(atan(f)); + if (f < 1.0f) + { + x1 /= f; + y1 /= f; + } + } +#endif + temp = max(x1, y1)*FRACUNIT; if (temp < FRACUNIT) temp = FRACUNIT; @@ -632,6 +684,34 @@ void R_CheckViewMorph(void) //CONS_Printf("Top left corner is %f %f\n", x1, y1); +#ifdef WOUGHMP_WOUGHMP + if (fisheye) + { + for (vy = 0; vy < halfheight; vy++) + { + x2 = x1; + y2 = y1; + x1 -= rollsin; + y1 += rollcos; + + for (vx = 0; vx < vid.width; vx++) + { + usedx = halfwidth + x2*fisheyemap[(int) floorf(fabsf(y2*zoomfactor))]; + usedy = halfheight + y2*fisheyemap[(int) floorf(fabsf(x2*zoomfactor))]; + + usedpos = usedx + usedy*vid.width; + + viewmorph.scrmap[pos] = usedpos; + viewmorph.scrmap[end-pos] = end-usedpos; + + x2 += rollcos; + y2 += rollsin; + pos++; + } + } + } + else +#endif for (vy = 0; vy < halfheight; vy++) { x2 = x1; From 7bd9344dd01cf541d86d3e7965e7037fb85ca494 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Fri, 17 Jan 2020 21:55:16 -0600 Subject: [PATCH 014/139] I think this fixes the compile errors --- src/hardware/hw_main.c | 24 ++++++++++++++++++------ src/r_main.c | 4 ++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index e1b5d23ff..cf78c0cc0 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5969,8 +5969,12 @@ static void HWR_DrawSkyBackground(player_t *player) dometransform.scalez = 1; dometransform.fovxangle = fpov; // Tails dometransform.fovyangle = fpov; // Tails - dometransform.roll = (player->viewrollangle != 0); - dometransform.rollangle = FIXED_TO_FLOAT(AngleFixed(player->viewrollangle)); + if (player->viewrollangle != 0) + { + fixed_t rol = AngleFixed(player->viewrollangle); + dometransform.rollangle = FIXED_TO_FLOAT(rol); + dometransform.roll = true; + } dometransform.splitscreen = splitscreen; HWR_GetTexture(texturetranslation[skytexture]); @@ -6194,8 +6198,12 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player) atransform.scalez = 1; atransform.fovxangle = fpov; // Tails atransform.fovyangle = fpov; // Tails - atransform.roll = (player->viewrollangle != 0); - atransform.rollangle = FIXED_TO_FLOAT(AngleFixed(player->viewrollangle)); + if (player->viewrollangle != 0) + { + fixed_t rol = AngleFixed(player->viewrollangle); + atransform.rollangle = FIXED_TO_FLOAT(rol); + atransform.roll = true; + } atransform.splitscreen = splitscreen; gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); @@ -6416,8 +6424,12 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) atransform.scalez = 1; atransform.fovxangle = fpov; // Tails atransform.fovyangle = fpov; // Tails - atransform.roll = (player->viewrollangle != 0); - atransform.rollangle = FIXED_TO_FLOAT(AngleFixed(player->viewrollangle)); + if (player->viewrollangle != 0) + { + fixed_t rol = AngleFixed(player->viewrollangle); + atransform.rollangle = FIXED_TO_FLOAT(rol); + atransform.roll = true; + } atransform.splitscreen = splitscreen; gr_fovlud = (float)(1.0l/tan((double)(fpov*M_PIl/360l))); diff --git a/src/r_main.c b/src/r_main.c index 689f18f2b..27c444d88 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -560,7 +560,7 @@ static struct { fixed_t zoomneeded; INT32 *scrmap; - size_t scrmapsize; + INT32 scrmapsize; boolean use; } viewmorph = { 0, @@ -578,7 +578,7 @@ void R_CheckViewMorph(void) float zoomfactor, rollcos, rollsin; float x1, y1, x2, y2; fixed_t temp; - size_t end, vx, vy, pos, usedpos; + INT32 end, vx, vy, pos, usedpos; INT32 usedx, usedy, halfwidth = vid.width/2, halfheight = vid.height/2; #ifdef WOUGHMP_WOUGHMP float fisheyemap[MAXVIDWIDTH/2 + 1]; From 21ccefe4eb96e3b3f3216025f40d6271faaac206 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Fri, 17 Jan 2020 22:03:16 -0600 Subject: [PATCH 015/139] Fix sky texture scaling wrong with fov changes --- src/r_main.h | 1 + src/r_sky.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/r_main.h b/src/r_main.h index 2378661cc..0042015f2 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -26,6 +26,7 @@ extern INT32 centerx, centery; extern fixed_t centerxfrac, centeryfrac; extern fixed_t projection, projectiony; +extern fixed_t fovtan; // field of view extern size_t validcount, linecount, loopcount, framecount; diff --git a/src/r_sky.c b/src/r_sky.c index c9d28cebc..da36eb937 100644 --- a/src/r_sky.c +++ b/src/r_sky.c @@ -76,5 +76,5 @@ void R_SetupSkyDraw(void) void R_SetSkyScale(void) { fixed_t difference = vid.fdupx-(vid.dupx< Date: Fri, 17 Jan 2020 23:21:11 -0600 Subject: [PATCH 016/139] Avoid rendering unused left/right edges of screen while rolling --- src/r_main.c | 24 +++++++++++++++++++++++- src/r_things.c | 39 ++++++--------------------------------- 2 files changed, 29 insertions(+), 34 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 27c444d88..a49b0519f 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -561,6 +561,7 @@ static struct { fixed_t zoomneeded; INT32 *scrmap; INT32 scrmapsize; + INT32 x1; // clip rendering horizontally for efficiency boolean use; } viewmorph = { 0, @@ -570,6 +571,7 @@ static struct { FRACUNIT, NULL, 0, + 0, false }; @@ -615,6 +617,7 @@ void R_CheckViewMorph(void) ) { viewmorph.use = false; + viewmorph.x1 = 0; if (viewmorph.zoomneeded != FRACUNIT) R_SetViewSize(); viewmorph.zoomneeded = FRACUNIT; @@ -682,6 +685,14 @@ void R_CheckViewMorph(void) x1 = -(halfwidth * rollcos - halfheight * rollsin); y1 = -(halfheight * rollcos + halfwidth * rollsin); +#ifdef WOUGHMP_WOUGHMP + if (fisheye) + viewmorph.x1 = (INT32)(halfwidth - (halfwidth * fabsf(rollcos) + halfheight * fabsf(rollsin)) * fisheyemap[halfwidth]); + else +#endif + viewmorph.x1 = (INT32)(halfwidth - (halfwidth * fabsf(rollcos) + halfheight * fabsf(rollsin))); + //CONS_Printf("saving %d cols\n", viewmorph.x1); + //CONS_Printf("Top left corner is %f %f\n", x1, y1); #ifdef WOUGHMP_WOUGHMP @@ -1316,7 +1327,18 @@ void R_RenderPlayerView(player_t *player) validcount++; // Clear buffers. - R_ClearClipSegs(); + if (viewmorph.use) + { + portalclipstart = viewmorph.x1; + portalclipend = viewwidth-viewmorph.x1-1; + R_PortalClearClipSegs(portalclipstart, portalclipend); + } + else + { + portalclipstart = 0; + portalclipend = viewwidth-1; + R_ClearClipSegs(); + } R_ClearDrawSegs(); R_ClearPlanes(); R_ClearSprites(); diff --git a/src/r_things.c b/src/r_things.c index 8fa0f2d0e..bb98d7f15 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1307,17 +1307,8 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, shadow->mobj = thing; // Easy access! Tails 06-07-2002 - shadow->x1 = x1 < 0 ? 0 : x1; - shadow->x2 = x2 >= viewwidth ? viewwidth-1 : x2; - - // PORTAL SEMI-CLIPPING - if (portalrender) - { - if (shadow->x1 < portalclipstart) - shadow->x1 = portalclipstart; - if (shadow->x2 >= portalclipend) - shadow->x2 = portalclipend-1; - } + shadow->x1 = x1 < portalclipstart ? portalclipstart : x1; + shadow->x2 = x2 >= portalclipend ? portalclipend-1 : x2; shadow->xscale = FixedMul(xscale, shadowxscale); //SoM: 4/17/2000 shadow->scale = FixedMul(yscale, shadowyscale); @@ -1815,17 +1806,8 @@ static void R_ProjectSprite(mobj_t *thing) vis->mobj = thing; // Easy access! Tails 06-07-2002 - vis->x1 = x1 < 0 ? 0 : x1; - vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2; - - // PORTAL SEMI-CLIPPING - if (portalrender) - { - if (vis->x1 < portalclipstart) - vis->x1 = portalclipstart; - if (vis->x2 >= portalclipend) - vis->x2 = portalclipend-1; - } + vis->x1 = x1 < portalclipstart ? portalclipstart : x1; + vis->x2 = x2 >= portalclipend ? portalclipend-1 : x2; vis->xscale = xscale; //SoM: 4/17/2000 vis->sector = thing->subsector->sector; @@ -2034,17 +2016,8 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) vis->shear.tan = 0; vis->shear.offset = 0; - vis->x1 = x1 < 0 ? 0 : x1; - vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2; - - // PORTAL SEMI-CLIPPING - if (portalrender) - { - if (vis->x1 < portalclipstart) - vis->x1 = portalclipstart; - if (vis->x2 >= portalclipend) - vis->x2 = portalclipend-1; - } + vis->x1 = x1 < portalclipstart ? portalclipstart : x1; + vis->x2 = x2 >= portalclipend ? portalclipend-1 : x2; vis->xscale = xscale; //SoM: 4/17/2000 vis->sector = thing->subsector->sector; From 8868fc4d8abce1b6393303155e758921f7ef9e4f Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 18 Jan 2020 00:16:18 -0600 Subject: [PATCH 017/139] Fix lighting discrepancies between different FOVs --- src/r_draw8.c | 9 +++++---- src/r_draw8_npo2.c | 11 +++++++---- src/r_main.h | 2 ++ src/r_segs.c | 14 +++++++------- src/r_things.c | 4 ++-- 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/r_draw8.c b/src/r_draw8.c index 015dac2a7..2f6bdcfa4 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -644,6 +644,7 @@ void R_CalcTiltedLighting(fixed_t start, fixed_t end) } } +#define PLANELIGHTFLOAT (BASEVIDWIDTH * BASEVIDWIDTH / vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f * FIXED_TO_FLOAT(fovtan)) /** \brief The R_DrawTiltedSpan_8 function Draw slopes! Holy sheit! @@ -669,7 +670,7 @@ void R_DrawTiltedSpan_8(void) // Lighting is simple. It's just linear interpolation from start to end { - float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f; + float planelightfloat = PLANELIGHTFLOAT; float lightstart, lightend; lightend = (iz + ds_szp->x*width) * planelightfloat; @@ -805,7 +806,7 @@ void R_DrawTiltedTranslucentSpan_8(void) // Lighting is simple. It's just linear interpolation from start to end { - float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f; + float planelightfloat = PLANELIGHTFLOAT; float lightstart, lightend; lightend = (iz + ds_szp->x*width) * planelightfloat; @@ -942,7 +943,7 @@ void R_DrawTiltedTranslucentWaterSpan_8(void) // Lighting is simple. It's just linear interpolation from start to end { - float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f; + float planelightfloat = PLANELIGHTFLOAT; float lightstart, lightend; lightend = (iz + ds_szp->x*width) * planelightfloat; @@ -1078,7 +1079,7 @@ void R_DrawTiltedSplat_8(void) // Lighting is simple. It's just linear interpolation from start to end { - float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f; + float planelightfloat = PLANELIGHTFLOAT; float lightstart, lightend; lightend = (iz + ds_szp->x*width) * planelightfloat; diff --git a/src/r_draw8_npo2.c b/src/r_draw8_npo2.c index 748ca195c..aa38ee2d9 100644 --- a/src/r_draw8_npo2.c +++ b/src/r_draw8_npo2.c @@ -62,6 +62,9 @@ void R_DrawSpan_NPO2_8 (void) } #ifdef ESLOPE + +#define PLANELIGHTFLOAT (BASEVIDWIDTH * BASEVIDWIDTH / vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f * FIXED_TO_FLOAT(fovtan)) + /** \brief The R_DrawTiltedSpan_NPO2_8 function Draw slopes! Holy sheit! */ @@ -86,7 +89,7 @@ void R_DrawTiltedSpan_NPO2_8(void) // Lighting is simple. It's just linear interpolation from start to end { - float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f; + float planelightfloat = PLANELIGHTFLOAT; float lightstart, lightend; lightend = (iz + ds_szp->x*width) * planelightfloat; @@ -282,7 +285,7 @@ void R_DrawTiltedTranslucentSpan_NPO2_8(void) // Lighting is simple. It's just linear interpolation from start to end { - float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f; + float planelightfloat = PLANELIGHTFLOAT; float lightstart, lightend; lightend = (iz + ds_szp->x*width) * planelightfloat; @@ -476,7 +479,7 @@ void R_DrawTiltedSplat_NPO2_8(void) // Lighting is simple. It's just linear interpolation from start to end { - float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f; + float planelightfloat = PLANELIGHTFLOAT; float lightstart, lightend; lightend = (iz + ds_szp->x*width) * planelightfloat; @@ -869,7 +872,7 @@ void R_DrawTiltedTranslucentWaterSpan_NPO2_8(void) // Lighting is simple. It's just linear interpolation from start to end { - float planelightfloat = BASEVIDWIDTH*BASEVIDWIDTH/vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f; + float planelightfloat = PLANELIGHTFLOAT; float lightstart, lightend; lightend = (iz + ds_szp->x*width) * planelightfloat; diff --git a/src/r_main.h b/src/r_main.h index 0042015f2..678d3a0a7 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -46,6 +46,8 @@ extern size_t validcount, linecount, loopcount, framecount; #define MAXLIGHTZ 128 #define LIGHTZSHIFT 20 +#define LIGHTRESOLUTIONFIX (640*fovtan/vid.width) + extern lighttable_t *scalelight[LIGHTLEVELS][MAXLIGHTSCALE]; extern lighttable_t *scalelightfixed[MAXLIGHTSCALE]; extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ]; diff --git a/src/r_segs.c b/src/r_segs.c index dcb5fc160..fb4238448 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -199,7 +199,7 @@ static void R_DrawWallSplats(void) // draw the columns for (dc_x = x1; dc_x <= x2; dc_x++, spryscale += rw_scalestep) { - pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT; + pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT; if (pindex >= MAXLIGHTSCALE) pindex = MAXLIGHTSCALE - 1; dc_colormap = walllights[pindex]; @@ -599,7 +599,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) else xwalllights = scalelight[rlight->lightnum]; - pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT; + pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT; if (pindex >= MAXLIGHTSCALE) pindex = MAXLIGHTSCALE - 1; @@ -644,7 +644,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) } // calculate lighting - pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT; + pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT; if (pindex >= MAXLIGHTSCALE) pindex = MAXLIGHTSCALE - 1; @@ -1188,7 +1188,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) else xwalllights = scalelight[lightnum]; - pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT; + pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT; if (pindex >= MAXLIGHTSCALE) pindex = MAXLIGHTSCALE-1; @@ -1281,7 +1281,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) } // calculate lighting - pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT; + pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT; if (pindex >= MAXLIGHTSCALE) pindex = MAXLIGHTSCALE - 1; @@ -1486,7 +1486,7 @@ static void R_RenderSegLoop (void) if (segtextured) { // calculate lighting - pindex = FixedMul(rw_scale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT; + pindex = FixedMul(rw_scale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT; if (pindex >= MAXLIGHTSCALE) pindex = MAXLIGHTSCALE-1; @@ -1521,7 +1521,7 @@ static void R_RenderSegLoop (void) else xwalllights = scalelight[lightnum]; - pindex = FixedMul(rw_scale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT; + pindex = FixedMul(rw_scale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT; if (pindex >= MAXLIGHTSCALE) pindex = MAXLIGHTSCALE-1; diff --git a/src/r_things.c b/src/r_things.c index bb98d7f15..cb9d78464 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1097,7 +1097,7 @@ static void R_SplitSprite(vissprite_t *sprite) if (!((newsprite->cut & SC_FULLBRIGHT) && (!newsprite->extra_colormap || !(newsprite->extra_colormap->fog & 1)))) { - lindex = FixedMul(sprite->xscale, FixedDiv(640, vid.width))>>(LIGHTSCALESHIFT); + lindex = FixedMul(sprite->xscale, LIGHTRESOLUTIONFIX)>>(LIGHTSCALESHIFT); if (lindex >= MAXLIGHTSCALE) lindex = MAXLIGHTSCALE-1; @@ -1872,7 +1872,7 @@ static void R_ProjectSprite(mobj_t *thing) else { // diminished light - lindex = FixedMul(xscale, FixedDiv(640, vid.width))>>(LIGHTSCALESHIFT); + lindex = FixedMul(xscale, LIGHTRESOLUTIONFIX)>>(LIGHTSCALESHIFT); if (lindex >= MAXLIGHTSCALE) lindex = MAXLIGHTSCALE-1; From ffc274643cc90cfad28c1c64b5c6d80c535e723a Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 18 Jan 2020 00:23:47 -0800 Subject: [PATCH 018/139] Let "+" command line parameters specify more than one argument Previously each parameter after the first would be quoted into one argument to pass to the command buffer. --- src/m_argv.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/m_argv.c b/src/m_argv.c index 935f4b9e3..129706127 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -92,36 +92,21 @@ const char *M_GetNextParm(void) void M_PushSpecialParameters(void) { INT32 i; - char s[256]; - boolean onetime = false; - for (i = 1; i < myargc; i++) { if (myargv[i][0] == '+') { - strcpy(s, &myargv[i][1]); + COM_BufAddText(&myargv[i][1]); i++; // get the parameters of the command too for (; i < myargc && myargv[i][0] != '+' && myargv[i][0] != '-'; i++) { - strcat(s, " "); - if (!onetime) - { - strcat(s, "\""); - onetime = true; - } - strcat(s, myargv[i]); + COM_BufAddText(va(" \"%s\"", myargv[i])); } - if (onetime) - { - strcat(s, "\""); - onetime = false; - } - strcat(s, "\n"); // push it - COM_BufAddText(s); + COM_BufAddText("\n"); i--; } } From af4479924ad616ddf50daee4d1886a59f159607a Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 18 Jan 2020 10:53:00 -0600 Subject: [PATCH 019/139] Fully clip drawing to roll-used screen bounds --- src/r_main.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/src/r_main.c b/src/r_main.c index a49b0519f..7def18b40 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -561,17 +561,24 @@ static struct { fixed_t zoomneeded; INT32 *scrmap; INT32 scrmapsize; + INT32 x1; // clip rendering horizontally for efficiency + INT16 ceilingclip[MAXVIDWIDTH], floorclip[MAXVIDWIDTH]; + boolean use; } viewmorph = { 0, #ifdef WOUGHMP_WOUGHMP 0, #endif + FRACUNIT, NULL, 0, + 0, + {}, {}, + false }; @@ -693,6 +700,47 @@ void R_CheckViewMorph(void) viewmorph.x1 = (INT32)(halfwidth - (halfwidth * fabsf(rollcos) + halfheight * fabsf(rollsin))); //CONS_Printf("saving %d cols\n", viewmorph.x1); + // Set ceilingclip and floorclip + for (vx = 0; vx < vid.width; vx++) + { + viewmorph.ceilingclip[vx] = vid.height; + viewmorph.floorclip[vx] = -1; + } + x2 = x1; + y2 = y1; + for (vx = 0; vx < vid.width; vx++) + { + INT16 xa, ya, xb, yb; + xa = x2+halfwidth; + ya = y2+halfheight; + xb = vid.width-1-xa; + yb = vid.height-1-ya; + + viewmorph.ceilingclip[xa] = min(viewmorph.ceilingclip[xa], ya); + viewmorph.floorclip[xa] = max(viewmorph.floorclip[xa], ya); + viewmorph.ceilingclip[xb] = min(viewmorph.ceilingclip[xb], yb); + viewmorph.floorclip[xb] = max(viewmorph.floorclip[xb], yb); + x2 += rollcos; + y2 += rollsin; + } + x2 = x1; + y2 = y1; + for (vy = 0; vy < vid.height; vy++) + { + INT16 xa, ya, xb, yb; + xa = x2+halfwidth; + ya = y2+halfheight; + xb = vid.width-1-xa; + yb = vid.height-1-ya; + + viewmorph.ceilingclip[xa] = min(viewmorph.ceilingclip[xa], ya); + viewmorph.floorclip[xa] = max(viewmorph.floorclip[xa], ya); + viewmorph.ceilingclip[xb] = min(viewmorph.ceilingclip[xb], yb); + viewmorph.floorclip[xb] = max(viewmorph.floorclip[xb], yb); + x2 -= rollsin; + y2 += rollcos; + } + //CONS_Printf("Top left corner is %f %f\n", x1, y1); #ifdef WOUGHMP_WOUGHMP @@ -1327,11 +1375,14 @@ void R_RenderPlayerView(player_t *player) validcount++; // Clear buffers. + R_ClearPlanes(); if (viewmorph.use) { portalclipstart = viewmorph.x1; portalclipend = viewwidth-viewmorph.x1-1; R_PortalClearClipSegs(portalclipstart, portalclipend); + memcpy(ceilingclip, viewmorph.ceilingclip, sizeof(INT16)*vid.width); + memcpy(floorclip, viewmorph.floorclip, sizeof(INT16)*vid.width); } else { @@ -1340,7 +1391,6 @@ void R_RenderPlayerView(player_t *player) R_ClearClipSegs(); } R_ClearDrawSegs(); - R_ClearPlanes(); R_ClearSprites(); #ifdef FLOORSPLATS R_ClearVisibleFloorSplats(); From 8679606ebb56975a93b7140184b45170b82bc3fe Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 18 Jan 2020 10:53:23 -0600 Subject: [PATCH 020/139] Remove a couple adds from each pixel of morph mapping --- src/r_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 7def18b40..9259c6902 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -770,7 +770,11 @@ void R_CheckViewMorph(void) } } else + { #endif + x1 += halfwidth; + y1 += halfheight; + for (vy = 0; vy < halfheight; vy++) { x2 = x1; @@ -780,8 +784,8 @@ void R_CheckViewMorph(void) for (vx = 0; vx < vid.width; vx++) { - usedx = halfwidth+x2; - usedy = halfheight+y2; + usedx = x2; + usedy = y2; usedpos = usedx + usedy*vid.width; @@ -793,6 +797,9 @@ void R_CheckViewMorph(void) pos++; } } +#ifdef WOUGHMP_WOUGHMP + } +#endif viewmorph.use = true; } From 5757f24342f9dfdebe7bedc226f237bd0aea5cca Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 18 Jan 2020 10:53:45 -0600 Subject: [PATCH 021/139] Reduce the number of distinct roll angles --- src/r_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_main.c b/src/r_main.c index 9259c6902..1592c9ab2 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -599,7 +599,7 @@ void R_CheckViewMorph(void) #endif rollangle >>= ANGLETOFINESHIFT; - rollangle = (((rollangle+1)/2)*2) & FINEMASK; // Limit the distinct number of angles to reduce recalcs from angles changing a lot. + rollangle = ((rollangle+2) & ~3) & FINEMASK; // Limit the distinct number of angles to reduce recalcs from angles changing a lot. #ifdef WOUGHMP_WOUGHMP fisheye &= ~0x7FF; // Same From f6efe19fca206f972ebe567051648b3b11f900c2 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 18 Jan 2020 11:15:36 -0600 Subject: [PATCH 022/139] Use generally higher zooms and fix fuzzy edges --- src/r_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 1592c9ab2..548f37f57 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -669,7 +669,7 @@ void R_CheckViewMorph(void) if (temp < FRACUNIT) temp = FRACUNIT; else - temp |= 0xFFF; // Limit how many times the viewport needs to be recalculated + temp |= 0x3FFF; // Limit how many times the viewport needs to be recalculated //CONS_Printf("Setting zoom to %f\n", FIXED_TO_FLOAT(temp)); @@ -712,7 +712,7 @@ void R_CheckViewMorph(void) { INT16 xa, ya, xb, yb; xa = x2+halfwidth; - ya = y2+halfheight; + ya = y2+halfheight-1; xb = vid.width-1-xa; yb = vid.height-1-ya; From ec89015662e12dada02877feb9309b565a07b2a4 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 18 Jan 2020 11:19:59 -0600 Subject: [PATCH 023/139] Fix loss of aimingtody precision at high FOV --- src/r_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_main.c b/src/r_main.c index 548f37f57..e43e3a1c3 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1045,7 +1045,7 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y) 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) +#define AIMINGTODY(a) ((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)/fovtan) // recalc necessary stuff for mouseaiming // slopes are already calculated for the full possible view (which is 4*viewheight). From e9a8c2d21ae362ea08b1d26857eaba0201f16675 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Sun, 19 Jan 2020 14:30:05 -0300 Subject: [PATCH 024/139] No more losing lives when finished --- src/p_inter.c | 3 ++- src/st_stuff.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 71dcd70a1..5e1f7345c 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2527,7 +2527,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget else if (!target->player->bot && !target->player->spectator && (target->player->lives != INFLIVES) && G_GametypeUsesLives()) { - target->player->lives -= 1; // Lose a life Tails 03-11-2000 + if (!(target->player->pflags & PF_FINISHED)) + target->player->lives -= 1; // Lose a life Tails 03-11-2000 if (target->player->lives <= 0) // Tails 03-14-2000 { diff --git a/src/st_stuff.c b/src/st_stuff.c index 4676506fc..9c9c80164 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -944,7 +944,7 @@ static void ST_drawLivesArea(void) '\x16' | 0x80 | hudinfo[HUD_LIVES].f|V_PERPLAYER|V_HUDTRANS, false); else { - if (stplyr->playerstate == PST_DEAD && !(stplyr->spectator) && (livescount || stplyr->deadtimer < (TICRATE<<1))) + if (stplyr->playerstate == PST_DEAD && !(stplyr->spectator) && (livescount || stplyr->deadtimer < (TICRATE<<1)) && !(stplyr->pflags & PF_FINISHED)) livescount++; if (livescount > 99) livescount = 99; From 9e4c519cad14c7d913da97dc3c23788b32729f35 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Sun, 19 Jan 2020 19:02:03 -0300 Subject: [PATCH 025/139] In-map visual indicator --- src/d_netcmd.c | 12 +++++++++--- src/dehacked.c | 4 ++++ src/hardware/hw_light.c | 1 + src/info.c | 33 ++++++++++++++++++++++++++++++++- src/info.h | 5 +++++ src/p_local.h | 1 + src/p_mobj.c | 29 +++++++++++++++++++++++++++++ src/p_user.c | 27 +++++++++++++++++++++++++++ 8 files changed, 108 insertions(+), 4 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a597bad83..058c95196 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3736,9 +3736,15 @@ static void ExitMove_OnChange(void) if (cv_exitmove.value) { for (i = 0; i < MAXPLAYERS; ++i) - if (playeringame[i] && players[i].mo - && players[i].mo->target && players[i].mo->target->type == MT_SIGN) - P_SetTarget(&players[i].mo->target, NULL); + if (playeringame[i] && players[i].mo) + { + if (players[i].mo->target && players[i].mo->target->type == MT_SIGN) + P_SetTarget(&players[i].mo->target, NULL); + + if (players[i].pflags & PF_FINISHED) + P_GiveFinishFlags(&players[i]); + } + CONS_Printf(M_GetText("Players can now move after completing the level.\n")); } else diff --git a/src/dehacked.c b/src/dehacked.c index 082adda24..b85133b79 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7482,6 +7482,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Got Flag Sign "S_GOTFLAG", + + // Finish flag + "S_FINISHFLAG", "S_CORK", "S_LHRT", @@ -8601,6 +8604,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_LOCKONINF", // In-level Target "MT_TAG", // Tag Sign "MT_GOTFLAG", // Got Flag sign + "MT_FINISHFLAG", // Finish flag // Ambient Sounds "MT_AWATERA", // Ambient Water Sound 1 diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 8545a88b3..c5af8d6d3 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -509,6 +509,7 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_LCKN &lspr[NOLIGHT], // SPR_TTAG &lspr[NOLIGHT], // SPR_GFLG + &lspr[NOLIGHT], // SPR_FNSF &lspr[NOLIGHT], // SPR_CORK &lspr[NOLIGHT], // SPR_LHRT diff --git a/src/info.c b/src/info.c index de6ff475c..2947cd624 100644 --- a/src/info.c +++ b/src/info.c @@ -407,6 +407,7 @@ char sprnames[NUMSPRITES + 1][5] = "LCKN", // Target "TTAG", // Tag Sign "GFLG", // Got Flag sign + "FNSF", // Finish flag "CORK", "LHRT", @@ -3348,7 +3349,10 @@ state_t states[NUMSTATES] = {SPR_TTAG, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_TTAG // CTF Sign - {SPR_GFLG, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_GOTFLAG + {SPR_GFLG, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_GOTFLAG + + // Finish flag + {SPR_FNSF, FF_TRANS30, -1, {NULL}, 0, 0, S_NULL}, // S_FINISHFLAG {SPR_CORK, 0, -1, {NULL}, 0, 0, S_NULL}, // S_CORK {SPR_LHRT, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_LHRT @@ -17994,6 +17998,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags S_NULL // raisestate }, + + { // MT_FINISHFLAG + -1, // doomednum + S_FINISHFLAG, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 4*FRACUNIT, // speed + 8*FRACUNIT, // radius + 8*FRACUNIT, // height + 1, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags + S_NULL // raisestate + }, // ambient water 1a (large) { // MT_AWATERA diff --git a/src/info.h b/src/info.h index 628335635..b2754fd51 100644 --- a/src/info.h +++ b/src/info.h @@ -670,6 +670,7 @@ typedef enum sprite SPR_LCKN, // Target SPR_TTAG, // Tag Sign SPR_GFLG, // Got Flag sign + SPR_FNSF, // Finish flag SPR_CORK, SPR_LHRT, @@ -3484,6 +3485,9 @@ typedef enum state // Got Flag Sign S_GOTFLAG, + + // Finish flag + S_FINISHFLAG, S_CORK, S_LHRT, @@ -4625,6 +4629,7 @@ typedef enum mobj_type MT_LOCKONINF, // In-level Target MT_TAG, // Tag Sign MT_GOTFLAG, // Got Flag sign + MT_FINISHFLAG, // Finish flag // Ambient Sounds MT_AWATERA, // Ambient Water Sound 1 diff --git a/src/p_local.h b/src/p_local.h index a5f3d313c..888fba5ce 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -159,6 +159,7 @@ void P_GivePlayerLives(player_t *player, INT32 numlives); void P_GiveCoopLives(player_t *player, INT32 numlives, boolean sound); UINT8 P_GetNextEmerald(void); void P_GiveEmerald(boolean spawnObj); +void P_GiveFinishFlags(player_t *player); #if 0 void P_ResetScore(player_t *player); #else diff --git a/src/p_mobj.c b/src/p_mobj.c index a8599ceb5..f53f2a7d5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8006,6 +8006,32 @@ static void P_MobjSceneryThink(mobj_t *mobj) if (strength < 10) mobj->frame |= ((10 - strength) << (FF_TRANSSHIFT)); } + case MT_FINISHFLAG: + { + if (!mobj->target || mobj->target->player->playerstate == PST_DEAD || !cv_exitmove.value) + { + P_RemoveMobj(mobj); + return; + } + + if (!camera.chase) + mobj->flags2 |= MF2_DONTDRAW; + else + mobj->flags2 &= ~MF2_DONTDRAW; + + fixed_t radius = FixedMul(10*mobj->info->speed, mobj->target->scale); + mobj->angle += FixedAngle(mobj->info->speed); + angle_t fa = mobj->angle >> ANGLETOFINESHIFT; + + P_UnsetThingPosition(mobj); + + mobj->x = mobj->target->x + FixedMul(FINECOSINE(fa),radius); + mobj->y = mobj->target->y + FixedMul(FINESINE(fa),radius); + mobj->z = mobj->target->z + mobj->target->height/2; + + P_SetThingPosition(mobj); + P_SetScale(mobj, mobj->target->scale); + } /* FALLTHRU */ default: if (mobj->fuse) @@ -11512,6 +11538,9 @@ void P_AfterPlayerSpawn(INT32 playernum) if (CheckForReverseGravity) P_CheckGravity(mobj, false); + + if (p->pflags & PF_FINISHED) + P_GiveFinishFlags(p); } // spawn it at a playerspawn mapthing diff --git a/src/p_user.c b/src/p_user.c index a1df8a58b..38f7f2719 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -370,6 +370,32 @@ void P_GiveEmerald(boolean spawnObj) } } +// +// P_GiveFinishFlags +// +// Give the player visual indicators +// that they've finished the map. +// +void P_GiveFinishFlags(player_t *player) +{ + if (!player->mo) + return; + + angle_t angle = FixedAngle(player->mo->angle << FRACBITS); + + for (UINT8 i = 0; i < 3; i++) + { + angle_t fa = (angle >> ANGLETOFINESHIFT) & FINEMASK; + fixed_t xoffs = FINECOSINE(fa); + fixed_t yoffs = FINESINE(fa); + mobj_t* flag = P_SpawnMobjFromMobj(player->mo, xoffs, yoffs, 0, MT_FINISHFLAG); + flag->angle = angle; + angle += FixedAngle(120*FRACUNIT); + + P_SetTarget(&flag->target, player->mo); + } +} + #if 0 // // P_ResetScore @@ -2171,6 +2197,7 @@ void P_DoPlayerFinish(player_t *player) return; player->pflags |= PF_FINISHED; + P_GiveFinishFlags(player); if (netgame) CONS_Printf(M_GetText("%s has completed the level.\n"), player_names[player-players]); From db22d503a4e6931a4773146ca95d9f3e11f58504 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Sun, 19 Jan 2020 21:55:08 -0300 Subject: [PATCH 026/139] HUD visual indicator + property fix --- src/info.c | 2 +- src/st_stuff.c | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/info.c b/src/info.c index 2947cd624..1ca68eda6 100644 --- a/src/info.c +++ b/src/info.c @@ -18022,7 +18022,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 16, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags + MF_NOBLOCKMAP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags S_NULL // raisestate }, diff --git a/src/st_stuff.c b/src/st_stuff.c index 9c9c80164..d7e050b5b 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -128,6 +128,7 @@ static patch_t *minus5sec; static patch_t *minicaps; static patch_t *gotrflag; static patch_t *gotbflag; +static patch_t *fnshico; static boolean facefreed[MAXPLAYERS]; @@ -310,6 +311,7 @@ void ST_LoadGraphics(void) bmatcico = W_CachePatchName("BMATCICO", PU_HUDGFX); gotrflag = W_CachePatchName("GOTRFLAG", PU_HUDGFX); gotbflag = W_CachePatchName("GOTBFLAG", PU_HUDGFX); + fnshico = W_CachePatchName("FNSHICO", PU_HUDGFX); nonicon = W_CachePatchName("NONICON", PU_HUDGFX); nonicon2 = W_CachePatchName("NONICON2", PU_HUDGFX); @@ -1432,7 +1434,7 @@ static void ST_drawPowerupHUD(void) UINT16 invulntime = 0; INT32 offs = hudinfo[HUD_POWERUPS].x; const UINT8 q = ((splitscreen && stplyr == &players[secondarydisplayplayer]) ? 1 : 0); - static INT32 flagoffs[2] = {0, 0}, shieldoffs[2] = {0, 0}; + static INT32 flagoffs[2] = {0, 0}, shieldoffs[2] = {0, 0}, finishoffs[2] = {0, 0}; #define ICONSEP (16+4) // matches weapon rings HUD if (F_GetPromptHideHud(hudinfo[HUD_POWERUPS].y)) @@ -1440,6 +1442,26 @@ static void ST_drawPowerupHUD(void) if (stplyr->spectator || stplyr->playerstate != PST_LIVE) return; + +// --------- +// Finish icon +// --------- + + // Let's have a power-like icon to represent finishing the level! + if (stplyr->pflags & PF_FINISHED && cv_exitmove.value) + { + finishoffs[q] = ICONSEP; + V_DrawSmallScaledPatch(offs, hudinfo[HUD_POWERUPS].y, V_PERPLAYER|hudinfo[HUD_POWERUPS].f|V_HUDTRANS, fnshico); + } + else if (finishoffs[q]) + { + if (finishoffs[q] > 1) + finishoffs[q] = 2*finishoffs[q]/3; + else + finishoffs[q] = 0; + } + + offs -= finishoffs[q]; // ------- // Shields From 697dbd58e737a2c1e9aea896724e0954a58bf280 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Sun, 19 Jan 2020 21:56:53 -0300 Subject: [PATCH 027/139] Turn cv_exitmove on by default --- 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 058c95196..36db4008c 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -370,7 +370,7 @@ consvar_t cv_advancemap = {"advancemap", "Next", CV_NETVAR, advancemap_cons_t, N static CV_PossibleValue_t playersforexit_cons_t[] = {{0, "One"}, {1, "1/4"}, {2, "Half"}, {3, "3/4"}, {4, "All"}, {0, NULL}}; consvar_t cv_playersforexit = {"playersforexit", "All", CV_NETVAR, playersforexit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_exitmove = {"exitmove", "Off", CV_NETVAR|CV_CALL, CV_OnOff, ExitMove_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_exitmove = {"exitmove", "On", CV_NETVAR|CV_CALL, CV_OnOff, ExitMove_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_runscripts = {"runscripts", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; From fed000b724296fbd3c5b771c0e2a2a182e975d4f Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Sun, 19 Jan 2020 23:18:49 -0300 Subject: [PATCH 028/139] Remove Tails pick-up lock --- src/p_map.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index 40fee7b46..3f0ea61ee 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -591,9 +591,12 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails) if (!(tails->pflags & PF_CANCARRY)) return; - + +#if 0 + // To prevent finished players from being thrown into pits. Not that it matters much if (sonic->pflags & PF_FINISHED) return; +#endif if ((sonic->mo->eflags & MFE_VERTICALFLIP) != (tails->mo->eflags & MFE_VERTICALFLIP)) return; // Both should be in same gravity From 431206ebee42371edb72d0b45de25177d4938f47 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Mon, 20 Jan 2020 10:04:44 -0300 Subject: [PATCH 029/139] Die --- src/p_map.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 3f0ea61ee..1c2b4808b 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -591,12 +591,6 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails) if (!(tails->pflags & PF_CANCARRY)) return; - -#if 0 - // To prevent finished players from being thrown into pits. Not that it matters much - if (sonic->pflags & PF_FINISHED) - return; -#endif if ((sonic->mo->eflags & MFE_VERTICALFLIP) != (tails->mo->eflags & MFE_VERTICALFLIP)) return; // Both should be in same gravity From 5b08e1802dea504b52df6c5e21e311eaa06a3030 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 20 Jan 2020 23:14:26 -0800 Subject: [PATCH 030/139] Trim the trailing zeros off floats for cvars --- src/command.c | 14 +++++++++++--- src/m_menu.c | 3 ++- src/m_misc.c | 17 +++++++++++++++++ src/m_misc.h | 6 ++++++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/command.c b/src/command.c index b9ceba3cc..199115519 100644 --- a/src/command.c +++ b/src/command.c @@ -823,8 +823,13 @@ static void COM_Help_f(void) if (!stricmp(cvar->PossibleValue[MINVAL].strvalue, "MIN")) { if (floatmode) - CONS_Printf(" range from %f to %f\n", FIXED_TO_FLOAT(cvar->PossibleValue[MINVAL].value), - FIXED_TO_FLOAT(cvar->PossibleValue[MAXVAL].value)); + { + float fu = FIXED_TO_FLOAT(cvar->PossibleValue[MINVAL].value); + float ck = FIXED_TO_FLOAT(cvar->PossibleValue[MAXVAL].value); + CONS_Printf(" range from %ld%s to %ld%s\n", + (long)fu, M_Ftrim(fu), + (long)ck, M_Ftrim(ck)); + } else CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[MINVAL].value, cvar->PossibleValue[MAXVAL].value); @@ -973,7 +978,10 @@ static void COM_Add_f(void) } if (( cvar->flags & CV_FLOAT )) - CV_Set(cvar, va("%f", FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2)))); + { + float n =FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2)); + CV_Set(cvar, va("%ld%s", (long)n, M_Ftrim(n))); + } else CV_AddValue(cvar, atoi(COM_Argv(2))); } diff --git a/src/m_menu.c b/src/m_menu.c index 0d19a6a43..934495733 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2915,7 +2915,8 @@ static void M_ChangeCvar(INT32 choice) || !(currentMenu->menuitems[itemOn].status & IT_CV_INTEGERSTEP)) { char s[20]; - sprintf(s,"%f",FIXED_TO_FLOAT(cv->value)+(choice)*(1.0f/16.0f)); + float n = FIXED_TO_FLOAT(cv->value)+(choice)*(1.0f/16.0f); + sprintf(s,"%ld%s",(long)n,M_Ftrim(n)); CV_Set(cv,s); } else diff --git a/src/m_misc.c b/src/m_misc.c index 43d531110..ae8466ac8 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -2581,3 +2581,20 @@ int M_JumpWordReverse(const char *line, int offset) offset--; return offset; } + +const char * M_Ftrim (double f) +{ + static char dig[9];/* "0." + 6 digits (6 is printf's default) */ + int i; + /* I know I said it's the default, but just in case... */ + sprintf(dig, "%.6g", modf(f, &f)); + if (dig[0]) + { + for (i = strlen(dig); dig[i] == '0'; --i) + ; + dig[i + 1] = '\0'; + return &dig[1];/* skip the 0 */ + } + else + return ""; +} diff --git a/src/m_misc.h b/src/m_misc.h index 3fb9f031a..ad12517c1 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -109,6 +109,12 @@ int M_JumpWord (const char *s); /* E.g. cursor = M_JumpWordReverse(line, cursor); */ int M_JumpWordReverse (const char *line, int offset); +/* +Return dot and then the fractional part of a float, without +trailing zeros, or "" if the fractional part is zero. +*/ +const char * M_Ftrim (double); + // counting bits, for weapon ammo code, usually FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size); From aa05581de2959c2d61b9675c3ce47c900442a283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartu=20=C4=B0nce?= Date: Wed, 22 Jan 2020 18:53:17 +0100 Subject: [PATCH 031/139] Added support for 10+ emblem hints --- src/m_menu.c | 166 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 162 insertions(+), 4 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 62bea7ae0..0a39148ec 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -231,6 +231,8 @@ static void M_Credits(INT32 choice); static void M_SoundTest(INT32 choice); static void M_PandorasBox(INT32 choice); static void M_EmblemHints(INT32 choice); +static void M_EmblemHintsFull(INT32 choice); +static void M_HandleEmblemHints(INT32 choice); static void M_HandleChecklist(INT32 choice); menu_t SR_MainDef, SR_UnlockChecklistDef; @@ -342,6 +344,7 @@ static void M_DrawAddons(void); static void M_DrawChecklist(void); static void M_DrawSoundTest(void); static void M_DrawEmblemHints(void); +static void M_DrawEmblemHintsFull(void); static void M_DrawPauseMenu(void); static void M_DrawServerMenu(void); static void M_DrawLevelPlatterMenu(void); @@ -727,8 +730,14 @@ static menuitem_t SR_SoundTestMenu[] = static menuitem_t SR_EmblemHintMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Emblem Radar", &cv_itemfinder, 10}, - {IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SPauseDef, 20} + {IT_STRING | IT_CALL, NULL, "Check All Hints", M_EmblemHintsFull, 10}, + {IT_STRING|IT_CVAR, NULL, "Emblem Radar", &cv_itemfinder, 20}, + {IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SPauseDef, 30} +}; + +static menuitem_t SR_EmblemHintFullMenu[] = +{ + {IT_KEYHANDLER | IT_STRING, NULL, "", M_HandleEmblemHints, 0}, }; // -------------------------------- @@ -1738,6 +1747,19 @@ menu_t SR_EmblemHintDef = NULL }; +menu_t SR_EmblemHintFullDef = +{ + MN_SR_MAIN + (MN_SR_EMBLEMHINT << 6), + NULL, + sizeof (SR_EmblemHintFullMenu)/sizeof (menuitem_t), + &SR_EmblemHintDef, + SR_EmblemHintFullMenu, + M_DrawEmblemHintsFull, + 0, 150, + 0, + NULL +}; + // Single Player menu_t SP_MainDef = //CENTERMENUSTYLE(NULL, SP_MainMenu, &MainDef, 72); { @@ -7227,10 +7249,23 @@ finishchecklist: #define NUMHINTS 5 static void M_EmblemHints(INT32 choice) { + INT32 i; + UINT32 local = 0; + emblem_t *emblem; + for (i = 0; i < numemblems; i++) + { + emblem = &emblemlocations[i]; + if (emblem->level != gamemap || emblem->type > ET_SKIN) + continue; + if (++local > NUMHINTS*2) + break; + } + (void)choice; - SR_EmblemHintMenu[0].status = (M_SecretUnlocked(SECRET_ITEMFINDER)) ? (IT_CVAR|IT_STRING) : (IT_SECRET); + SR_EmblemHintMenu[0].status = (local > NUMHINTS*2) ? (IT_STRING | IT_CALL) : (IT_DISABLED); + SR_EmblemHintMenu[1].status = (M_SecretUnlocked(SECRET_ITEMFINDER)) ? (IT_CVAR|IT_STRING) : (IT_SECRET); M_SetupNextMenu(&SR_EmblemHintDef); - itemOn = 1; // always start on back. + itemOn = 2; // always start on back. } static void M_DrawEmblemHints(void) @@ -7301,6 +7336,129 @@ static void M_DrawEmblemHints(void) M_DrawGenericMenu(); } +UINT32 check_on_hint = 0; + +static void M_HandleEmblemHints(INT32 choice) +{ + INT32 i; + emblem_t *emblem; + UINT32 stageemblems = 0; + + for (i = 0; i < numemblems; i++) + { + emblem = &emblemlocations[i]; + if (emblem->level != gamemap || emblem->type > ET_SKIN) + continue; + + stageemblems++; + } + + + UINT32 j = check_on_hint; + switch (choice) + { + case KEY_DOWNARROW: + S_StartSound(NULL, sfx_menu1); + if ((check_on_hint != stageemblems)) + { + if (++j <= stageemblems - NUMHINTS) + check_on_hint = j; + } + return; + + case KEY_UPARROW: + S_StartSound(NULL, sfx_menu1); + if (check_on_hint) + { + if (--j != -1) + check_on_hint = j; + } + return; + + case KEY_ESCAPE: + if (currentMenu->prevMenu){ + check_on_hint = 0; + M_SetupNextMenu(currentMenu->prevMenu); + }else + M_ClearMenus(true); + return; + default: + break; + } + +} + +static void M_EmblemHintsFull(INT32 choice) +{ + (void)choice; + M_SetupNextMenu(&SR_EmblemHintFullDef); + itemOn = 0; +} + + +static void M_DrawEmblemHintsFull(void) +{ + INT32 i, x, y = currentMenu->y, drawnemblems = 0; + UINT32 collected = 0, local = 0; + emblem_t *emblem; + const char *hint; + + for (i = 0; i < numemblems; i++) + { + emblem = &emblemlocations[i]; + if (emblem->level != gamemap || emblem->type > ET_SKIN) + continue; + local++; + } + + if (!local) + V_DrawCenteredString(160, 48, V_YELLOWMAP, "No hidden emblems on this map."); + else{ + + if (check_on_hint > 0) + V_DrawString(310, y-(skullAnimCounter/5), V_YELLOWMAP, "\x1A"); + if(check_on_hint < local - NUMHINTS) + V_DrawString(310, y+8+(skullAnimCounter/5), V_YELLOWMAP, "\x1B"); + + x = 4; + y = 16; + + for (i = 0; i < numemblems; i++) + { + emblem = &emblemlocations[i]; + if (emblem->level != gamemap || emblem->type > ET_SKIN) + continue; + + drawnemblems++; + + if (drawnemblems > check_on_hint && drawnemblems <= (check_on_hint+NUMHINTS)){ + if (emblem->collected) + { + collected = V_GREENMAP; + V_DrawMappedPatch(x, y+4, 0, W_CachePatchName(M_GetEmblemPatch(emblem, false), PU_PATCH), + R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE)); + } + else + { + collected = 0; + V_DrawScaledPatch(x, y+4, 0, W_CachePatchName("NEEDIT", PU_PATCH)); + } + + if (emblem->hint[0]) + hint = emblem->hint; + else + hint = M_GetText("No hint available for this emblem."); + hint = V_WordWrap(40, BASEVIDWIDTH-12, 0, hint); + V_DrawString(x+28, y, V_RETURN8|V_ALLOWLOWERCASE|collected, hint); + + y += 32; + } + } + } + + //M_DrawGenericMenu(); +} + /*static void M_DrawSkyRoom(void) { INT32 i, y = 0; From 912734ffe6134c9acaa8a74759a9f61bb9b543f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartu=20=C4=B0nce?= Date: Wed, 22 Jan 2020 21:52:15 +0100 Subject: [PATCH 032/139] Extra emblems display, take 2. --- src/m_menu.c | 229 ++++++++++++++++----------------------------------- 1 file changed, 72 insertions(+), 157 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 0a39148ec..3e4d822f6 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -231,8 +231,8 @@ static void M_Credits(INT32 choice); static void M_SoundTest(INT32 choice); static void M_PandorasBox(INT32 choice); static void M_EmblemHints(INT32 choice); -static void M_EmblemHintsFull(INT32 choice); static void M_HandleEmblemHints(INT32 choice); +UINT32 hintpage = 1; static void M_HandleChecklist(INT32 choice); menu_t SR_MainDef, SR_UnlockChecklistDef; @@ -344,7 +344,6 @@ static void M_DrawAddons(void); static void M_DrawChecklist(void); static void M_DrawSoundTest(void); static void M_DrawEmblemHints(void); -static void M_DrawEmblemHintsFull(void); static void M_DrawPauseMenu(void); static void M_DrawServerMenu(void); static void M_DrawLevelPlatterMenu(void); @@ -730,16 +729,11 @@ static menuitem_t SR_SoundTestMenu[] = static menuitem_t SR_EmblemHintMenu[] = { - {IT_STRING | IT_CALL, NULL, "Check All Hints", M_EmblemHintsFull, 10}, + {IT_STRING | IT_ARROWS, NULL, "Page", M_HandleEmblemHints, 10}, {IT_STRING|IT_CVAR, NULL, "Emblem Radar", &cv_itemfinder, 20}, {IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SPauseDef, 30} }; -static menuitem_t SR_EmblemHintFullMenu[] = -{ - {IT_KEYHANDLER | IT_STRING, NULL, "", M_HandleEmblemHints, 0}, -}; - // -------------------------------- // 1 Player and all of its submenus // -------------------------------- @@ -1747,19 +1741,6 @@ menu_t SR_EmblemHintDef = NULL }; -menu_t SR_EmblemHintFullDef = -{ - MN_SR_MAIN + (MN_SR_EMBLEMHINT << 6), - NULL, - sizeof (SR_EmblemHintFullMenu)/sizeof (menuitem_t), - &SR_EmblemHintDef, - SR_EmblemHintFullMenu, - M_DrawEmblemHintsFull, - 0, 150, - 0, - NULL -}; - // Single Player menu_t SP_MainDef = //CENTERMENUSTYLE(NULL, SP_MainMenu, &MainDef, 72); { @@ -7247,6 +7228,7 @@ finishchecklist: } #define NUMHINTS 5 + static void M_EmblemHints(INT32 choice) { INT32 i; @@ -7262,16 +7244,17 @@ static void M_EmblemHints(INT32 choice) } (void)choice; - SR_EmblemHintMenu[0].status = (local > NUMHINTS*2) ? (IT_STRING | IT_CALL) : (IT_DISABLED); + SR_EmblemHintMenu[0].status = (local > NUMHINTS*2) ? (IT_STRING | IT_ARROWS) : (IT_DISABLED); SR_EmblemHintMenu[1].status = (M_SecretUnlocked(SECRET_ITEMFINDER)) ? (IT_CVAR|IT_STRING) : (IT_SECRET); + hintpage = 1; M_SetupNextMenu(&SR_EmblemHintDef); itemOn = 2; // always start on back. } static void M_DrawEmblemHints(void) { - INT32 i, j = 0, x, y, left_hints = NUMHINTS; - UINT32 collected = 0, local = 0; + INT32 i, j = 0, x, y, left_hints = NUMHINTS, pageflag = 0; + UINT32 collected = 0, totalemblems = 0, local = 0; emblem_t *emblem; const char *hint; @@ -7280,17 +7263,34 @@ static void M_DrawEmblemHints(void) emblem = &emblemlocations[i]; if (emblem->level != gamemap || emblem->type > ET_SKIN) continue; - if (++local >= NUMHINTS*2) - break; + + local++; } x = (local > NUMHINTS ? 4 : 12); y = 8; - // If there are more than 1 page's but less than 2 pages' worth of emblems, + if (local > NUMHINTS){ + if (local > ((hintpage-1)*NUMHINTS*2) && local < ((hintpage)*NUMHINTS*2)){ + if (NUMHINTS % 2 == 1) + left_hints = (local - ((hintpage-1)*NUMHINTS*2) + 1) / 2; + else + left_hints = (local - ((hintpage-1)*NUMHINTS*2)) / 2; + }else{ + left_hints = NUMHINTS; + } + } + + if (local > NUMHINTS*2){ + if (itemOn == 0){ + pageflag = V_YELLOWMAP; + } + V_DrawString(currentMenu->x + 40, currentMenu->y + 10, pageflag, va("%d",hintpage)); + } + + // If there are more than 1 page's but less than 2 pages' worth of emblems on the last possible page, // put half (rounded up) of the hints on the left, and half (rounded down) on the right - if (local > NUMHINTS && local < (NUMHINTS*2)-1) - left_hints = (local + 1) / 2; + if (!local) V_DrawCenteredString(160, 48, V_YELLOWMAP, "No hidden emblems on this map."); @@ -7300,43 +7300,51 @@ static void M_DrawEmblemHints(void) if (emblem->level != gamemap || emblem->type > ET_SKIN) continue; - if (emblem->collected) - { - collected = V_GREENMAP; - V_DrawMappedPatch(x, y+4, 0, W_CachePatchName(M_GetEmblemPatch(emblem, false), PU_PATCH), - R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE)); - } - else - { - collected = 0; - V_DrawScaledPatch(x, y+4, 0, W_CachePatchName("NEEDIT", PU_PATCH)); - } + totalemblems++; - if (emblem->hint[0]) - hint = emblem->hint; - else - hint = M_GetText("No hint available for this emblem."); - hint = V_WordWrap(40, BASEVIDWIDTH-12, 0, hint); - if (local > NUMHINTS) - V_DrawThinString(x+28, y, V_RETURN8|V_ALLOWLOWERCASE|collected, hint); - else - V_DrawString(x+28, y, V_RETURN8|V_ALLOWLOWERCASE|collected, hint); + if (totalemblems >= ((hintpage-1)*(NUMHINTS*2) + 1) && totalemblems < (hintpage*NUMHINTS*2)+1){ - y += 28; + if (emblem->collected) + { + collected = V_GREENMAP; + V_DrawMappedPatch(x, y+4, 0, W_CachePatchName(M_GetEmblemPatch(emblem, false), PU_PATCH), + R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE)); + } + else + { + collected = 0; + V_DrawScaledPatch(x, y+4, 0, W_CachePatchName("NEEDIT", PU_PATCH)); + } - if (++j == left_hints) - { - x = 4+(BASEVIDWIDTH/2); - y = 8; + if (emblem->hint[0]) + hint = emblem->hint; + else + hint = M_GetText("No hint available for this emblem."); + hint = V_WordWrap(40, BASEVIDWIDTH-12, 0, hint); + //always draw tiny if we have more than NUMHINTS*2, visually more appealing + if (local > NUMHINTS) + V_DrawThinString(x+28, y, V_RETURN8|V_ALLOWLOWERCASE|collected, hint); + else + V_DrawString(x+28, y, V_RETURN8|V_ALLOWLOWERCASE|collected, hint); + + y += 28; + + // If there are more than 1 page's but less than 2 pages' worth of emblems on the last possible page, + // put half (rounded up) of the hints on the left, and half (rounded down) on the right + + if (++j == left_hints) + { + x = 4+(BASEVIDWIDTH/2); + y = 8; + } + else if (j >= NUMHINTS*2) + break; } - else if (j >= NUMHINTS*2) - break; } M_DrawGenericMenu(); } -UINT32 check_on_hint = 0; static void M_HandleEmblemHints(INT32 choice) { @@ -7354,109 +7362,16 @@ static void M_HandleEmblemHints(INT32 choice) } - UINT32 j = check_on_hint; - switch (choice) - { - case KEY_DOWNARROW: - S_StartSound(NULL, sfx_menu1); - if ((check_on_hint != stageemblems)) - { - if (++j <= stageemblems - NUMHINTS) - check_on_hint = j; - } - return; - - case KEY_UPARROW: - S_StartSound(NULL, sfx_menu1); - if (check_on_hint) - { - if (--j != -1) - check_on_hint = j; - } - return; - - case KEY_ESCAPE: - if (currentMenu->prevMenu){ - check_on_hint = 0; - M_SetupNextMenu(currentMenu->prevMenu); - }else - M_ClearMenus(true); - return; - default: - break; - } - -} - -static void M_EmblemHintsFull(INT32 choice) -{ - (void)choice; - M_SetupNextMenu(&SR_EmblemHintFullDef); - itemOn = 0; -} - - -static void M_DrawEmblemHintsFull(void) -{ - INT32 i, x, y = currentMenu->y, drawnemblems = 0; - UINT32 collected = 0, local = 0; - emblem_t *emblem; - const char *hint; - - for (i = 0; i < numemblems; i++) - { - emblem = &emblemlocations[i]; - if (emblem->level != gamemap || emblem->type > ET_SKIN) - continue; - local++; - } - - if (!local) - V_DrawCenteredString(160, 48, V_YELLOWMAP, "No hidden emblems on this map."); - else{ - - if (check_on_hint > 0) - V_DrawString(310, y-(skullAnimCounter/5), V_YELLOWMAP, "\x1A"); - if(check_on_hint < local - NUMHINTS) - V_DrawString(310, y+8+(skullAnimCounter/5), V_YELLOWMAP, "\x1B"); - - x = 4; - y = 16; - - for (i = 0; i < numemblems; i++) - { - emblem = &emblemlocations[i]; - if (emblem->level != gamemap || emblem->type > ET_SKIN) - continue; - - drawnemblems++; - - if (drawnemblems > check_on_hint && drawnemblems <= (check_on_hint+NUMHINTS)){ - if (emblem->collected) - { - collected = V_GREENMAP; - V_DrawMappedPatch(x, y+4, 0, W_CachePatchName(M_GetEmblemPatch(emblem, false), PU_PATCH), - R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE)); - } - else - { - collected = 0; - V_DrawScaledPatch(x, y+4, 0, W_CachePatchName("NEEDIT", PU_PATCH)); - } - - if (emblem->hint[0]) - hint = emblem->hint; - else - hint = M_GetText("No hint available for this emblem."); - hint = V_WordWrap(40, BASEVIDWIDTH-12, 0, hint); - V_DrawString(x+28, y, V_RETURN8|V_ALLOWLOWERCASE|collected, hint); - - y += 32; - } + if (choice == 0){ + if (hintpage > 1){ + hintpage--; + } + }else{ + if (hintpage < (stageemblems/(NUMHINTS*2) + 1)){ + hintpage++; } } - //M_DrawGenericMenu(); } /*static void M_DrawSkyRoom(void) From c72e0efee4d543230591ab0020326a49cc9f7fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartu=20=C4=B0nce?= Date: Wed, 22 Jan 2020 21:57:28 +0100 Subject: [PATCH 033/139] "page x of y" --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 3e4d822f6..3c19e230e 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7285,7 +7285,7 @@ static void M_DrawEmblemHints(void) if (itemOn == 0){ pageflag = V_YELLOWMAP; } - V_DrawString(currentMenu->x + 40, currentMenu->y + 10, pageflag, va("%d",hintpage)); + V_DrawString(currentMenu->x + 40, currentMenu->y + 10, pageflag, va("%d of %d",hintpage, local/(NUMHINTS*2) + 1)); } // If there are more than 1 page's but less than 2 pages' worth of emblems on the last possible page, From 875774a45f26a2996e6d375c47f9d133e9360ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartu=20=C4=B0nce?= Date: Wed, 22 Jan 2020 22:08:08 +0100 Subject: [PATCH 034/139] no message --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 3c19e230e..957928497 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7367,7 +7367,7 @@ static void M_HandleEmblemHints(INT32 choice) hintpage--; } }else{ - if (hintpage < (stageemblems/(NUMHINTS*2) + 1)){ + if (hintpage < ((stageemblems-1)/(NUMHINTS*2) + 1)){ hintpage++; } } From 332b22a87ae42acea8b0c938170983195cd726d3 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Fri, 24 Jan 2020 23:54:54 -0600 Subject: [PATCH 035/139] Move spawnsnap to Special/ignore on sector trigger Also includes splitting the starpost logic into its own function. --- src/p_inter.c | 203 ++++++++++++++++++++++++++------------------------ src/p_local.h | 1 + src/p_spec.c | 2 +- 3 files changed, 109 insertions(+), 97 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 9f53a46a0..ddf90d72f 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1428,102 +1428,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Misc touchables // // *************** // case MT_STARPOST: - if (player->bot) - return; - // In circuit, player must have touched all previous starposts - if (circuitmap - && special->health - player->starpostnum > 1) - { - // blatant reuse of a variable that's normally unused in circuit - if (!player->tossdelay) - S_StartSound(toucher, sfx_lose); - player->tossdelay = 3; - return; - } - - // With the parameter + angle setup, we can go up to 1365 star posts. Who needs that many? - if (special->health > 1365) - { - CONS_Debug(DBG_GAMELOGIC, "Bad Starpost Number!\n"); - return; - } - - if (player->starpostnum >= special->health) - return; // Already hit this post - - { - mobj_t *checkbase = (special->spawnpoint && (special->spawnpoint->options & MTF_AMBUSH)) ? special : toucher; - - if (cv_coopstarposts.value && G_GametypeUsesCoopStarposts() && (netgame || multiplayer)) - { - for (i = 0; i < MAXPLAYERS; i++) - { - if (playeringame[i]) - { - if (players[i].bot) // ignore dumb, stupid tails - continue; - - players[i].starposttime = leveltime; - players[i].starpostx = checkbase->x>>FRACBITS; - players[i].starposty = checkbase->y>>FRACBITS; - players[i].starpostz = special->z>>FRACBITS; - players[i].starpostangle = special->angle; - players[i].starpostscale = player->mo->destscale; - if (special->flags2 & MF2_OBJECTFLIP) - { - players[i].starpostscale *= -1; - players[i].starpostz += special->height>>FRACBITS; - } - players[i].starpostnum = special->health; - - if (cv_coopstarposts.value == 2 && (players[i].playerstate == PST_DEAD || players[i].spectator) && P_GetLives(&players[i])) - P_SpectatorJoinGame(&players[i]); //players[i].playerstate = PST_REBORN; - } - } - S_StartSound(NULL, special->info->painsound); - } - else - { - // Save the player's time and position. - player->starposttime = leveltime; - player->starpostx = checkbase->x>>FRACBITS; - player->starposty = checkbase->y>>FRACBITS; - player->starpostz = special->z>>FRACBITS; - player->starpostangle = special->angle; - player->starpostscale = player->mo->destscale; - if (special->flags2 & MF2_OBJECTFLIP) - { - player->starpostscale *= -1; - player->starpostz += special->height>>FRACBITS; - } - player->starpostnum = special->health; - S_StartSound(toucher, special->info->painsound); - } - } - - P_ClearStarPost(special->health); - - // Find all starposts in the level with this value - INCLUDING this one! - if (!(netgame && circuitmap && player != &players[consoleplayer])) - { - thinker_t *th; - mobj_t *mo2; - - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) - { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - continue; - - mo2 = (mobj_t *)th; - - if (mo2->type != MT_STARPOST) - continue; - if (mo2->health != special->health) - continue; - - P_SetMobjState(mo2, mo2->info->painstate); - } - } + P_TouchStarPost(special, player, special->spawnpoint && (special->spawnpoint->options & MTF_OBJECTSPECIAL)); return; case MT_FAKEMOBILE: @@ -1875,6 +1780,112 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_KillMobj(special, NULL, toucher, 0); } +/** Saves a player's level progress at a star post + * + * \param post The star post to trigger + * \param player The player that should receive the checkpoint + * \param snaptopost If true, the respawn point will use the star post's position, otherwise player x/y and star post z + */ +void P_TouchStarPost(mobj_t *post, player_t *player, boolean snaptopost) +{ + size_t i; + mobj_t *toucher = player->mo; + mobj_t *checkbase = snaptopost ? post : toucher; + + if (player->bot) + return; + // In circuit, player must have touched all previous starposts + if (circuitmap + && post->health - player->starpostnum > 1) + { + // blatant reuse of a variable that's normally unused in circuit + if (!player->tossdelay) + S_StartSound(toucher, sfx_lose); + player->tossdelay = 3; + return; + } + + // With the parameter + angle setup, we can go up to 1365 star posts. Who needs that many? + if (post->health > 1365) + { + CONS_Debug(DBG_GAMELOGIC, "Bad Starpost Number!\n"); + return; + } + + if (player->starpostnum >= post->health) + return; // Already hit this post + + if (cv_coopstarposts.value && G_GametypeUsesCoopStarposts() && (netgame || multiplayer)) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i]) + { + if (players[i].bot) // ignore dumb, stupid tails + continue; + + players[i].starposttime = leveltime; + players[i].starpostx = checkbase->x>>FRACBITS; + players[i].starposty = checkbase->y>>FRACBITS; + players[i].starpostz = post->z>>FRACBITS; + players[i].starpostangle = post->angle; + players[i].starpostscale = player->mo->destscale; + if (post->flags2 & MF2_OBJECTFLIP) + { + players[i].starpostscale *= -1; + players[i].starpostz += post->height>>FRACBITS; + } + players[i].starpostnum = post->health; + + if (cv_coopstarposts.value == 2 && (players[i].playerstate == PST_DEAD || players[i].spectator) && P_GetLives(&players[i])) + P_SpectatorJoinGame(&players[i]); //players[i].playerstate = PST_REBORN; + } + } + S_StartSound(NULL, post->info->painsound); + } + else + { + // Save the player's time and position. + player->starposttime = leveltime; + player->starpostx = checkbase->x>>FRACBITS; + player->starposty = checkbase->y>>FRACBITS; + player->starpostz = post->z>>FRACBITS; + player->starpostangle = post->angle; + player->starpostscale = player->mo->destscale; + if (post->flags2 & MF2_OBJECTFLIP) + { + player->starpostscale *= -1; + player->starpostz += post->height>>FRACBITS; + } + player->starpostnum = post->health; + S_StartSound(toucher, post->info->painsound); + } + + P_ClearStarPost(post->health); + + // Find all starposts in the level with this value - INCLUDING this one! + if (!(netgame && circuitmap && player != &players[consoleplayer])) + { + thinker_t *th; + mobj_t *mo2; + + for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + { + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; + + mo2 = (mobj_t *)th; + + if (mo2->type != MT_STARPOST) + continue; + if (mo2->health != post->health) + continue; + + P_SetMobjState(mo2, mo2->info->painstate); + } + } +} + /** Prints death messages relating to a dying or hit player. * * \param player Affected player. diff --git a/src/p_local.h b/src/p_local.h index a5f3d313c..8056d137c 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -486,6 +486,7 @@ void P_PlayerWeaponPanelOrAmmoBurst(player_t *player); void P_PlayerEmeraldBurst(player_t *player, boolean toss); void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck); +void P_TouchStarPost(mobj_t *starpost, player_t *player, boolean snaptopost); void P_PlayerFlagBurst(player_t *player, boolean toss); void P_CheckTimeLimit(void); void P_CheckPointLimit(void); diff --git a/src/p_spec.c b/src/p_spec.c index 9defc33a0..a4076e513 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4684,7 +4684,7 @@ DoneSection2: if (!post) break; - P_TouchSpecialThing(post, player->mo, false); + P_TouchStarPost(post, player, false); break; } From 65e84978fa4bf86f6563367641c26ac6feba9fc0 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sun, 26 Jan 2020 04:51:00 +0800 Subject: [PATCH 036/139] Don't cancel Knuckles' landing animation on rising surfaces --- src/p_user.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index a5ccf467f..1fb5811f9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2380,6 +2380,8 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) } } } + else if (player->charability == CA_GLIDEANDCLIMB && (player->mo->state-states == S_PLAY_GLIDE_LANDING)) + ; else if (player->charability2 == CA2_GUNSLINGER && player->panim == PA_ABILITY2) ; else if (player->panim != PA_IDLE && player->panim != PA_WALK && player->panim != PA_RUN && player->panim != PA_DASH) From d08929b3d77d9e5686abddf8e07c0b2cdd927949 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 26 Jan 2020 22:46:57 -0300 Subject: [PATCH 037/139] 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 038/139] 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 039/139] 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 040/139] 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 041/139] 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 042/139] 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 043/139] "changes" not "changed" --- src/am_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/am_map.c b/src/am_map.c index f6bafe33b..b2c7de442 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -347,7 +347,7 @@ static void AM_initVariables(void) } // -// Called when the screen size changed. +// Called when the screen size changes. // static void AM_FrameBufferInit(void) { From 636093a59ddd95b25d79c4ebff51dc6412de1956 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 27 Jan 2020 13:55:13 -0300 Subject: [PATCH 044/139] 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: Wed, 29 Jan 2020 13:47:55 -0300 Subject: [PATCH 045/139] Local Color Table for GIF movie mode --- src/d_netcmd.c | 1 + src/m_anigif.c | 89 ++++++++++++++++++++++++++++++++++++++------------ src/m_anigif.h | 2 +- 3 files changed, 71 insertions(+), 21 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 23ec00b2e..8d36cb058 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -669,6 +669,7 @@ void D_RegisterClientCommands(void) // GIF variables CV_RegisterVar(&cv_gif_optimize); CV_RegisterVar(&cv_gif_downscale); + CV_RegisterVar(&cv_gif_localcolortable); #ifdef WALLSPLATS CV_RegisterVar(&cv_splats); diff --git a/src/m_anigif.c b/src/m_anigif.c index 32fc2746d..bd90f6675 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -19,6 +19,7 @@ #include "v_video.h" #include "i_video.h" #include "m_misc.h" +#include "st_stuff.h" // st_palette #ifdef HWRENDER #include "hardware/hw_main.h" @@ -29,10 +30,12 @@ consvar_t cv_gif_optimize = {"gif_optimize", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_gif_downscale = {"gif_downscale", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_gif_localcolortable = {"gif_localcolortable", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; #ifdef HAVE_ANIGIF static boolean gif_optimize = false; // So nobody can do something dumb static boolean gif_downscale = false; // like changing cvars mid output +static boolean gif_localcolortable = false; static RGBA_t *gif_palette = NULL; static FILE *gif_out = NULL; @@ -393,6 +396,41 @@ const UINT8 gifhead_nsid[19] = {0x21,0xFF,0x0B, // extension block + size 0x4E,0x45,0x54,0x53,0x43,0x41,0x50,0x45,0x32,0x2E,0x30, // NETSCAPE2.0 0x03,0x01,0xFF,0xFF,0x00}; // sub-block, repetitions + +// +// GIF_setpalette +// determine the gif palette. +// +static void GIF_setpalette(void) +{ + // In hardware mode, uses the master palette + size_t palnum = (rendermode == render_soft) ? ((gif_localcolortable) ? max(st_palette, 0) : 0) : 0; + gif_palette = ((cv_screenshot_colorprofile.value +#ifdef HWRENDER + && (rendermode == render_soft) +#endif + ) ? &pLocalPalette[palnum*256] + : &pMasterPalette[palnum*256]); +} + +// +// GIF_palwrite +// writes the gif palette. +// used both for the header and the local color table. +// +static UINT8 *GIF_palwrite(UINT8 *p) +{ + INT32 i; + RGBA_t *pal = gif_palette; + for (i = 0; i < 256; i++) + { + WRITEUINT8(p, pal[i].s.red); + WRITEUINT8(p, pal[i].s.green); + WRITEUINT8(p, pal[i].s.blue); + } + return p; +} + // // GIF_headwrite // writes the gif header to the currently open output file. @@ -402,8 +440,10 @@ static void GIF_headwrite(void) { UINT8 *gifhead = Z_Malloc(800, PU_STATIC, NULL); UINT8 *p = gifhead; - INT32 i; + UINT8 *last_p; UINT16 rwidth, rheight; + size_t totalbytes; + INT32 i; if (!gif_out) return; @@ -423,30 +463,37 @@ static void GIF_headwrite(void) rwidth = vid.width; rheight = vid.height; } + + last_p = p; WRITEUINT16(p, rwidth); WRITEUINT16(p, rheight); // colors, aspect, etc - WRITEUINT8(p, 0xF7); + WRITEUINT8(p, (gif_localcolortable ? 0xF0 : 0xF7)); // (0xF7 = 1111 0111) WRITEUINT8(p, 0x00); WRITEUINT8(p, 0x00); + // Lactozilla: should be 800 without a local color table + totalbytes = sizeof(gifhead_base) + sizeof(gifhead_nsid) + (p - last_p); + // write color table + if (!gif_localcolortable) { - RGBA_t *pal = gif_palette; - for (i = 0; i < 256; i++) - { - WRITEUINT8(p, pal[i].s.red); - WRITEUINT8(p, pal[i].s.green); - WRITEUINT8(p, pal[i].s.blue); - } + p = GIF_palwrite(p); + totalbytes += (256 * 3); + } + else + { + // write a dummy palette + for (i = 0; i < 6; i++, totalbytes++) + WRITEUINT8(p, 0); } // write extension block WRITEMEM(p, gifhead_nsid, sizeof(gifhead_nsid)); // write to file and be done with it! - fwrite(gifhead, 1, 800, gif_out); + fwrite(gifhead, 1, totalbytes, gif_out); Z_Free(gifhead); } @@ -566,7 +613,15 @@ static void GIF_framewrite(void) WRITEUINT16(p, (UINT16)(blity / scrbuf_downscaleamt)); WRITEUINT16(p, (UINT16)(blitw / scrbuf_downscaleamt)); WRITEUINT16(p, (UINT16)(blith / scrbuf_downscaleamt)); - WRITEUINT8(p, 0); // no local table of colors + + if (!gif_localcolortable) + WRITEUINT8(p, 0); // no local table of colors + else + { + WRITEUINT8(p, 0x87); // (0x87 = 1000 0111) + GIF_setpalette(); + p = GIF_palwrite(p); + } scrbuf_pos = movie_screen + blitx + (blity * vid.width); scrbuf_writeend = scrbuf_pos + (blitw - 1) + ((blith - 1) * vid.width); @@ -638,15 +693,9 @@ INT32 GIF_open(const char *filename) gif_optimize = (!!cv_gif_optimize.value); gif_downscale = (!!cv_gif_downscale.value); - - // GIF color table - // In hardware mode, uses the master palette - gif_palette = ((cv_screenshot_colorprofile.value -#ifdef HWRENDER - && (rendermode == render_soft) -#endif - ) ? pLocalPalette - : pMasterPalette); + gif_localcolortable = (!!cv_gif_localcolortable.value); + if (!gif_localcolortable) + GIF_setpalette(); GIF_headwrite(); gif_frames = 0; diff --git a/src/m_anigif.h b/src/m_anigif.h index 9bdf2cc7f..9eb6faa75 100644 --- a/src/m_anigif.h +++ b/src/m_anigif.h @@ -27,6 +27,6 @@ void GIF_frame(void); INT32 GIF_close(void); #endif -extern consvar_t cv_gif_optimize, cv_gif_downscale; +extern consvar_t cv_gif_optimize, cv_gif_downscale, cv_gif_localcolortable; #endif From 99c755c186705f5161cc6d13b9fbe74753239f5a Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Wed, 29 Jan 2020 13:52:02 -0300 Subject: [PATCH 046/139] Update the Screenshot Options menu --- src/m_menu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index f8c14dd69..52889c630 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1443,6 +1443,7 @@ static menuitem_t OP_ScreenshotOptionsMenu[] = {IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 95}, {IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_gif_downscale, 100}, + {IT_STRING|IT_CVAR, NULL, "Local Color Table", &cv_gif_localcolortable, 105}, {IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memorya, 95}, {IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_levela, 100}, @@ -1457,9 +1458,9 @@ enum op_movie_folder = 11, op_screenshot_capture = 12, op_screenshot_gif_start = 13, - op_screenshot_gif_end = 14, - op_screenshot_apng_start = 15, - op_screenshot_apng_end = 18, + op_screenshot_gif_end = 15, + op_screenshot_apng_start = 16, + op_screenshot_apng_end = 19, }; static menuitem_t OP_EraseDataMenu[] = From 999e72ab325301d248837f5337eb8f90143231ef Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Wed, 29 Jan 2020 13:56:39 -0300 Subject: [PATCH 047/139] Uh --- src/m_anigif.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/m_anigif.c b/src/m_anigif.c index bd90f6675..82e118527 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -434,7 +434,6 @@ static UINT8 *GIF_palwrite(UINT8 *p) // // GIF_headwrite // writes the gif header to the currently open output file. -// NOTE that this code does not accomodate for palette changes. // static void GIF_headwrite(void) { From 85211dcc09c922e0d42b4eeea387dcecc8e989ae Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Wed, 29 Jan 2020 17:31:27 -0300 Subject: [PATCH 048/139] Only write a Local Color Table if the frame's palette differs from the header's palette --- src/m_anigif.c | 73 +++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/src/m_anigif.c b/src/m_anigif.c index 82e118527..f917a7b26 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -35,8 +35,12 @@ consvar_t cv_gif_localcolortable = {"gif_localcolortable", "On", CV_SAVE, CV_On #ifdef HAVE_ANIGIF static boolean gif_optimize = false; // So nobody can do something dumb static boolean gif_downscale = false; // like changing cvars mid output + +// Palette handling static boolean gif_localcolortable = false; -static RGBA_t *gif_palette = NULL; +static boolean gif_colorprofile = false; +static RGBA_t *gif_headerpalette = NULL; +static RGBA_t *gif_framepalette = NULL; static FILE *gif_out = NULL; static INT32 gif_frames = 0; @@ -398,14 +402,13 @@ const UINT8 gifhead_nsid[19] = {0x21,0xFF,0x0B, // extension block + size // -// GIF_setpalette -// determine the gif palette. +// GIF_getpalette +// determine the palette for the current frame. // -static void GIF_setpalette(void) +static RGBA_t *GIF_getpalette(size_t palnum) { // In hardware mode, uses the master palette - size_t palnum = (rendermode == render_soft) ? ((gif_localcolortable) ? max(st_palette, 0) : 0) : 0; - gif_palette = ((cv_screenshot_colorprofile.value + return ((gif_colorprofile #ifdef HWRENDER && (rendermode == render_soft) #endif @@ -416,12 +419,11 @@ static void GIF_setpalette(void) // // GIF_palwrite // writes the gif palette. -// used both for the header and the local color table. +// used both for the header and local color tables. // -static UINT8 *GIF_palwrite(UINT8 *p) +static UINT8 *GIF_palwrite(UINT8 *p, RGBA_t *pal) { INT32 i; - RGBA_t *pal = gif_palette; for (i = 0; i < 256; i++) { WRITEUINT8(p, pal[i].s.red); @@ -439,10 +441,7 @@ static void GIF_headwrite(void) { UINT8 *gifhead = Z_Malloc(800, PU_STATIC, NULL); UINT8 *p = gifhead; - UINT8 *last_p; UINT16 rwidth, rheight; - size_t totalbytes; - INT32 i; if (!gif_out) return; @@ -463,36 +462,22 @@ static void GIF_headwrite(void) rheight = vid.height; } - last_p = p; WRITEUINT16(p, rwidth); WRITEUINT16(p, rheight); // colors, aspect, etc - WRITEUINT8(p, (gif_localcolortable ? 0xF0 : 0xF7)); // (0xF7 = 1111 0111) + WRITEUINT8(p, 0xF7); // (0xF7 = 1111 0111) WRITEUINT8(p, 0x00); WRITEUINT8(p, 0x00); - // Lactozilla: should be 800 without a local color table - totalbytes = sizeof(gifhead_base) + sizeof(gifhead_nsid) + (p - last_p); - // write color table - if (!gif_localcolortable) - { - p = GIF_palwrite(p); - totalbytes += (256 * 3); - } - else - { - // write a dummy palette - for (i = 0; i < 6; i++, totalbytes++) - WRITEUINT8(p, 0); - } + p = GIF_palwrite(p, gif_headerpalette); // write extension block WRITEMEM(p, gifhead_nsid, sizeof(gifhead_nsid)); // write to file and be done with it! - fwrite(gifhead, 1, totalbytes, gif_out); + fwrite(gifhead, 1, 800, gif_out); Z_Free(gifhead); } @@ -514,7 +499,7 @@ static void hwrconvert(void) INT32 x, y; size_t i = 0; - InitColorLUT(gif_palette); + InitColorLUT(gif_framepalette); for (y = 0; y < vid.height; y++) { @@ -540,6 +525,7 @@ static void GIF_framewrite(void) UINT8 *p; UINT8 *movie_screen = screens[2]; INT32 blitx, blity, blitw, blith; + boolean palchanged; if (!gifframe_data) gifframe_data = Z_Malloc(gifframe_size, PU_STATIC, NULL); @@ -548,8 +534,18 @@ static void GIF_framewrite(void) if (!gif_out) return; + // Lactozilla: Compare the header's palette with the current frame's palette and see if it changed. + if (gif_localcolortable) + { + gif_framepalette = GIF_getpalette((rendermode == render_soft) ? ((gif_localcolortable) ? max(st_palette, 0) : 0) : 0); + palchanged = memcmp(gif_headerpalette, gif_framepalette, sizeof(RGBA_t) * 256); + } + else + palchanged = false; + // Compare image data (for optimizing GIF) - if (gif_optimize && gif_frames > 0) + // If the palette has changed, the entire frame is considered to be different. + if (gif_optimize && gif_frames > 0 && (!palchanged)) { // before blit movie_screen points to last frame, cur_screen points to this frame UINT8 *cur_screen = screens[0]; @@ -617,9 +613,14 @@ static void GIF_framewrite(void) WRITEUINT8(p, 0); // no local table of colors else { - WRITEUINT8(p, 0x87); // (0x87 = 1000 0111) - GIF_setpalette(); - p = GIF_palwrite(p); + if (palchanged) + { + // The palettes are different, so write the Local Color Table! + WRITEUINT8(p, 0x87); // (0x87 = 1000 0111) + p = GIF_palwrite(p, gif_framepalette); + } + else + WRITEUINT8(p, 0); // They are equal, no Local Color Table needed. } scrbuf_pos = movie_screen + blitx + (blity * vid.width); @@ -693,8 +694,8 @@ INT32 GIF_open(const char *filename) gif_optimize = (!!cv_gif_optimize.value); gif_downscale = (!!cv_gif_downscale.value); gif_localcolortable = (!!cv_gif_localcolortable.value); - if (!gif_localcolortable) - GIF_setpalette(); + gif_colorprofile = (!!cv_screenshot_colorprofile.value); + gif_headerpalette = GIF_getpalette(0); GIF_headwrite(); gif_frames = 0; From 3afc766f5e36d094395fe0da41e7142be070e8c1 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 30 Jan 2020 23:58:35 -0800 Subject: [PATCH 049/139] 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 050/139] 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 051/139] 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 052/139] 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 053/139] 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 054/139] 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 055/139] 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 93b64a8d7d319bb3932739c36898a61ad2dfffbb Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sat, 24 Aug 2019 09:27:37 -0500 Subject: [PATCH 056/139] Create V_DrawThinStringAtFixed() for new "thin-fixed" option in v.drawString() --- src/lua_hudlib.c | 5 +++ src/v_video.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ src/v_video.h | 1 + 3 files changed, 97 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 235010f2a..0290eedeb 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -116,6 +116,7 @@ enum align { align_small, align_smallright, align_thin, + align_thinfixed, align_thinright }; static const char *const align_opt[] = { @@ -126,6 +127,7 @@ static const char *const align_opt[] = { "small", "small-right", "thin", + "thin-fixed", "thin-right", NULL}; @@ -743,6 +745,9 @@ static int libd_drawString(lua_State *L) case align_thinright: V_DrawRightAlignedThinString(x, y, flags, str); break; + case align_thinfixed: + V_DrawThinStringAtFixed(x, y, flags, str); + break; } return 0; } diff --git a/src/v_video.c b/src/v_video.c index 4785a1541..fa8d2cd37 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2511,6 +2511,97 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) } } +// Draws a thin string at a fixed_t location. +void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + fixed_t cx = x, cy = y; + INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0; + const char *ch = string; + INT32 spacewidth = 2, charwidth = 0; + + INT32 lowercase = (option & V_ALLOWLOWERCASE); + option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE... + + if (option & V_NOSCALESTART) + { + dupx = vid.dupx; + dupy = vid.dupy; + scrwidth = vid.width; + } + else + { + dupx = dupy = 1; + scrwidth = vid.width/vid.dupx; + left = (scrwidth - BASEVIDWIDTH)/2; + scrwidth -= left; + } + + switch (option & V_SPACINGMASK) + { + case V_MONOSPACE: + spacewidth = 8; + /* FALLTHRU */ + case V_OLDSPACING: + charwidth = 8; + break; + case V_6WIDTHSPACE: + spacewidth = 6; + default: + break; + } + + for (;;ch++) + { + if (!*ch) + break; + if (*ch & 0x80) //color ignoring + continue; + if (*ch == '\n') + { + cx = x; + + if (option & V_RETURN8) + cy += (8*dupy)<= HU_FONTSIZE || !tny_font[c]) + { + cx += (spacewidth * dupx)<width)*(dupx/2); + } + else + w = SHORT(tny_font[c]->width) * dupx; + + if ((cx>>FRACBITS) > scrwidth) + break; + if ((cx>>FRACBITS)+left + w < 0) //left boundary check + { + cx += w< Date: Sat, 24 Aug 2019 11:45:32 -0500 Subject: [PATCH 057/139] Create V_DrawSmallStringAtFixed() for new "small-fixed" option in v.drawString() --- src/lua_hudlib.c | 5 +++ src/v_video.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ src/v_video.h | 1 + 3 files changed, 97 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 0290eedeb..914b2fecf 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -114,6 +114,7 @@ enum align { align_right, align_fixed, align_small, + align_smallfixed, align_smallright, align_thin, align_thinfixed, @@ -125,6 +126,7 @@ static const char *const align_opt[] = { "right", "fixed", "small", + "small-fixed", "small-right", "thin", "thin-fixed", @@ -735,6 +737,9 @@ static int libd_drawString(lua_State *L) case align_small: V_DrawSmallString(x, y, flags, str); break; + case align_smallfixed: + V_DrawSmallStringAtFixed(x, y, flags, str); + break; case align_smallright: V_DrawRightAlignedSmallString(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index fa8d2cd37..98a87fd6f 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2511,6 +2511,97 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) } } +// Draws a small string at a fixed_t location. +void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + fixed_t cx = x, cy = y; + INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0; + const char *ch = string; + INT32 spacewidth = 2, charwidth = 0; + + INT32 lowercase = (option & V_ALLOWLOWERCASE); + option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE... + + if (option & V_NOSCALESTART) + { + dupx = vid.dupx; + dupy = vid.dupy; + scrwidth = vid.width; + } + else + { + dupx = dupy = 1; + scrwidth = vid.width/vid.dupx; + left = (scrwidth - BASEVIDWIDTH)/2; + scrwidth -= left; + } + + switch (option & V_SPACINGMASK) + { + case V_MONOSPACE: + spacewidth = 4; + /* FALLTHRU */ + case V_OLDSPACING: + charwidth = 4; + break; + case V_6WIDTHSPACE: + spacewidth = 3; + default: + break; + } + + for (;;ch++) + { + if (!*ch) + break; + if (*ch & 0x80) //color ignoring + continue; + if (*ch == '\n') + { + cx = x; + + if (option & V_RETURN8) + cy += (4*dupy)<= HU_FONTSIZE || !hu_font[c]) + { + cx += (spacewidth * dupx)<width)*(dupx/4); + } + else + w = SHORT(hu_font[c]->width) * dupx / 2; + + if ((cx>>FRACBITS) > scrwidth) + break; + if ((cx>>FRACBITS)+left + w < 0) //left boundary check + { + cx += w< Date: Tue, 27 Aug 2019 02:27:25 -0500 Subject: [PATCH 058/139] Add V_COLORMAP support for small-fixed and thin-fixed text. --- src/v_video.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index 98a87fd6f..aaa796e8b 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2517,6 +2517,8 @@ void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *st fixed_t cx = x, cy = y; INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0; const char *ch = string; + INT32 charflags = 0; + const UINT8 *colormap = NULL; INT32 spacewidth = 2, charwidth = 0; INT32 lowercase = (option & V_ALLOWLOWERCASE); @@ -2536,6 +2538,8 @@ void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *st scrwidth -= left; } + charflags = (option & V_CHARCOLORMASK); + switch (option & V_SPACINGMASK) { case V_MONOSPACE: @@ -2554,8 +2558,13 @@ void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *st { if (!*ch) break; - if (*ch & 0x80) //color ignoring + if (*ch & 0x80) //color parsing -x 2.16.09 + { + // manually set flags override color codes + if (!(option & V_CHARCOLORMASK)) + charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK; continue; + } if (*ch == '\n') { cx = x; @@ -2596,7 +2605,9 @@ void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *st continue; } - V_DrawSciencePatch(cx + (center< Date: Tue, 27 Aug 2019 02:57:19 -0500 Subject: [PATCH 059/139] Create V_DrawCenteredSmallString() for new "small-center" option in v.drawString() --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 7 +++++++ src/v_video.h | 1 + 3 files changed, 13 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 914b2fecf..e0d3c52fa 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -115,6 +115,7 @@ enum align { align_fixed, align_small, align_smallfixed, + align_smallcenter, align_smallright, align_thin, align_thinfixed, @@ -127,6 +128,7 @@ static const char *const align_opt[] = { "fixed", "small", "small-fixed", + "small-center", "small-right", "thin", "thin-fixed", @@ -740,6 +742,9 @@ static int libd_drawString(lua_State *L) case align_smallfixed: V_DrawSmallStringAtFixed(x, y, flags, str); break; + case align_smallcenter: + V_DrawCenteredSmallString(x, y, flags, str); + break; case align_smallright: V_DrawRightAlignedSmallString(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index aaa796e8b..973cbc0c4 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2299,6 +2299,13 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string) } } +void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string) +{ + x -= V_SmallStringWidth(string, option)/2; + V_DrawSmallString(x, y, option, string); +} + + void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string) { x -= V_SmallStringWidth(string, option); diff --git a/src/v_video.h b/src/v_video.h index 06397d409..6f03c4d8f 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -205,6 +205,7 @@ void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string // draw a string using the hu_font, 0.5x scale void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string); +void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string); void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string); // draw a string using the tny_font From 426ccc9203cb61b6d16e84e457256a5f8ff0a9b4 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Tue, 27 Aug 2019 03:05:03 -0500 Subject: [PATCH 060/139] Create V_DrawCenteredThinString() for new "thin-center" option in v.drawString() --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 6 ++++++ src/v_video.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index e0d3c52fa..12b894bf2 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -119,6 +119,7 @@ enum align { align_smallright, align_thin, align_thinfixed, + align_thincenter, align_thinright }; static const char *const align_opt[] = { @@ -132,6 +133,7 @@ static const char *const align_opt[] = { "small-right", "thin", "thin-fixed", + "thin-center", "thin-right", NULL}; @@ -752,6 +754,9 @@ static int libd_drawString(lua_State *L) case align_thin: V_DrawThinString(x, y, flags, str); break; + case align_thincenter: + V_DrawCenteredThinString(x, y, flags, str); + break; case align_thinright: V_DrawRightAlignedThinString(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index 973cbc0c4..1e4217e4e 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2411,6 +2411,12 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string) } } +void V_DrawCenteredThinString(INT32 x, INT32 y, INT32 option, const char *string) +{ + x -= V_ThinStringWidth(string, option)/2; + V_DrawThinString(x, y, option, string); +} + void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *string) { x -= V_ThinStringWidth(string, option); diff --git a/src/v_video.h b/src/v_video.h index 6f03c4d8f..9a0fe51d4 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -210,6 +210,7 @@ void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *s // draw a string using the tny_font void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string); +void V_DrawCenteredThinString(INT32 x, INT32 y, INT32 option, const char *string); void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *string); void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); From dc1871a74f2c4affc4727725015fc1758d1bbcd0 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Tue, 27 Aug 2019 03:25:28 -0500 Subject: [PATCH 061/139] Create V_DrawRightAlignedStringAtFixed() for new "fixed-right" option in v.drawString() --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 6 ++++++ src/v_video.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 12b894bf2..ed8e1b676 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -113,6 +113,7 @@ enum align { align_center, align_right, align_fixed, + align_fixedright, align_small, align_smallfixed, align_smallcenter, @@ -127,6 +128,7 @@ static const char *const align_opt[] = { "center", "right", "fixed", + "fixed-right", "small", "small-fixed", "small-center", @@ -737,6 +739,9 @@ static int libd_drawString(lua_State *L) case align_fixed: V_DrawStringAtFixed(x, y, flags, str); break; + case align_fixedright: + V_DrawRightAlignedStringAtFixed(x, y, flags, str); + break; // hu_font, 0.5x scale case align_small: V_DrawSmallString(x, y, flags, str); diff --git a/src/v_video.c b/src/v_video.c index 1e4217e4e..1b95d0145 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2524,6 +2524,12 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) } } +void V_DrawRightAlignedStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= V_StringWidth(string, option)< Date: Tue, 27 Aug 2019 03:28:45 -0500 Subject: [PATCH 062/139] Fixed v_video.h declaration for V_DrawRightAlignedStringAtFixed() --- src/v_video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v_video.h b/src/v_video.h index cf096ae4b..0c8477adc 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -215,7 +215,7 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st // draw a string using the hu_font at fixed_t coordinates void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); -void V_DrawRightAlignedStringAtFixed(INT32 x, INT32 y, INT32 option, const char *string); +void V_DrawRightAlignedStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); From 9f50b6ef73952e88bfdfe7e5d6e7384f72ec6c2e Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Tue, 27 Aug 2019 03:36:12 -0500 Subject: [PATCH 063/139] Create V_DrawCenteredStringAtFixed() for new "fixed-center" option in v.drawString() --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 6 ++++++ src/v_video.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index ed8e1b676..906afede8 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -113,6 +113,7 @@ enum align { align_center, align_right, align_fixed, + align_fixedcenter, align_fixedright, align_small, align_smallfixed, @@ -128,6 +129,7 @@ static const char *const align_opt[] = { "center", "right", "fixed", + "fixed-center", "fixed-right", "small", "small-fixed", @@ -739,6 +741,9 @@ static int libd_drawString(lua_State *L) case align_fixed: V_DrawStringAtFixed(x, y, flags, str); break; + case align_fixedcenter: + V_DrawCenteredStringAtFixed(x, y, flags, str); + break; case align_fixedright: V_DrawRightAlignedStringAtFixed(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index 1b95d0145..d4aad6a64 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2524,6 +2524,12 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) } } +void V_DrawCenteredStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= (V_StringWidth(string, option) / 2)< Date: Tue, 27 Aug 2019 22:44:19 -0500 Subject: [PATCH 064/139] Create V_DrawSmallThinString() for new "small-thin" option in v.drawString() Note this has some major limitations to prevent squished text. It defaults to using V_MONOSPACE|V_OLDSPACING and you cannot change the size of characters. V_6WIDTHSPACE seems to act exactly the same as V_OLDSPACING too. --- src/lua_hudlib.c | 5 ++ src/v_video.c | 205 +++++++++++++++++++++++++++++++++++++++++++++++ src/v_video.h | 3 + 3 files changed, 213 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 906afede8..c10bc2efd 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -119,6 +119,7 @@ enum align { align_smallfixed, align_smallcenter, align_smallright, + align_smallthin, align_thin, align_thinfixed, align_thincenter, @@ -135,6 +136,7 @@ static const char *const align_opt[] = { "small-fixed", "small-center", "small-right", + "small-thin", "thin", "thin-fixed", "thin-center", @@ -760,6 +762,9 @@ static int libd_drawString(lua_State *L) case align_smallright: V_DrawRightAlignedSmallString(x, y, flags, str); break; + case align_smallthin: + V_DrawSmallThinString(x, y, flags, str); + break; // tny_font case align_thin: V_DrawThinString(x, y, flags, str); diff --git a/src/v_video.c b/src/v_video.c index d4aad6a64..7a51c9088 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2423,6 +2423,211 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st V_DrawThinString(x, y, option, string); } +// +// Write a string using the tny_font, 0.5x scale +// NOTE: the text is centered for screens larger than the base width +// +/* +void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) +{ + INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, center = 0, left = 0; + const char *ch = string; + INT32 charflags = 0; + const UINT8 *colormap = NULL; + INT32 spacewidth = 2, charwidth = 0; + + INT32 lowercase = (option & V_ALLOWLOWERCASE); + option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE... + + if (option & V_NOSCALESTART) + { + dupx = vid.dupx; + dupy = vid.dupy; + scrwidth = vid.width; + } + else + { + dupx = dupy = 1; + scrwidth = vid.width/vid.dupx; + left = (scrwidth - BASEVIDWIDTH)/4; + scrwidth -= left; + } + + charflags = (option & V_CHARCOLORMASK); + + switch (option & V_SPACINGMASK) + { + case V_MONOSPACE: + spacewidth = 3; + // FALLTHRU + case V_OLDSPACING: + charwidth = 3; + break; + case V_6WIDTHSPACE: + spacewidth = 2; + default: + break; + } + + for (;;ch++) + { + if (!*ch) + break; + if (*ch & 0x80) //color parsing -x 2.16.09 + { + // manually set flags override color codes + if (!(option & V_CHARCOLORMASK)) + charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK; + continue; + } + if (*ch == '\n') + { + cx = x; + + if (option & V_RETURN8) + cy += 4*dupy; + else + cy += 6*dupy; + + continue; + } + + c = *ch; + if (!lowercase || !tny_font[c-HU_FONTSTART]) + c = toupper(c); + c -= HU_FONTSTART; + + if (c < 0 || c >= HU_FONTSIZE || !tny_font[c]) + { + cx += spacewidth * dupx; + continue; + } + + if (charwidth) + { + w = charwidth * dupx; + center = w/2 - SHORT(tny_font[c]->width)*dupx/4; + } + else + w = SHORT(tny_font[c]->width) * dupx / 2; + if (cx > scrwidth) + break; + if (cx+left + w < 0) //left boundary check + { + cx += w; + continue; + } + + colormap = V_GetStringColormap(charflags); + V_DrawFixedPatch((cx + center)<= HU_FONTSIZE || !tny_font[c]) + { + cx += spacewidth * dupx; + continue; + } + + if (charwidth) + { + w = charwidth * dupx; + center = w/2 - SHORT(tny_font[c]->width)*dupx/4; + } + else + w = SHORT(tny_font[c]->width) * dupx / 2; + + if (cx > scrwidth) + break; + if (cx+left + w < 0) //left boundary check + { + cx += w; + continue; + } + + colormap = V_GetStringColormap(charflags); + V_DrawFixedPatch((cx + center)< Date: Tue, 27 Aug 2019 22:48:16 -0500 Subject: [PATCH 065/139] remove large commented broken version of V_DrawSmallThinString() lol --- src/v_video.c | 97 --------------------------------------------------- 1 file changed, 97 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index 7a51c9088..33608de44 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2427,103 +2427,6 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st // Write a string using the tny_font, 0.5x scale // NOTE: the text is centered for screens larger than the base width // -/* -void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) -{ - INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, center = 0, left = 0; - const char *ch = string; - INT32 charflags = 0; - const UINT8 *colormap = NULL; - INT32 spacewidth = 2, charwidth = 0; - - INT32 lowercase = (option & V_ALLOWLOWERCASE); - option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE... - - if (option & V_NOSCALESTART) - { - dupx = vid.dupx; - dupy = vid.dupy; - scrwidth = vid.width; - } - else - { - dupx = dupy = 1; - scrwidth = vid.width/vid.dupx; - left = (scrwidth - BASEVIDWIDTH)/4; - scrwidth -= left; - } - - charflags = (option & V_CHARCOLORMASK); - - switch (option & V_SPACINGMASK) - { - case V_MONOSPACE: - spacewidth = 3; - // FALLTHRU - case V_OLDSPACING: - charwidth = 3; - break; - case V_6WIDTHSPACE: - spacewidth = 2; - default: - break; - } - - for (;;ch++) - { - if (!*ch) - break; - if (*ch & 0x80) //color parsing -x 2.16.09 - { - // manually set flags override color codes - if (!(option & V_CHARCOLORMASK)) - charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK; - continue; - } - if (*ch == '\n') - { - cx = x; - - if (option & V_RETURN8) - cy += 4*dupy; - else - cy += 6*dupy; - - continue; - } - - c = *ch; - if (!lowercase || !tny_font[c-HU_FONTSTART]) - c = toupper(c); - c -= HU_FONTSTART; - - if (c < 0 || c >= HU_FONTSIZE || !tny_font[c]) - { - cx += spacewidth * dupx; - continue; - } - - if (charwidth) - { - w = charwidth * dupx; - center = w/2 - SHORT(tny_font[c]->width)*dupx/4; - } - else - w = SHORT(tny_font[c]->width) * dupx / 2; - if (cx > scrwidth) - break; - if (cx+left + w < 0) //left boundary check - { - cx += w; - continue; - } - - colormap = V_GetStringColormap(charflags); - V_DrawFixedPatch((cx + center)< Date: Sat, 7 Sep 2019 17:37:21 -0500 Subject: [PATCH 066/139] Create V_DrawRightAlignedThinStringAtFixed() for new "thin-fixed-right" option in v.drawString() These function names are starting to become rediculous... --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 6 ++++++ src/v_video.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index c10bc2efd..61c1ea141 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -122,6 +122,7 @@ enum align { align_smallthin, align_thin, align_thinfixed, + align_thinfixedright, align_thincenter, align_thinright }; @@ -139,6 +140,7 @@ static const char *const align_opt[] = { "small-thin", "thin", "thin-fixed", + "thin-fixed-right", "thin-center", "thin-right", NULL}; @@ -778,6 +780,9 @@ static int libd_drawString(lua_State *L) case align_thinfixed: V_DrawThinStringAtFixed(x, y, flags, str); break; + case align_thinfixedright: + V_DrawRightAlignedThinStringAtFixed(x, y, flags, str); + break; } return 0; } diff --git a/src/v_video.c b/src/v_video.c index 33608de44..c59bebf34 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2848,6 +2848,12 @@ void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *str } } +void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= V_ThinStringWidth(string, option)< Date: Sat, 7 Sep 2019 17:41:03 -0500 Subject: [PATCH 067/139] Fixed V_DrawRightAlignedThinStringAtFixed declaration to use fixed_t for positioning. --- src/v_video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v_video.h b/src/v_video.h index fcf71e9d1..311ec8310 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -225,7 +225,7 @@ void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *st // draw a string using the tny_font at fixed_t coordinates void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); -void V_DrawRightAlignedThinStringAtFixed(INT32 x, INT32 y, INT32 option, const char *string); +void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); // Draw tall nums, used for menu, HUD, intermission void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num); From f7085fc1710a9cdaa51e3906441c5fb32081065e Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sat, 7 Sep 2019 17:55:33 -0500 Subject: [PATCH 068/139] Create V_DrawCenteredThinStringAtFixed() for new "thin-fixed-center" option in v.drawString() --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 6 ++++++ src/v_video.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 61c1ea141..bf03b351b 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -122,6 +122,7 @@ enum align { align_smallthin, align_thin, align_thinfixed, + align_thinfixedcenter, align_thinfixedright, align_thincenter, align_thinright @@ -140,6 +141,7 @@ static const char *const align_opt[] = { "small-thin", "thin", "thin-fixed", + "thin-fixed-center", "thin-fixed-right", "thin-center", "thin-right", @@ -780,6 +782,9 @@ static int libd_drawString(lua_State *L) case align_thinfixed: V_DrawThinStringAtFixed(x, y, flags, str); break; + case align_thinfixedcenter: + V_DrawCenteredThinStringAtFixed(x, y, flags, str); + break; case align_thinfixedright: V_DrawRightAlignedThinStringAtFixed(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index c59bebf34..d80b507bc 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2848,6 +2848,12 @@ void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *str } } +void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= (V_ThinStringWidth(string, option) / 2)< Date: Mon, 9 Sep 2019 19:49:04 -0500 Subject: [PATCH 069/139] Create V_DrawRightAlignedSmallStringAtFixed() for new "small-fixed-right" option in v.drawString() --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 6 ++++++ src/v_video.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index bf03b351b..7a633f757 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -117,6 +117,7 @@ enum align { align_fixedright, align_small, align_smallfixed, + align_smallfixedright, align_smallcenter, align_smallright, align_smallthin, @@ -136,6 +137,7 @@ static const char *const align_opt[] = { "fixed-right", "small", "small-fixed", + "small-fixed-right", "small-center", "small-right", "small-thin", @@ -760,6 +762,9 @@ static int libd_drawString(lua_State *L) case align_smallfixed: V_DrawSmallStringAtFixed(x, y, flags, str); break; + case align_smallfixedright: + V_DrawRightAlignedSmallStringAtFixed(x, y, flags, str); + break; case align_smallcenter: V_DrawCenteredSmallString(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index d80b507bc..dba9ed2dc 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2746,6 +2746,12 @@ void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *st } } +void V_DrawRightAlignedSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= V_SmallStringWidth(string, option)< Date: Mon, 9 Sep 2019 20:41:34 -0500 Subject: [PATCH 070/139] Create V_DrawCenteredSmallStringAtFixed() for new "small-fixed-center" option in v.drawString() --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 6 ++++++ src/v_video.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 7a633f757..f890f62c0 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -117,6 +117,7 @@ enum align { align_fixedright, align_small, align_smallfixed, + align_smallfixedcenter, align_smallfixedright, align_smallcenter, align_smallright, @@ -137,6 +138,7 @@ static const char *const align_opt[] = { "fixed-right", "small", "small-fixed", + "small-fixed-center", "small-fixed-right", "small-center", "small-right", @@ -762,6 +764,9 @@ static int libd_drawString(lua_State *L) case align_smallfixed: V_DrawSmallStringAtFixed(x, y, flags, str); break; + case align_smallfixedcenter: + V_DrawCenteredSmallStringAtFixed(x, y, flags, str); + break; case align_smallfixedright: V_DrawRightAlignedSmallStringAtFixed(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index dba9ed2dc..a4c1bf6ba 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2746,6 +2746,12 @@ void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *st } } +void V_DrawCenteredSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= (V_SmallStringWidth(string, option) / 2)< Date: Mon, 9 Sep 2019 21:25:52 -0500 Subject: [PATCH 071/139] Create V_DrawSmallThinStringAtFixed() for new "small-thin-fixed" option in v.drawString() I removed the limitation present in "small-thin" by converting all relevant variables to fixed_t's and using FixedMul() and FixedDiv() when necessary. Who'da thunk it would actually work? --- src/lua_hudlib.c | 5 +++ src/v_video.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++ src/v_video.h | 2 + 3 files changed, 109 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index f890f62c0..935a41b43 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -122,6 +122,7 @@ enum align { align_smallcenter, align_smallright, align_smallthin, + align_smallthinfixed, align_thin, align_thinfixed, align_thinfixedcenter, @@ -143,6 +144,7 @@ static const char *const align_opt[] = { "small-center", "small-right", "small-thin", + "small-thin-fixed", "thin", "thin-fixed", "thin-fixed-center", @@ -779,6 +781,9 @@ static int libd_drawString(lua_State *L) case align_smallthin: V_DrawSmallThinString(x, y, flags, str); break; + case align_smallthinfixed: + V_DrawSmallThinStringAtFixed(x, y, flags, str); + break; // tny_font case align_thin: V_DrawThinString(x, y, flags, str); diff --git a/src/v_video.c b/src/v_video.c index a4c1bf6ba..3e64c7748 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2872,6 +2872,108 @@ void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, con V_DrawThinStringAtFixed(x, y, option, string); } +// Draws a small string at a fixed_t location. +void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + fixed_t cx = x, cy = y; + INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0; + const char *ch = string; + INT32 charflags = 0; + const UINT8 *colormap = NULL; + INT32 spacewidth = 2<= HU_FONTSIZE || !tny_font[c]) + { + cx += FixedMul(spacewidth, dupx); + continue; + } + + if (charwidth) + { + w = FixedMul(charwidth, dupx); + center = w/2 - SHORT(tny_font[c]->width)*(dupx/4); + } + else + w = SHORT(tny_font[c]->width) * dupx / 2; + + if (cx > scrwidth) + break; + if (cx+left + w < 0) //left boundary check + { + cx += w; + continue; + } + + colormap = V_GetStringColormap(charflags); + + V_DrawFixedPatch(cx + center, cy, FRACUNIT/2, option, tny_font[c], colormap); + + cx += w; + } +} + // Draws a tallnum. Replaces two functions in y_inter and st_stuff void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num) { diff --git a/src/v_video.h b/src/v_video.h index 33328de8c..f1e33e154 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -231,6 +231,8 @@ void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *str void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); +void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); + // Draw tall nums, used for menu, HUD, intermission void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num); void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits); From c858d9fd4dffccb1c7f79b4add4b3103e870b4ac Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sat, 28 Sep 2019 13:01:58 -0500 Subject: [PATCH 072/139] Make V_DrawSmallThinString() a less precise wrapper for V_DrawSmallThinStringAtFixed() to fix rounding errors. --- src/v_video.c | 104 ++------------------------------------------------ 1 file changed, 4 insertions(+), 100 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index 3e64c7748..2333631fb 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2427,108 +2427,12 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st // Write a string using the tny_font, 0.5x scale // NOTE: the text is centered for screens larger than the base width // +// Literally a wrapper. ~Golden void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) { - INT32 w, c, cx = x, cy = y, dupx, dupy, scrwidth, center = 0, left = 0; - const char *ch = string; - INT32 charflags = 0; - const UINT8 *colormap = NULL; - INT32 spacewidth = 2, charwidth = 0; - - INT32 lowercase = (option & V_ALLOWLOWERCASE); - option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE... - - if (option & V_NOSCALESTART) - { - dupx = vid.dupx; - dupy = vid.dupy; - scrwidth = vid.width; - } - else - { - dupx = dupy = 1; - scrwidth = vid.width/vid.dupx; - left = (scrwidth - BASEVIDWIDTH)/2; - scrwidth -= left; - } - - charflags = (option & V_CHARCOLORMASK); - - // Monospace only + spacing changes, otherwise the characters are squished together. ~Golden - switch (option & V_SPACINGMASK) - { - case V_MONOSPACE: - spacewidth = 3; - /* FALLTHRU */ - case V_OLDSPACING: - charwidth = 3; - break; - case V_6WIDTHSPACE: - spacewidth = 2; - charwidth = 3; - break; - default: - spacewidth = 3; - charwidth = 3; - break; - } - - for (;;ch++) - { - if (!*ch) - break; - if (*ch & 0x80) //color parsing -x 2.16.09 - { - // manually set flags override color codes - if (!(option & V_CHARCOLORMASK)) - charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK; - continue; - } - if (*ch == '\n') - { - cx = x; - - if (option & V_RETURN8) - cy += 4*dupy; - else - cy += 6*dupy; - - continue; - } - - c = *ch; - if (!lowercase) - c = toupper(c); - c -= HU_FONTSTART; - - // character does not exist or is a space - if (c < 0 || c >= HU_FONTSIZE || !tny_font[c]) - { - cx += spacewidth * dupx; - continue; - } - - if (charwidth) - { - w = charwidth * dupx; - center = w/2 - SHORT(tny_font[c]->width)*dupx/4; - } - else - w = SHORT(tny_font[c]->width) * dupx / 2; - - if (cx > scrwidth) - break; - if (cx+left + w < 0) //left boundary check - { - cx += w; - continue; - } - - colormap = V_GetStringColormap(charflags); - V_DrawFixedPatch((cx + center)< Date: Tue, 8 Oct 2019 21:54:18 -0500 Subject: [PATCH 073/139] Create V_DrawRightAlignedSmallThinStringAtFixed() for new "small-thin-fixed-right" option in v.drawString() You guys have no idea how long this took to code. --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 22 ++++++++++++++++++++++ src/v_video.h | 4 ++++ 3 files changed, 31 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 935a41b43..e5c384949 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -123,6 +123,7 @@ enum align { align_smallright, align_smallthin, align_smallthinfixed, + align_smallthinfixedright, align_thin, align_thinfixed, align_thinfixedcenter, @@ -145,6 +146,7 @@ static const char *const align_opt[] = { "small-right", "small-thin", "small-thin-fixed", + "small-thin-fixed-right", "thin", "thin-fixed", "thin-fixed-center", @@ -784,6 +786,9 @@ static int libd_drawString(lua_State *L) case align_smallthinfixed: V_DrawSmallThinStringAtFixed(x, y, flags, str); break; + case align_smallthinfixedright: + V_DrawRightAlignedSmallThinStringAtFixed(x, y, flags, str); + break; // tny_font case align_thin: V_DrawThinString(x, y, flags, str); diff --git a/src/v_video.c b/src/v_video.c index 2333631fb..a90735927 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2435,6 +2435,13 @@ void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) V_DrawSmallThinStringAtFixed((fixed_t)x, (fixed_t)y, option, string); } +/*void V_DrawRightAlignedSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) +{ + x <<= FRACBITS; + y <<= FRACBITS; + V_DrawRightAlignedSmallThinStringAtFixed((fixed_t)x, (fixed_t)y, option, string); +}*/ + // Draws a string at a fixed_t location. void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) { @@ -2878,6 +2885,12 @@ void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char } } +void V_DrawRightAlignedSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= V_SmallThinStringWidth(string, option)/2; + V_DrawSmallThinStringAtFixed(x, y, option, string); +} + // Draws a tallnum. Replaces two functions in y_inter and st_stuff void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num) { @@ -3435,6 +3448,15 @@ INT32 V_ThinStringWidth(const char *string, INT32 option) return w; } +// +// Find string width from tny_font chars, 0.5x scale +// +INT32 V_SmallThinStringWidth(const char *string, INT32 option) +{ + INT32 w = V_ThinStringWidth(string, option)< Date: Tue, 8 Oct 2019 22:03:43 -0500 Subject: [PATCH 074/139] Create V_DrawCenteredSmallThinStringAtFixed() for new "small-thin-fixed-center" option in v.drawString() Thankfully "center" is just "right" but with the X offset divided by 2. --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 6 ++++++ src/v_video.h | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index e5c384949..60d4d1c21 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -123,6 +123,7 @@ enum align { align_smallright, align_smallthin, align_smallthinfixed, + align_smallthinfixedcenter, align_smallthinfixedright, align_thin, align_thinfixed, @@ -146,6 +147,7 @@ static const char *const align_opt[] = { "small-right", "small-thin", "small-thin-fixed", + "small-thin-fixed-center", "small-thin-fixed-right", "thin", "thin-fixed", @@ -786,6 +788,9 @@ static int libd_drawString(lua_State *L) case align_smallthinfixed: V_DrawSmallThinStringAtFixed(x, y, flags, str); break; + case align_smallthinfixedcenter: + V_DrawCenteredSmallThinStringAtFixed(x, y, flags, str); + break; case align_smallthinfixedright: V_DrawRightAlignedSmallThinStringAtFixed(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index a90735927..cdacd8127 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2885,6 +2885,12 @@ void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char } } +void V_DrawCenteredSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= V_SmallThinStringWidth(string, option)/4; + V_DrawSmallThinStringAtFixed(x, y, option, string); +} + void V_DrawRightAlignedSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) { x -= V_SmallThinStringWidth(string, option)/2; diff --git a/src/v_video.h b/src/v_video.h index 5b038419f..9c7d67b11 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -233,7 +233,8 @@ void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, con // draw a string using the tny_font at fixed_t coordinates, 0.5x scale void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); -void V_DrawRightAlignedSmallThinStringAtFixed(INT32 x, INT32 y, INT32 option, const char *string); +void V_DrawCenteredSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); +void V_DrawRightAlignedSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); // Draw tall nums, used for menu, HUD, intermission void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num); From 7d9f1381601ba303ae8ebf53008893ac2d7de6c2 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Tue, 8 Oct 2019 22:11:40 -0500 Subject: [PATCH 075/139] Make V_DrawRightAlignedSmallThinString() a less precise wrapper for V_DrawRightAlignedSmallThinStringAtFixed() for new "small-thin-right" option in v.drawString() --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 4 ++-- src/v_video.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 60d4d1c21..5c2cd6e32 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -122,6 +122,7 @@ enum align { align_smallcenter, align_smallright, align_smallthin, + align_smallthinright, align_smallthinfixed, align_smallthinfixedcenter, align_smallthinfixedright, @@ -146,6 +147,7 @@ static const char *const align_opt[] = { "small-center", "small-right", "small-thin", + "small-thin-right", "small-thin-fixed", "small-thin-fixed-center", "small-thin-fixed-right", @@ -785,6 +787,9 @@ static int libd_drawString(lua_State *L) case align_smallthin: V_DrawSmallThinString(x, y, flags, str); break; + case align_smallthinright: + V_DrawRightAlignedSmallThinString(x, y, flags, str); + break; case align_smallthinfixed: V_DrawSmallThinStringAtFixed(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index cdacd8127..e7cf845d8 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2435,12 +2435,12 @@ void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) V_DrawSmallThinStringAtFixed((fixed_t)x, (fixed_t)y, option, string); } -/*void V_DrawRightAlignedSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) +void V_DrawRightAlignedSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) { x <<= FRACBITS; y <<= FRACBITS; V_DrawRightAlignedSmallThinStringAtFixed((fixed_t)x, (fixed_t)y, option, string); -}*/ +} // Draws a string at a fixed_t location. void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) diff --git a/src/v_video.h b/src/v_video.h index 9c7d67b11..169687183 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -215,6 +215,7 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st // draw a string using the tny_font, 0.5x scale void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *string); +void V_DrawRightAlignedSmallThinString(INT32 x, INT32 y, INT32 option, const char *string); // draw a string using the hu_font at fixed_t coordinates void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); From fe179331560aab088385bcb7c22b025226aaec29 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Tue, 8 Oct 2019 22:16:50 -0500 Subject: [PATCH 076/139] Make V_DrawCenteredSmallThinString() a less precise wrapper for V_DrawCenteredSmallThinStringAtFixed() for new "small-thin-center" option in v.drawString() --- src/lua_hudlib.c | 5 +++++ src/v_video.c | 7 +++++++ src/v_video.h | 1 + 3 files changed, 13 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 5c2cd6e32..d15fe2cea 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -122,6 +122,7 @@ enum align { align_smallcenter, align_smallright, align_smallthin, + align_smallthincenter, align_smallthinright, align_smallthinfixed, align_smallthinfixedcenter, @@ -147,6 +148,7 @@ static const char *const align_opt[] = { "small-center", "small-right", "small-thin", + "small-thin-center", "small-thin-right", "small-thin-fixed", "small-thin-fixed-center", @@ -787,6 +789,9 @@ static int libd_drawString(lua_State *L) case align_smallthin: V_DrawSmallThinString(x, y, flags, str); break; + case align_smallthincenter: + V_DrawCenteredSmallThinString(x, y, flags, str); + break; case align_smallthinright: V_DrawRightAlignedSmallThinString(x, y, flags, str); break; diff --git a/src/v_video.c b/src/v_video.c index e7cf845d8..8a4a3a030 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2435,6 +2435,13 @@ void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) V_DrawSmallThinStringAtFixed((fixed_t)x, (fixed_t)y, option, string); } +void V_DrawCenteredSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) +{ + x <<= FRACBITS; + y <<= FRACBITS; + V_DrawCenteredSmallThinStringAtFixed((fixed_t)x, (fixed_t)y, option, string); +} + void V_DrawRightAlignedSmallThinString(INT32 x, INT32 y, INT32 option, const char *string) { x <<= FRACBITS; diff --git a/src/v_video.h b/src/v_video.h index 169687183..1e7af29d2 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -215,6 +215,7 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st // draw a string using the tny_font, 0.5x scale void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *string); +void V_DrawCenteredSmallThinString(INT32 x, INT32 y, INT32 option, const char *string); void V_DrawRightAlignedSmallThinString(INT32 x, INT32 y, INT32 option, const char *string); // draw a string using the hu_font at fixed_t coordinates From 7dd0f2b80847e4ca794457c38c52082628b20664 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Sat, 1 Feb 2020 20:19:39 +0100 Subject: [PATCH 077/139] 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 078/139] 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 079/139] 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 080/139] 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 57492347ed080821711b52d31580298edf56d3ad Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 1 Feb 2020 19:32:08 -0800 Subject: [PATCH 081/139] Don't I_Error on startup files only if a file was added twice --- src/d_main.c | 7 +------ src/p_setup.c | 3 +-- src/w_wad.c | 40 +++++++++++++++++++++++----------------- src/w_wad.h | 7 +++---- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 32972c151..5128e0cdf 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1205,12 +1205,7 @@ void D_SRB2Main(void) // load wad, including the main wad file CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n"); - if (!W_InitMultipleFiles(startupwadfiles, mainwads)) -#ifdef _DEBUG - CONS_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n"); -#else - I_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n"); -#endif + W_InitMultipleFiles(startupwadfiles, mainwads); D_CleanFile(); #ifndef DEVELOP // md5s last updated 06/12/19 (ddmmyy) diff --git a/src/p_setup.c b/src/p_setup.c index 132684163..d7a75c3e0 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3393,10 +3393,9 @@ boolean P_AddWadFile(const char *wadfilename) // UINT16 mapPos, mapNum = 0; // Init file. - if ((numlumps = W_InitFile(wadfilename, false)) == INT16_MAX) + if ((numlumps = W_InitFile(wadfilename, false, false)) == INT16_MAX) { refreshdirmenu |= REFRESHDIR_NOTLOADED; - CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename); return false; } else diff --git a/src/w_wad.c b/src/w_wad.c index cfd2db50e..a2d8696cf 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -637,6 +637,21 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) return lumpinfo; } +static UINT16 W_InitFileError (const char *filename, boolean exitworthy) +{ + if (exitworthy) + { +#ifdef _DEBUG + CONS_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n"); +#else + I_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n"); +#endif + } + else + CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), filename); + return INT16_MAX; +} + // Allocate a wadfile, setup the lumpinfo (directory) and // lumpcache, add the wadfile to the current active wadfiles // @@ -648,7 +663,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) // // Can now load dehacked files (.soc) // -UINT16 W_InitFile(const char *filename, boolean mainfile) +UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup) { FILE *handle; lumpinfo_t *lumpinfo = NULL; @@ -681,12 +696,12 @@ UINT16 W_InitFile(const char *filename, boolean mainfile) { CONS_Alert(CONS_ERROR, M_GetText("Maximum wad files reached\n")); refreshdirmenu |= REFRESHDIR_MAX; - return INT16_MAX; + return W_InitFileError(filename, startup); } // open wad file if ((handle = W_OpenWadFile(&filename, true)) == NULL) - return INT16_MAX; + return W_InitFileError(filename, startup); // Check if wad files will overflow fileneededbuffer. Only the filename part // is send in the packet; cf. @@ -701,7 +716,7 @@ UINT16 W_InitFile(const char *filename, boolean mainfile) refreshdirmenu |= REFRESHDIR_MAX; if (handle) fclose(handle); - return INT16_MAX; + return W_InitFileError(filename, startup); } packetsizetally = packetsize; @@ -722,7 +737,7 @@ UINT16 W_InitFile(const char *filename, boolean mainfile) CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename); if (handle) fclose(handle); - return INT16_MAX; + return W_InitFileError(filename, false); } } #endif @@ -750,7 +765,7 @@ UINT16 W_InitFile(const char *filename, boolean mainfile) if (lumpinfo == NULL) { fclose(handle); - return INT16_MAX; + return W_InitFileError(filename, startup); } // @@ -822,10 +837,8 @@ 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 base files were loaded, 0 if at least one was missing or - * invalid. */ -INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles) +void W_InitMultipleFiles(char **filenames, UINT16 mainfiles) { // open all the files, load headers, and count lumps numwadfiles = 0; @@ -834,15 +847,8 @@ INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles) for (; *filenames; filenames++) { //CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames); - 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; - } + W_InitFile(*filenames, numwadfiles < mainfiles, true); } - - return 1; } /** Make sure a lump number is valid. diff --git a/src/w_wad.h b/src/w_wad.h index 0a0da7681..eaab6f74b 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -127,11 +127,10 @@ void W_Shutdown(void); // Opens a WAD file. Returns the FILE * handle for the file, or NULL if not found or could not be opened FILE *W_OpenWadFile(const char **filename, boolean useerrors); // Load and add a wadfile to the active wad files, returns numbers of lumps, INT16_MAX on error -UINT16 W_InitFile(const char *filename, boolean mainfile); +UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup); -// W_InitMultipleFiles returns 1 if all is okay, 0 otherwise, -// so that it stops with a message if a file was not found, but not if all is okay. -INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles); +// W_InitMultipleFiles exits if a file was not found, but not if all is okay. +void W_InitMultipleFiles(char **filenames, UINT16 mainfiles); const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump); const char *W_CheckNameForNum(lumpnum_t lumpnum); From 17949496964e850128a562d0dc57b5f484b87556 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 2 Feb 2020 18:52:41 -0500 Subject: [PATCH 082/139] 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 083/139] 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 af66a2e5fabe616142c84fab0d35bbab40d9451c Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 3 Feb 2020 02:12:55 -0300 Subject: [PATCH 084/139] Restore some functionality that went missing --- src/m_menu.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index d4ac61eb0..507d768cc 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -320,6 +320,7 @@ menu_t OP_DataOptionsDef, OP_ScreenshotOptionsDef, OP_EraseDataDef; menu_t OP_ServerOptionsDef; menu_t OP_MonitorToggleDef; static void M_ScreenshotOptions(INT32 choice); +static void M_SetupScreenshotMenu(void); static void M_EraseData(INT32 choice); static void M_Addons(INT32 choice); @@ -358,7 +359,6 @@ static void M_DrawMonitorToggles(void); static void M_OGL_DrawFogMenu(void); #endif #ifndef NONET -static void M_DrawScreenshotMenu(void); static void M_DrawConnectMenu(void); static void M_DrawMPMainMenu(void); static void M_DrawRoomMenu(void); @@ -1454,6 +1454,7 @@ static menuitem_t OP_ScreenshotOptionsMenu[] = enum { op_screenshot_colorprofile = 1, + op_screenshot_storagelocation = 3, op_screenshot_folder = 4, op_movie_folder = 11, op_screenshot_capture = 12, @@ -3673,6 +3674,9 @@ void M_Ticker(void) if (--vidm_testingmode == 0) setmodeneeded = vidm_previousmode + 1; } + + if (currentMenu == &OP_ScreenshotOptionsDef) + M_SetupScreenshotMenu(); } // @@ -11090,9 +11094,27 @@ static void M_ScreenshotOptions(INT32 choice) Screenshot_option_Onchange(); Moviemode_mode_Onchange(); + M_SetupScreenshotMenu(); M_SetupNextMenu(&OP_ScreenshotOptionsDef); } +static void M_SetupScreenshotMenu(void) +{ + menuitem_t *item = &OP_ScreenshotOptionsMenu[op_screenshot_colorprofile]; + +#ifdef HWRENDER + // Hide some options based on render mode + if (rendermode == render_opengl) + { + item->status = IT_GRAYEDOUT; + if ((currentMenu == &OP_ScreenshotOptionsDef) && (itemOn == op_screenshot_colorprofile)) // Can't select that + itemOn = op_screenshot_storagelocation; + } + else +#endif + item->status = (IT_STRING | IT_CVAR); +} + // ============= // JOYSTICK MENU // ============= @@ -11953,6 +11975,15 @@ static void M_HandleVideoMode(INT32 ch) static void M_DrawScreenshotMenu(void) { M_DrawGenericScrollMenu(); +#ifdef HWRENDER + if ((rendermode == render_opengl) && (itemOn < 7)) // where it starts to go offscreen; change this number if you change the layout of the screenshot menu + { + INT32 y = currentMenu->y+currentMenu->menuitems[op_screenshot_colorprofile].alphaKey*2; + if (itemOn == 6) + y -= 10; + V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, y, V_REDMAP, "Yes"); + } +#endif } // =============== From d1e8744583b9a868665b4b3a5e4803a29829f7a0 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 3 Feb 2020 02:24:22 -0300 Subject: [PATCH 085/139] What --- src/m_anigif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_anigif.c b/src/m_anigif.c index 5394f569a..faa8f29e1 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -537,7 +537,7 @@ static void GIF_framewrite(void) // Lactozilla: Compare the header's palette with the current frame's palette and see if it changed. if (gif_localcolortable) { - gif_framepalette = GIF_getpalette(gif_localcolortable ? max(st_palette, 0) : 0); + gif_framepalette = GIF_getpalette(max(st_palette, 0)); palchanged = memcmp(gif_headerpalette, gif_framepalette, sizeof(RGBA_t) * 256); } else From 01433c3648955308c42fef563d97c870d747fda6 Mon Sep 17 00:00:00 2001 From: colette Date: Mon, 3 Feb 2020 23:09:18 -0500 Subject: [PATCH 086/139] 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 087/139] 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 088/139] 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 089/139] 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 fed8167a813c28f24caa963fe9b9e11715d7be8e Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 8 Feb 2020 11:13:20 -0600 Subject: [PATCH 090/139] Allow more options for when the titlecard shows up --- src/dehacked.c | 21 +++++++++++++++++++++ src/doomstat.h | 22 +++++++++++++--------- src/f_wipe.c | 3 +-- src/g_game.c | 13 ++++++++++++- 4 files changed, 47 insertions(+), 12 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 45f00b8cf..5f35864e2 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1831,6 +1831,24 @@ static void readlevelheader(MYFILE *f, INT32 num) else mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARD; } + else if (fastcmp(word, "SHOWTITLECARDFOR")) + { + mapheaderinfo[num-1]->levelflags |= LF_NOTITLECARD; + tmp = strtok(word2,","); + do { + if (fastcmp(tmp, "FIRST")) + mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARDFIRST; + else if (fastcmp(tmp, "RESPAWN")) + mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARDRESPAWN; + else if (fastcmp(tmp, "RECORDATTACK")) + mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARDRECORDATTACK; + else if (fastcmp(tmp, "ALL")) + mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARD; + else + deh_warning("Level header %d: unknown titlecard show option %s\n", num, tmp); + + } while((tmp = strtok(NULL,",")) != NULL); + } // Individual triggers for menu flags else if (fastcmp(word, "HIDDEN")) @@ -9372,6 +9390,9 @@ struct { {"LF_NOZONE",LF_NOZONE}, {"LF_SAVEGAME",LF_SAVEGAME}, {"LF_MIXNIGHTSCOUNTDOWN",LF_MIXNIGHTSCOUNTDOWN}, + {"LF_NOTITLECARDFIRST",LF_NOTITLECARDFIRST}, + {"LF_NOTITLECARDRESPAWN",LF_NOTITLECARDRESPAWN}, + {"LF_NOTITLECARDRECORDATTACK",LF_NOTITLECARDRECORDATTACK}, {"LF_NOTITLECARD",LF_NOTITLECARD}, {"LF_WARNINGTITLE",LF_WARNINGTITLE}, // And map flags diff --git a/src/doomstat.h b/src/doomstat.h index c7c12632a..ea4efaede 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -351,15 +351,19 @@ typedef struct } mapheader_t; // level flags -#define LF_SCRIPTISFILE 1 ///< True if the script is a file, not a lump. -#define LF_SPEEDMUSIC 2 ///< Speed up act music for super sneakers -#define LF_NOSSMUSIC 4 ///< Disable Super Sonic music -#define LF_NORELOAD 8 ///< Don't reload level on death -#define LF_NOZONE 16 ///< Don't include "ZONE" on level title -#define LF_SAVEGAME 32 ///< Save the game upon loading this level -#define LF_MIXNIGHTSCOUNTDOWN 64 ///< Play sfx_timeup instead of music change for NiGHTS countdown -#define LF_WARNINGTITLE 128 ///< WARNING! WARNING! WARNING! WARNING! -#define LF_NOTITLECARD 256 ///< Don't start the title card +#define LF_SCRIPTISFILE 1<<0 ///< True if the script is a file, not a lump. +#define LF_SPEEDMUSIC 1<<1 ///< Speed up act music for super sneakers +#define LF_NOSSMUSIC 1<<2 ///< Disable Super Sonic music +#define LF_NORELOAD 1<<3 ///< Don't reload level on death +#define LF_NOZONE 1<<4 ///< Don't include "ZONE" on level title +#define LF_SAVEGAME 1<<5 ///< Save the game upon loading this level +#define LF_MIXNIGHTSCOUNTDOWN 1<<6 ///< Play sfx_timeup instead of music change for NiGHTS countdown +#define LF_WARNINGTITLE 1<<7 ///< WARNING! WARNING! WARNING! WARNING! + +#define LF_NOTITLECARDFIRST 1<<8 +#define LF_NOTITLECARDRESPAWN 1<<9 +#define LF_NOTITLECARDRECORDATTACK 1<<10 +#define LF_NOTITLECARD (LF_NOTITLECARDFIRST|LF_NOTITLECARDRESPAWN|LF_NOTITLECARDRECORDATTACK) ///< Don't start the title card at all #define LF2_HIDEINMENU 1 ///< Hide in the multiplayer menu #define LF2_HIDEINSTATS 2 ///< Hide in the statistics screen diff --git a/src/f_wipe.c b/src/f_wipe.c index a350e0f36..f8b24d387 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -192,8 +192,7 @@ void F_WipeStageTitle(void) // draw level title if ((WipeStageTitle && st_overlay) && (wipestyle == WIPESTYLE_COLORMAP) - && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD) - && *mapheaderinfo[gamemap-1]->lvlttl != '\0') + && G_IsTitleCardAvailable()) { ST_runTitleCard(); ST_drawWipeTitleCard(); diff --git a/src/g_game.c b/src/g_game.c index 8383782cb..e0bb5179c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1928,13 +1928,22 @@ void G_PreLevelTitleCard(void) wipestyleflags = WSF_CROSSFADE; } +static boolean titlecardforreload = false; + // // Returns true if the current level has a title card. // boolean G_IsTitleCardAvailable(void) { // The current level header explicitly disabled the title card. - if (mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD) + UINT16 titleflag = LF_NOTITLECARDFIRST; + + if (modeattacking) + titleflag = LF_NOTITLECARDRECORDATTACK; + else if (titlecardforreload) + titleflag = LF_NOTITLECARDRESPAWN; + + if (mapheaderinfo[gamemap-1]->levelflags & titleflag) return false; // The current gametype doesn't have a title card. @@ -3024,7 +3033,9 @@ void G_DoReborn(INT32 playernum) #ifdef HAVE_BLUA LUAh_MapChange(gamemap); #endif + titlecardforreload = true; G_DoLoadLevel(true); + titlecardforreload = false; if (metalrecording) G_BeginMetal(); return; From 5e516eb98d5f1ddff1afcb2bb9247349d244d533 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 8 Feb 2020 18:50:05 -0300 Subject: [PATCH 091/139] 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 20:29:28 -0300 Subject: [PATCH 092/139] allow models for skin/sprites with same name --- src/hardware/hw_md2.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index d1d6e91a2..50c169815 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -521,15 +521,10 @@ void HWR_InitModels(void) { if (stricmp(name, sprnames[i]) == 0) { - //if (stricmp(name, "PLAY") == 0) - //continue; - - //CONS_Debug(DBG_RENDER, " Found: %s %s %f %f\n", name, filename, scale, offset); md2_models[i].scale = scale; md2_models[i].offset = offset; md2_models[i].notfound = false; strcpy(md2_models[i].filename, filename); - goto md2found; } } @@ -537,18 +532,14 @@ void HWR_InitModels(void) { if (stricmp(name, skins[s].name) == 0) { - //CONS_Printf(" Found: %s %s %f %f\n", name, filename, scale, offset); md2_playermodels[s].skin = s; md2_playermodels[s].scale = scale; md2_playermodels[s].offset = offset; md2_playermodels[s].notfound = false; strcpy(md2_playermodels[s].filename, filename); - goto md2found; } } - // no sprite/player skin name found?!? - //CONS_Printf("Unknown sprite/player skin %s detected in models.dat\n", name); -md2found: + // move on to next line... continue; } @@ -591,7 +582,6 @@ void HWR_AddPlayerModel(int skin) // For skins that were added after startup } } - //CONS_Printf("Model for player skin %s not found\n", skins[skin].name); md2_playermodels[skin].notfound = true; playermd2found: fclose(f); @@ -635,7 +625,6 @@ void HWR_AddSpriteModel(size_t spritenum) // For sprites that were added after s } } - //CONS_Printf("MD2 for sprite %s not found\n", sprnames[spritenum]); md2_models[spritenum].notfound = true; spritemd2found: fclose(f); From 2d0e72d756213f4bdf942a668029a2652e8827cc Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 8 Feb 2020 21:40:30 -0300 Subject: [PATCH 093/139] 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 094/139] 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 d0d7fd15899b28734309ce37e9091e5561a7abf5 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sun, 9 Feb 2020 16:11:52 -0300 Subject: [PATCH 095/139] Don't add a TOL_ twice. --- src/dehacked.c | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 45f00b8cf..1c4be1d03 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -585,17 +585,26 @@ static void readfreeslots(MYFILE *f) continue; // Copy in the spr2 name and increment free_spr2. if (free_spr2 < NUMPLAYERSPRITES) { - CONS_Printf("Sprite SPR2_%s allocated.\n",word); strncpy(spr2names[free_spr2],word,4); spr2defaults[free_spr2] = 0; spr2names[free_spr2++][4] = 0; } else - CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n"); + deh_warning("Ran out of free SPR2 slots!\n"); } else if (fastcmp(type, "TOL")) { - if (lastcustomtol > 31) - CONS_Alert(CONS_WARNING, "Ran out of free typeoflevel slots!\n"); + // Search if we already have a typeoflevel by that name... + for (i = 0; i < numtolinfo; i++) + if (fastcmp(word, TYPEOFLEVEL[i].name)) + break; + + // We found it? Then don't allocate another one. + if (i < numtolinfo) + continue; + + // We don't, so freeslot it. + if (lastcustomtol > 31) // Unless you have way too many, since they're flags. + deh_warning("Ran out of free typeoflevel slots!\n"); else { G_AddTOL((1< 31) - CONS_Alert(CONS_WARNING, "Ran out of free typeoflevel slots!\n"); - else - { - UINT32 newtol = (1<= numtolinfo) { + if (lastcustomtol > 31) // Unless you have way too many, since they're flags. + CONS_Alert(CONS_WARNING, "Ran out of free typeoflevel slots!\n"); + else { + UINT32 newtol = (1< Date: Sun, 9 Feb 2020 19:15:04 +0000 Subject: [PATCH 096/139] 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 19cdb002aba11d24d7fe57dd290d7cd254b0c945 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 9 Feb 2020 17:53:13 -0600 Subject: [PATCH 097/139] More fixes for titlecard option stuff --- src/doomstat.h | 22 +++++++++++----------- src/g_game.c | 2 +- src/st_stuff.c | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/doomstat.h b/src/doomstat.h index ea4efaede..1a46e9b4c 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -351,18 +351,18 @@ typedef struct } mapheader_t; // level flags -#define LF_SCRIPTISFILE 1<<0 ///< True if the script is a file, not a lump. -#define LF_SPEEDMUSIC 1<<1 ///< Speed up act music for super sneakers -#define LF_NOSSMUSIC 1<<2 ///< Disable Super Sonic music -#define LF_NORELOAD 1<<3 ///< Don't reload level on death -#define LF_NOZONE 1<<4 ///< Don't include "ZONE" on level title -#define LF_SAVEGAME 1<<5 ///< Save the game upon loading this level -#define LF_MIXNIGHTSCOUNTDOWN 1<<6 ///< Play sfx_timeup instead of music change for NiGHTS countdown -#define LF_WARNINGTITLE 1<<7 ///< WARNING! WARNING! WARNING! WARNING! +#define LF_SCRIPTISFILE (1<<0) ///< True if the script is a file, not a lump. +#define LF_SPEEDMUSIC (1<<1) ///< Speed up act music for super sneakers +#define LF_NOSSMUSIC (1<<2) ///< Disable Super Sonic music +#define LF_NORELOAD (1<<3) ///< Don't reload level on death +#define LF_NOZONE (1<<4) ///< Don't include "ZONE" on level title +#define LF_SAVEGAME (1<<5) ///< Save the game upon loading this level +#define LF_MIXNIGHTSCOUNTDOWN (1<<6) ///< Play sfx_timeup instead of music change for NiGHTS countdown +#define LF_WARNINGTITLE (1<<7) ///< WARNING! WARNING! WARNING! WARNING! -#define LF_NOTITLECARDFIRST 1<<8 -#define LF_NOTITLECARDRESPAWN 1<<9 -#define LF_NOTITLECARDRECORDATTACK 1<<10 +#define LF_NOTITLECARDFIRST (1<<8) +#define LF_NOTITLECARDRESPAWN (1<<9) +#define LF_NOTITLECARDRECORDATTACK (1<<10) #define LF_NOTITLECARD (LF_NOTITLECARDFIRST|LF_NOTITLECARDRESPAWN|LF_NOTITLECARDRECORDATTACK) ///< Don't start the title card at all #define LF2_HIDEINMENU 1 ///< Hide in the multiplayer menu diff --git a/src/g_game.c b/src/g_game.c index e0bb5179c..e7a5e9279 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1938,7 +1938,7 @@ boolean G_IsTitleCardAvailable(void) // The current level header explicitly disabled the title card. UINT16 titleflag = LF_NOTITLECARDFIRST; - if (modeattacking) + if (modeattacking != ATTACKING_NONE) titleflag = LF_NOTITLECARDRECORDATTACK; else if (titlecardforreload) titleflag = LF_NOTITLECARDRESPAWN; diff --git a/src/st_stuff.c b/src/st_stuff.c index d99d564c8..3a140e4ee 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2625,7 +2625,7 @@ static void ST_overlayDrawer(void) // Check for a valid level title // If the HUD is enabled // And, if Lua is running, if the HUD library has the stage title enabled - if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD) && *mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer))) + if (G_IsTitleCardAvailable() && *mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer))) { stagetitle = true; ST_preDrawTitleCard(); From 4281de3b89e4ace77bff9dca003feb26d9e4dbc5 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 9 Feb 2020 21:29:46 -0500 Subject: [PATCH 098/139] 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 021ca92019f6b7d1be29eaf171b5b11bb14eb9c5 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 9 Feb 2020 17:53:30 -0600 Subject: [PATCH 099/139] Expose stoppedclock to Lua --- src/lua_script.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lua_script.c b/src/lua_script.c index 2538fb711..eb6c54ae0 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -102,6 +102,9 @@ int LUA_PushGlobals(lua_State *L, const char *word) } else if (fastcmp(word,"circuitmap")) { lua_pushboolean(L, circuitmap); return 1; + } else if (fastcmp(word,"stoppedclock")) { + lua_pushboolean(L, stoppedclock); + return 1; } else if (fastcmp(word,"netgame")) { lua_pushboolean(L, netgame); return 1; From a63e9fe00247de03fe466cf510cdfc54d62d7de6 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Mon, 10 Feb 2020 00:06:16 -0600 Subject: [PATCH 100/139] 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 76b397bece00e0eb318b2c99888a10fc35984013 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Mon, 10 Feb 2020 01:00:37 -0600 Subject: [PATCH 101/139] Get rotated sprites with v.getSprite(2)Patch NOTE: since rotated sprites are offset upward by 4px from non-rotated sprites, these functions will now return a third boolean (true) if a rotated sprite was returned, so that scripters can offset accordingly. --- src/lua_hudlib.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index f451944e3..9138ae1f8 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -424,7 +424,7 @@ static int libd_cachePatch(lua_State *L) return 1; } -// v.getSpritePatch(sprite, [frame, [angle]]) +// v.getSpritePatch(sprite, [frame, [angle, [rollangle]]]) static int libd_getSpritePatch(lua_State *L) { UINT32 i; // sprite prefix @@ -475,13 +475,31 @@ static int libd_getSpritePatch(lua_State *L) if (angle >= ((sprframe->rotate & SRF_3DGE) ? 16 : 8)) // out of range? return 0; +#ifdef ROTSPRITE + if (lua_isnumber(L, 4)) + { + // rotsprite????? + angle_t rollangle = luaL_checkangle(L, 4); + INT32 rot = R_GetRollAngle(rollangle); + + if (rot) { + if (!(sprframe->rotsprite.cached & (1<flip & (1<rotsprite.patch[angle][rot], META_PATCH); + lua_pushboolean(L, false); + lua_pushboolean(L, true); + return 3; + } + } +#endif + // push both the patch and it's "flip" value LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_PATCH), META_PATCH); lua_pushboolean(L, (sprframe->flip & (1<= ((sprframe->rotate & SRF_3DGE) ? 16 : 8)) // out of range? return 0; +#ifdef ROTSPRITE + if (lua_isnumber(L, 4)) + { + // rotsprite????? + angle_t rollangle = luaL_checkangle(L, 4); + INT32 rot = R_GetRollAngle(rollangle); + + if (rot) { + if (!(sprframe->rotsprite.cached & (1<flip & (1<rotsprite.patch[angle][rot], META_PATCH); + lua_pushboolean(L, false); + lua_pushboolean(L, true); + return 3; + } + } +#endif + // push both the patch and it's "flip" value LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_PATCH), META_PATCH); lua_pushboolean(L, (sprframe->flip & (1< Date: Tue, 11 Feb 2020 15:53:25 +0800 Subject: [PATCH 102/139] 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 103/139] 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 104/139] 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 105/139] 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 6b8195dbc175b978c5da6d6b7c7c34a48d3a3daf Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Tue, 11 Feb 2020 23:54:39 -0300 Subject: [PATCH 106/139] player model prefix --- src/hardware/hw_md2.c | 79 ++++++++++++++++++++++++++++++------------- src/hardware/hw_md2.h | 2 ++ 2 files changed, 57 insertions(+), 24 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 50c169815..33bed3e46 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -476,7 +476,7 @@ void HWR_InitModels(void) size_t i; INT32 s; FILE *f; - char name[18], filename[32]; + char name[22], filename[32]; float scale, offset; CONS_Printf("HWR_InitModels()...\n"); @@ -509,37 +509,51 @@ void HWR_InitModels(void) nomd2s = true; return; } - while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4) + + while (fscanf(f, "%23s %31s %f %f", name, filename, &scale, &offset) == 4) { - if (stricmp(name, "PLAY") == 0) + char *skinname = name; + size_t len = strlen(name); + + // check for the skin model prefix. + if (strnicmp(name, PLAYERMODELPREFIX, 4) == 0 && len > 4) { - CONS_Printf("Model for sprite PLAY detected in models.dat, use a player skin instead!\n"); - continue; + skinname += 4; + goto addskinmodel; } - for (i = 0; i < NUMSPRITES; i++) + // add sprite model + if (len == 4) // must be 4 characters long exactly. otherwise it's not a sprite name. { - if (stricmp(name, sprnames[i]) == 0) + for (i = 0; i < NUMSPRITES; i++) { - md2_models[i].scale = scale; - md2_models[i].offset = offset; - md2_models[i].notfound = false; - strcpy(md2_models[i].filename, filename); + if (stricmp(name, sprnames[i]) == 0) + { + md2_models[i].scale = scale; + md2_models[i].offset = offset; + md2_models[i].notfound = false; + strcpy(md2_models[i].filename, filename); + goto modelfound; + } } } +addskinmodel: + // add skin model for (s = 0; s < MAXSKINS; s++) { - if (stricmp(name, skins[s].name) == 0) + if (stricmp(skinname, skins[s].name) == 0) { md2_playermodels[s].skin = s; md2_playermodels[s].scale = scale; md2_playermodels[s].offset = offset; md2_playermodels[s].notfound = false; strcpy(md2_playermodels[s].filename, filename); + goto modelfound; } } +modelfound: // move on to next line... continue; } @@ -549,7 +563,7 @@ void HWR_InitModels(void) void HWR_AddPlayerModel(int skin) // For skins that were added after startup { FILE *f; - char name[18], filename[32]; + char name[22], filename[32]; float scale, offset; if (nomd2s) @@ -568,31 +582,37 @@ void HWR_AddPlayerModel(int skin) // For skins that were added after startup return; } - // Check for any model that match the names of player skins! - while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4) + // Check for any models that match the names of player skins! + while (fscanf(f, "%23s %31s %f %f", name, filename, &scale, &offset) == 4) { - if (stricmp(name, skins[skin].name) == 0) + // ignore the skin model prefix. + char *skinname = name; + if (!strnicmp(name, PLAYERMODELPREFIX, 4)) + skinname += 4; + + if (stricmp(skinname, skins[skin].name) == 0) { md2_playermodels[skin].skin = skin; md2_playermodels[skin].scale = scale; md2_playermodels[skin].offset = offset; md2_playermodels[skin].notfound = false; strcpy(md2_playermodels[skin].filename, filename); - goto playermd2found; + goto playermodelfound; } } md2_playermodels[skin].notfound = true; -playermd2found: +playermodelfound: fclose(f); } void HWR_AddSpriteModel(size_t spritenum) // For sprites that were added after startup { FILE *f; - // name[18] is used to check for names in the models.dat file that match with sprites or player skins + // name[22] is used to check for names in the models.dat file that match with sprites or player skins // sprite names are always 4 characters long, and names is for player skins can be up to 19 characters long - char name[18], filename[32]; + // PLAYERMODELPREFIX is 4 characters long + char name[22], filename[32]; float scale, offset; if (nomd2s) @@ -612,21 +632,32 @@ void HWR_AddSpriteModel(size_t spritenum) // For sprites that were added after s return; } - // Check for any MD2s that match the names of sprite names! - while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4) + // Check for any models that match the names of sprite names! + while (fscanf(f, "%23s %31s %f %f", name, filename, &scale, &offset) == 4) { + // length of the sprite name + size_t len = strlen(name); + + // check for the skin model prefix. + if (!strnicmp(name, PLAYERMODELPREFIX, 4)) + continue; // that's not a sprite... + + // must be 4 characters long exactly. otherwise it's not a sprite name. + if (len != 4) + continue; + if (stricmp(name, sprnames[spritenum]) == 0) { md2_models[spritenum].scale = scale; md2_models[spritenum].offset = offset; md2_models[spritenum].notfound = false; strcpy(md2_models[spritenum].filename, filename); - goto spritemd2found; + goto spritemodelfound; } } md2_models[spritenum].notfound = true; -spritemd2found: +spritemodelfound: fclose(f); } diff --git a/src/hardware/hw_md2.h b/src/hardware/hw_md2.h index 6f5985a44..40dbdf079 100644 --- a/src/hardware/hw_md2.h +++ b/src/hardware/hw_md2.h @@ -49,4 +49,6 @@ void HWR_AddPlayerModel(INT32 skin); void HWR_AddSpriteModel(size_t spritenum); boolean HWR_DrawModel(gr_vissprite_t *spr); +#define PLAYERMODELPREFIX "SKIN" + #endif // _HW_MD2_H_ From ae2041d68633e3d089c29b6f146669d3f97b738a Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 11 Feb 2020 19:36:09 -0800 Subject: [PATCH 107/139] 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 108/139] 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 109/139] 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 7bc58c4c0e569c552a8c82dd450d802b83fd711b Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Wed, 12 Feb 2020 13:41:30 -0300 Subject: [PATCH 110/139] Add MAXTOL --- src/dehacked.c | 56 +++++++++++--------------------------------------- src/doomstat.h | 9 ++++---- src/g_game.c | 42 +++++++++++++++++++++++++++++++------ 3 files changed, 53 insertions(+), 54 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 958eaad32..79d0b46dd 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -594,21 +594,21 @@ static void readfreeslots(MYFILE *f) else if (fastcmp(type, "TOL")) { // Search if we already have a typeoflevel by that name... - for (i = 0; i < numtolinfo; i++) + for (i = 0; TYPEOFLEVEL[i].name; i++) if (fastcmp(word, TYPEOFLEVEL[i].name)) break; // We found it? Then don't allocate another one. - if (i < numtolinfo) + if (TYPEOFLEVEL[i].name) continue; // We don't, so freeslot it. - if (lastcustomtol > 31) // Unless you have way too many, since they're flags. + if (lastcustomtol == MAXTOL) // Unless you have way too many, since they're flags. deh_warning("Ran out of free typeoflevel slots!\n"); else { - G_AddTOL((1<= numtolinfo) { - if (lastcustomtol > 31) // Unless you have way too many, since they're flags. + if (TYPEOFLEVEL[i].name == NULL) { + if (lastcustomtol == MAXTOL) // Unless you have way too many, since they're flags. CONS_Alert(CONS_WARNING, "Ran out of free typeoflevel slots!\n"); else { - UINT32 newtol = (1< Date: Wed, 12 Feb 2020 13:59:08 -0300 Subject: [PATCH 111/139] Cast Moment --- src/dehacked.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 79d0b46dd..4d1147276 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -603,7 +603,7 @@ static void readfreeslots(MYFILE *f) continue; // We don't, so freeslot it. - if (lastcustomtol == MAXTOL) // Unless you have way too many, since they're flags. + if (lastcustomtol == (UINT32)MAXTOL) // Unless you have way too many, since they're flags. deh_warning("Ran out of free typeoflevel slots!\n"); else { @@ -10454,7 +10454,7 @@ static inline int lib_freeslot(lua_State *L) // We don't, so allocate a new one. if (TYPEOFLEVEL[i].name == NULL) { - if (lastcustomtol == MAXTOL) // Unless you have way too many, since they're flags. + if (lastcustomtol == (UINT32)MAXTOL) // Unless you have way too many, since they're flags. CONS_Alert(CONS_WARNING, "Ran out of free typeoflevel slots!\n"); else { CONS_Printf("TypeOfLevel TOL_%s allocated.\n",word); From 841094976b8a84ed56942cea96515cb9b19245e5 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 12 Feb 2020 18:02:36 -0800 Subject: [PATCH 112/139] 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 d9e2256a3c30dce3ee35cb37085579cea88f7878 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Fri, 14 Feb 2020 22:30:37 -0500 Subject: [PATCH 113/139] Add six new skin colors --- src/dehacked.c | 6 ++++++ src/doomdef.h | 6 ++++++ src/r_draw.c | 20 +++++++++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 45f00b8cf..b82ff4aef 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8989,9 +8989,11 @@ static const char *COLOR_ENUMS[] = { // Desaturated "AETHER", // SKINCOLOR_AETHER, "SLATE", // SKINCOLOR_SLATE, + "BLUEBELL", // SKINCOLOR_BLUEBELL, "PINK", // SKINCOLOR_PINK, "YOGURT", // SKINCOLOR_YOGURT, "BROWN", // SKINCOLOR_BROWN, + "BRONZE", // SKINCOLOR_BRONZE, "TAN", // SKINCOLOR_TAN, "BEIGE", // SKINCOLOR_BEIGE, "MOSS", // SKINCOLOR_MOSS, @@ -9004,9 +9006,11 @@ static const char *COLOR_ENUMS[] = { "RED", // SKINCOLOR_RED, "CRIMSON", // SKINCOLOR_CRIMSON, "FLAME", // SKINCOLOR_FLAME, + "KETCHUP", // SKINCOLOR_KETCHUP, "PEACHY", // SKINCOLOR_PEACHY, "QUAIL", // SKINCOLOR_QUAIL, "SUNSET", // SKINCOLOR_SUNSET, + "COPPER", // SKINCOLOR_COPPER, "APRICOT", // SKINCOLOR_APRICOT, "ORANGE", // SKINCOLOR_ORANGE, "RUST", // SKINCOLOR_RUST, @@ -9016,6 +9020,7 @@ static const char *COLOR_ENUMS[] = { "OLIVE", // SKINCOLOR_OLIVE, "LIME", // SKINCOLOR_LIME, "PERIDOT", // SKINCOLOR_PERIDOT, + "APPLE", // SKINCOLOR_APPLE, "GREEN", // SKINCOLOR_GREEN, "FOREST", // SKINCOLOR_FOREST, "EMERALD", // SKINCOLOR_EMERALD, @@ -9042,6 +9047,7 @@ static const char *COLOR_ENUMS[] = { "VIOLET", // SKINCOLOR_VIOLET, "LILAC", // SKINCOLOR_LILAC, "PLUM", // SKINCOLOR_PLUM, + "RASPBERRY", // SKINCOLOR_RASPBERRY, "ROSY", // SKINCOLOR_ROSY, // Super special awesome Super flashing colors! diff --git a/src/doomdef.h b/src/doomdef.h index 3d02871e4..57696083f 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -253,9 +253,11 @@ typedef enum // Desaturated SKINCOLOR_AETHER, SKINCOLOR_SLATE, + SKINCOLOR_BLUEBELL, SKINCOLOR_PINK, SKINCOLOR_YOGURT, SKINCOLOR_BROWN, + SKINCOLOR_BRONZE, SKINCOLOR_TAN, SKINCOLOR_BEIGE, SKINCOLOR_MOSS, @@ -268,9 +270,11 @@ typedef enum SKINCOLOR_RED, SKINCOLOR_CRIMSON, SKINCOLOR_FLAME, + SKINCOLOR_KETCHUP, SKINCOLOR_PEACHY, SKINCOLOR_QUAIL, SKINCOLOR_SUNSET, + SKINCOLOR_COPPER, SKINCOLOR_APRICOT, SKINCOLOR_ORANGE, SKINCOLOR_RUST, @@ -280,6 +284,7 @@ typedef enum SKINCOLOR_OLIVE, SKINCOLOR_LIME, SKINCOLOR_PERIDOT, + SKINCOLOR_APPLE, SKINCOLOR_GREEN, SKINCOLOR_FOREST, SKINCOLOR_EMERALD, @@ -306,6 +311,7 @@ typedef enum SKINCOLOR_VIOLET, SKINCOLOR_LILAC, SKINCOLOR_PLUM, + SKINCOLOR_RASPBERRY, SKINCOLOR_ROSY, // SKINCOLOR_? - one left before we bump up against 0x39, which isn't a HARD limit anymore but would be excessive diff --git a/src/r_draw.c b/src/r_draw.c index 743965cfb..918c5f206 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -153,9 +153,11 @@ const UINT8 Color_Index[MAXTRANSLATIONS-1][16] = { // Desaturated {0x00, 0x00, 0x01, 0x02, 0x02, 0x03, 0x91, 0x91, 0x91, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xaf}, // SKINCOLOR_AETHER {0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0xaa, 0xaa, 0xaa, 0xab, 0xac, 0xac, 0xad, 0xad, 0xae, 0xaf}, // SKINCOLOR_SLATE + {0x90, 0x91, 0x92, 0x93, 0x94, 0x94, 0x95, 0xac, 0xac, 0xad, 0xad, 0xa8, 0xa8, 0xa9, 0xfd, 0xfe}, // SKINCOLOR_BLUEBELL {0xd0, 0xd0, 0xd1, 0xd1, 0xd2, 0xd2, 0xd3, 0xd3, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0x2b, 0x2c, 0x2e}, // SKINCOLOR_PINK {0xd0, 0x30, 0xd8, 0xd9, 0xda, 0xdb, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe3, 0xe6, 0xe8, 0xe9}, // SKINCOLOR_YOGURT {0xdf, 0xe0, 0xe1, 0xe2, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef}, // SKINCOLOR_BROWN + {0xde, 0xe0, 0xe1, 0xe4, 0xe7, 0xe9, 0xeb, 0xec, 0xed, 0xed, 0xed, 0x19, 0x19, 0x1b, 0x1d, 0x1e}, // SKINCOLOR_BRONZE {0x51, 0x51, 0x54, 0x54, 0x55, 0x55, 0x56, 0x56, 0x56, 0x57, 0xf5, 0xf5, 0xf9, 0xf9, 0xed, 0xed}, // SKINCOLOR_TAN {0x54, 0x55, 0x56, 0x56, 0xf2, 0xf3, 0xf3, 0xf4, 0xf5, 0xf6, 0xf8, 0xf9, 0xfa, 0xfb, 0xed, 0xed}, // SKINCOLOR_BEIGE {0x58, 0x58, 0x59, 0x59, 0x5a, 0x5a, 0x5b, 0x5b, 0x5b, 0x5c, 0x5d, 0x5d, 0x5e, 0x5e, 0x5f, 0x5f}, // SKINCOLOR_MOSS @@ -168,9 +170,11 @@ const UINT8 Color_Index[MAXTRANSLATIONS-1][16] = { {0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x47, 0x2e, 0x2f}, // SKINCOLOR_RED {0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2b, 0x2b, 0x2c, 0x2d, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x1f}, // SKINCOLOR_CRIMSON {0x31, 0x32, 0x33, 0x36, 0x22, 0x22, 0x25, 0x25, 0x25, 0xcd, 0xcf, 0xcf, 0xc5, 0xc5, 0xc7, 0xc7}, // SKINCOLOR_FLAME + {0x48, 0x49, 0x40, 0x33, 0x34, 0x36, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2b, 0x2c, 0x47, 0x2e, 0x2f}, // SKINCOLOR_KETCHUP {0xd0, 0x30, 0x31, 0x31, 0x32, 0x32, 0xdc, 0xdc, 0xdc, 0xd3, 0xd4, 0xd4, 0xcc, 0xcd, 0xce, 0xcf}, // SKINCOLOR_PEACHY {0xd8, 0xd9, 0xdb, 0xdc, 0xde, 0xdf, 0xd5, 0xd5, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0x1d, 0x1f}, // SKINCOLOR_QUAIL {0x51, 0x52, 0x40, 0x40, 0x34, 0x36, 0xd5, 0xd5, 0xd6, 0xd7, 0xcf, 0xcf, 0xc6, 0xc6, 0xc7, 0xfe}, // SKINCOLOR_SUNSET + {0x58, 0x54, 0x40, 0x34, 0x35, 0x38, 0x3a, 0x3c, 0x3d, 0x2a, 0x2b, 0x2c, 0x2c, 0xba, 0xba, 0xbb}, // SKINCOLOR_COPPER {0x00, 0xd8, 0xd9, 0xda, 0xdb, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e}, // SKINCOLOR_APRICOT {0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x2c}, // SKINCOLOR_ORANGE {0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3c, 0x3d, 0x3d, 0x3d, 0x3f, 0x2c, 0x2d, 0x47, 0x2e, 0x2f, 0x2f}, // SKINCOLOR_RUST @@ -180,6 +184,7 @@ const UINT8 Color_Index[MAXTRANSLATIONS-1][16] = { {0x4b, 0x4b, 0x4c, 0x4c, 0x4d, 0x4e, 0xe7, 0xe7, 0xe9, 0xc5, 0xc5, 0xc6, 0xc6, 0xc7, 0xc7, 0xfd}, // SKINCOLOR_OLIVE {0x50, 0x51, 0x52, 0x53, 0x48, 0xbc, 0xbd, 0xbe, 0xbe, 0xbf, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f}, // SKINCOLOR_LIME {0x58, 0x58, 0xbc, 0xbc, 0xbd, 0xbd, 0xbe, 0xbe, 0xbe, 0xbf, 0x5e, 0x5e, 0x5f, 0x5f, 0x77, 0x77}, // SKINCOLOR_PERIDOT + {0x49, 0x49, 0xbc, 0xbd, 0xbe, 0xbe, 0xbe, 0x67, 0x69, 0x6a, 0x6b, 0x6b, 0x6c, 0x6d, 0x6d, 0x6d}, // SKINCOLOR_APPLE {0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f}, // SKINCOLOR_GREEN {0x65, 0x66, 0x67, 0x68, 0x69, 0x69, 0x6a, 0x6b, 0x6b, 0x6c, 0x6d, 0x6d, 0x6e, 0x6e, 0x6e, 0x6f}, // SKINCOLOR_FOREST {0x70, 0x70, 0x71, 0x71, 0x72, 0x72, 0x73, 0x73, 0x73, 0x74, 0x75, 0x75, 0x76, 0x76, 0x77, 0x77}, // SKINCOLOR_EMERALD @@ -206,6 +211,7 @@ const UINT8 Color_Index[MAXTRANSLATIONS-1][16] = { {0xd0, 0xd1, 0xd2, 0xca, 0xcc, 0xb8, 0xb9, 0xb9, 0xba, 0xa8, 0xa8, 0xa9, 0xa9, 0xfd, 0xfe, 0xfe}, // SKINCOLOR_VIOLET {0x00, 0xd0, 0xd1, 0xd2, 0xd3, 0xc1, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc5, 0xc6, 0xc6, 0xfe, 0x1f}, // SKINCOLOR_LILAC {0xc8, 0xd3, 0xd5, 0xd6, 0xd7, 0xce, 0xcf, 0xb9, 0xb9, 0xba, 0xba, 0xa9, 0xa9, 0xa9, 0xfd, 0xfe}, // SKINCOLOR_PLUM + {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, // SKINCOLOR_RASPBERRY {0xfc, 0xc8, 0xc8, 0xc9, 0xc9, 0xca, 0xca, 0xcb, 0xcb, 0xcc, 0xcc, 0xcd, 0xcd, 0xce, 0xce, 0xcf}, // SKINCOLOR_ROSY // {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, // SKINCOLOR_? @@ -285,9 +291,11 @@ const char *Color_Names[MAXSKINCOLORS + NUMSUPERCOLORS] = // Desaturated "Aether", // SKINCOLOR_AETHER, "Slate", // SKINCOLOR_SLATE, + "Bluebell", // SKINCOLOR_BLUEBELL, "Pink", // SKINCOLOR_PINK, "Yogurt", // SKINCOLOR_YOGURT, - "Brown", // SKINCOLOR_BROWN, + "Brown", // SKINCOLOR_BROWN, + "Bronze", // SKINCOLOR_BRONZE, "Tan", // SKINCOLOR_TAN, "Beige", // SKINCOLOR_BEIGE, "Moss", // SKINCOLOR_MOSS, @@ -300,9 +308,11 @@ const char *Color_Names[MAXSKINCOLORS + NUMSUPERCOLORS] = "Red", // SKINCOLOR_RED, "Crimson", // SKINCOLOR_CRIMSON, "Flame", // SKINCOLOR_FLAME, + "Ketchup", // SKINCOLOR_KETCHUP, "Peachy", // SKINCOLOR_PEACHY, "Quail", // SKINCOLOR_QUAIL, "Sunset", // SKINCOLOR_SUNSET, + "Copper", // SKINCOLOR_COPPER, "Apricot", // SKINCOLOR_APRICOT, "Orange", // SKINCOLOR_ORANGE, "Rust", // SKINCOLOR_RUST, @@ -312,6 +322,7 @@ const char *Color_Names[MAXSKINCOLORS + NUMSUPERCOLORS] = "Olive", // SKINCOLOR_OLIVE, "Lime", // SKINCOLOR_LIME, "Peridot", // SKINCOLOR_PERIDOT, + "Apple", // SKINCOLOR_APPLE, "Green", // SKINCOLOR_GREEN, "Forest", // SKINCOLOR_FOREST, "Emerald", // SKINCOLOR_EMERALD, @@ -338,6 +349,7 @@ const char *Color_Names[MAXSKINCOLORS + NUMSUPERCOLORS] = "Violet", // SKINCOLOR_VIOLET, "Lilac", // SKINCOLOR_LILAC, "Plum", // SKINCOLOR_PLUM, + "Raspberry", // SKINCOLOR_RASPBERRY, "Rosy", // SKINCOLOR_ROSY, // Super behaves by different rules (one name per 5 colours), and will be accessed exclusively via R_GetSuperColorByName instead of R_GetColorByName. @@ -375,9 +387,11 @@ const UINT8 Color_Opposite[MAXSKINCOLORS - 1][2] = // Desaturated {SKINCOLOR_GREY, 15}, // SKINCOLOR_AETHER, {SKINCOLOR_SILVER, 12}, // SKINCOLOR_SLATE, + {SKINCOLOR_COPPER, 4}, // SKINCOLOR_BLUEBELL, {SKINCOLOR_AZURE, 9}, // SKINCOLOR_PINK, {SKINCOLOR_RUST, 7}, // SKINCOLOR_YOGURT, {SKINCOLOR_TAN, 2}, // SKINCOLOR_BROWN, + {SKINCOLOR_KETCHUP, 0}, // SKINCOLOR_BRONZE, {SKINCOLOR_BROWN, 12}, // SKINCOLOR_TAN, {SKINCOLOR_MOSS, 5}, // SKINCOLOR_BEIGE, {SKINCOLOR_BEIGE, 13}, // SKINCOLOR_MOSS, @@ -390,9 +404,11 @@ const UINT8 Color_Opposite[MAXSKINCOLORS - 1][2] = {SKINCOLOR_GREEN, 10}, // SKINCOLOR_RED, {SKINCOLOR_ICY, 10}, // SKINCOLOR_CRIMSON, {SKINCOLOR_PURPLE, 8}, // SKINCOLOR_FLAME, + {SKINCOLOR_BRONZE, 8}, // SKINCOLOR_KETCHUP, {SKINCOLOR_TEAL, 7}, // SKINCOLOR_PEACHY, {SKINCOLOR_WAVE, 5}, // SKINCOLOR_QUAIL, {SKINCOLOR_SAPPHIRE, 5}, // SKINCOLOR_SUNSET, + {SKINCOLOR_BLUEBELL, 5}, // SKINCOLOR_COPPER {SKINCOLOR_CYAN, 4}, // SKINCOLOR_APRICOT, {SKINCOLOR_BLUE, 4}, // SKINCOLOR_ORANGE, {SKINCOLOR_YOGURT, 8}, // SKINCOLOR_RUST, @@ -402,6 +418,7 @@ const UINT8 Color_Opposite[MAXSKINCOLORS - 1][2] = {SKINCOLOR_DUSK, 3}, // SKINCOLOR_OLIVE, {SKINCOLOR_MAGENTA, 9}, // SKINCOLOR_LIME, {SKINCOLOR_COBALT, 2}, // SKINCOLOR_PERIDOT, + {SKINCOLOR_RASPBERRY, 13}, // SKINCOLOR_APPLE, {SKINCOLOR_RED, 6}, // SKINCOLOR_GREEN, {SKINCOLOR_SALMON, 9}, // SKINCOLOR_FOREST, {SKINCOLOR_RUBY, 4}, // SKINCOLOR_EMERALD, @@ -428,6 +445,7 @@ const UINT8 Color_Opposite[MAXSKINCOLORS - 1][2] = {SKINCOLOR_MINT, 6}, // SKINCOLOR_VIOLET, {SKINCOLOR_VAPOR, 4}, // SKINCOLOR_LILAC, {SKINCOLOR_MINT, 7}, // SKINCOLOR_PLUM, + {SKINCOLOR_APPLE, 13}, // SKINCOLOR_RASPBERRY {SKINCOLOR_AQUA, 1} // SKINCOLOR_ROSY, }; From e7a0fc65bde8a0429d1ca12508f6f0142cb0c10c Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 15 Feb 2020 12:44:03 +0100 Subject: [PATCH 114/139] 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 a98e84faa04accaef39d50095308132183ce0bde Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 15 Feb 2020 12:40:41 -0300 Subject: [PATCH 115/139] change prefix to "PLAYER" --- src/hardware/hw_md2.c | 52 +++++++++++++++++++++++++------------------ src/hardware/hw_md2.h | 2 +- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 33bed3e46..6c4801cc7 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -476,8 +476,9 @@ void HWR_InitModels(void) size_t i; INT32 s; FILE *f; - char name[22], filename[32]; + char name[24], filename[32]; float scale, offset; + size_t prefixlen; CONS_Printf("HWR_InitModels()...\n"); for (s = 0; s < MAXSKINS; s++) @@ -510,15 +511,18 @@ void HWR_InitModels(void) return; } - while (fscanf(f, "%23s %31s %f %f", name, filename, &scale, &offset) == 4) + // length of the player model prefix + prefixlen = strlen(PLAYERMODELPREFIX); + + while (fscanf(f, "%25s %31s %f %f", name, filename, &scale, &offset) == 4) { char *skinname = name; size_t len = strlen(name); - // check for the skin model prefix. - if (strnicmp(name, PLAYERMODELPREFIX, 4) == 0 && len > 4) + // check for the player model prefix. + if (!strnicmp(name, PLAYERMODELPREFIX, prefixlen) && (len > prefixlen)) { - skinname += 4; + skinname += prefixlen; goto addskinmodel; } @@ -539,7 +543,7 @@ void HWR_InitModels(void) } addskinmodel: - // add skin model + // add player model for (s = 0; s < MAXSKINS; s++) { if (stricmp(skinname, skins[s].name) == 0) @@ -563,8 +567,9 @@ modelfound: void HWR_AddPlayerModel(int skin) // For skins that were added after startup { FILE *f; - char name[22], filename[32]; + char name[24], filename[32]; float scale, offset; + size_t prefixlen; if (nomd2s) return; @@ -582,13 +587,18 @@ void HWR_AddPlayerModel(int skin) // For skins that were added after startup return; } + // length of the player model prefix + prefixlen = strlen(PLAYERMODELPREFIX); + // Check for any models that match the names of player skins! - while (fscanf(f, "%23s %31s %f %f", name, filename, &scale, &offset) == 4) + while (fscanf(f, "%25s %31s %f %f", name, filename, &scale, &offset) == 4) { - // ignore the skin model prefix. char *skinname = name; - if (!strnicmp(name, PLAYERMODELPREFIX, 4)) - skinname += 4; + size_t len = strlen(name); + + // ignore the player model prefix. + if (!strnicmp(name, PLAYERMODELPREFIX, prefixlen) && (len > prefixlen)) + skinname += prefixlen; if (stricmp(skinname, skins[skin].name) == 0) { @@ -609,10 +619,10 @@ playermodelfound: void HWR_AddSpriteModel(size_t spritenum) // For sprites that were added after startup { FILE *f; - // name[22] is used to check for names in the models.dat file that match with sprites or player skins + // name[24] is used to check for names in the models.dat file that match with sprites or player skins // sprite names are always 4 characters long, and names is for player skins can be up to 19 characters long - // PLAYERMODELPREFIX is 4 characters long - char name[22], filename[32]; + // PLAYERMODELPREFIX is 6 characters long + char name[24], filename[32]; float scale, offset; if (nomd2s) @@ -633,19 +643,17 @@ void HWR_AddSpriteModel(size_t spritenum) // For sprites that were added after s } // Check for any models that match the names of sprite names! - while (fscanf(f, "%23s %31s %f %f", name, filename, &scale, &offset) == 4) + while (fscanf(f, "%25s %31s %f %f", name, filename, &scale, &offset) == 4) { // length of the sprite name size_t len = strlen(name); - - // check for the skin model prefix. - if (!strnicmp(name, PLAYERMODELPREFIX, 4)) - continue; // that's not a sprite... - - // must be 4 characters long exactly. otherwise it's not a sprite name. - if (len != 4) + if (len != 4) // must be 4 characters long exactly. otherwise it's not a sprite name. continue; + // check for the player model prefix. + if (!strnicmp(name, PLAYERMODELPREFIX, strlen(PLAYERMODELPREFIX))) + continue; // that's not a sprite... + if (stricmp(name, sprnames[spritenum]) == 0) { md2_models[spritenum].scale = scale; diff --git a/src/hardware/hw_md2.h b/src/hardware/hw_md2.h index 40dbdf079..3bbe30053 100644 --- a/src/hardware/hw_md2.h +++ b/src/hardware/hw_md2.h @@ -49,6 +49,6 @@ void HWR_AddPlayerModel(INT32 skin); void HWR_AddSpriteModel(size_t spritenum); boolean HWR_DrawModel(gr_vissprite_t *spr); -#define PLAYERMODELPREFIX "SKIN" +#define PLAYERMODELPREFIX "PLAYER" #endif // _HW_MD2_H_ From 5dc0f0649e55584f1288796724c68e4dde565f15 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 15 Feb 2020 13:07:53 -0300 Subject: [PATCH 116/139] Fix overtime not working --- src/g_game.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index efc96a50f..0d89a0cf6 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3203,17 +3203,17 @@ UINT32 gametypedefaultrules[NUMGAMETYPES] = GTR_RACE|GTR_SPAWNENEMIES|GTR_SPAWNINVUL|GTR_ALLOWEXIT, // Match - GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_POWERSTONES|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY|GTR_PITYSHIELD|GTR_DEATHPENALTY, + GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_POWERSTONES|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY|GTR_PITYSHIELD|GTR_DEATHPENALTY, // Team Match - GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_TEAMS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY|GTR_PITYSHIELD, + GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_TEAMS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY|GTR_PITYSHIELD, // Tag - GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_STARTCOUNTDOWN|GTR_BLINDFOLDED|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY, + GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_STARTCOUNTDOWN|GTR_BLINDFOLDED|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY, // Hide and Seek - GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_STARTCOUNTDOWN|GTR_BLINDFOLDED|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY, + GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_STARTCOUNTDOWN|GTR_BLINDFOLDED|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY, // CTF - GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_TEAMS|GTR_TEAMFLAGS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_POWERSTONES|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY|GTR_PITYSHIELD, + GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_TEAMS|GTR_TEAMFLAGS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_OVERTIME|GTR_POWERSTONES|GTR_DEATHMATCHSTARTS|GTR_SPAWNINVUL|GTR_RESPAWNDELAY|GTR_PITYSHIELD, }; // From 2b615aa09c7a7923cbf70b9ea624309f428a7a76 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sat, 15 Feb 2020 17:34:21 -0500 Subject: [PATCH 117/139] Add prefoppoistecolor support to save cards --- src/m_menu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 916de03fa..367a4dd4b 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8068,8 +8068,16 @@ static void M_DrawLoadGameData(void) col = 134; else { - col = charskin->prefcolor - 1; - col = Color_Index[Color_Opposite[col][0]-1][Color_Opposite[col][1]]; + if (charskin->prefoppositecolor) + { + col = charskin->prefoppositecolor - 1; + col = Color_Index[col][Color_Opposite[Color_Opposite[col][0] - 1][1]]; + } + else + { + col = charskin->prefcolor - 1; + col = Color_Index[Color_Opposite[col][0]-1][Color_Opposite[col][1]]; + } } V_DrawFill(x+6, y+64, 72, 50, col); From 2b678aaef0fe7e439ab859e820b6baf1725b425d Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sat, 15 Feb 2020 17:35:00 -0500 Subject: [PATCH 118/139] New Lua functions: R_GetColorByName and R_GetNameByColor --- src/lua_baselib.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 66bd30e32..2ef45ac96 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -20,6 +20,7 @@ #endif #include "z_zone.h" #include "r_main.h" +#include "r_draw.h" #include "r_things.h" #include "m_random.h" #include "s_sound.h" @@ -2313,8 +2314,26 @@ static int lib_rTextureNumForName(lua_State *L) return 1; } -// S_SOUND +// R_DRAW //////////// +static int lib_rGetColorByName(lua_State *L) +{ + const char* colorname = luaL_checkstring(L, 1); + //HUDSAFE + lua_pushinteger(L, R_GetColorByName(colorname)); + return 1; +} + +// Lua exclusive function, returns the name of a color from the SKINCOLOR_ constant. +// SKINCOLOR_GREEN > "Green" for example +static int lib_rGetNameByColor(lua_State *L) +{ + UINT8 colornum = (UINT8)luaL_checkinteger(L, 1); + if (!colornum || colornum >= MAXSKINCOLORS) + return luaL_error(L, "skincolor %d out of range (1 - %d).", colornum, MAXSKINCOLORS-1); + lua_pushstring(L, Color_Names[colornum]); + return 1; +} static int lib_sStartSound(lua_State *L) { @@ -3153,6 +3172,10 @@ static luaL_Reg lib[] = { {"R_CheckTextureNumForName",lib_rCheckTextureNumForName}, {"R_TextureNumForName",lib_rTextureNumForName}, + // r_draw + {"R_GetColorByName", lib_rGetColorByName}, + {"R_GetNameByColor", lib_rGetNameByColor}, + // s_sound {"S_StartSound",lib_sStartSound}, {"S_StartSoundAtVolume",lib_sStartSoundAtVolume}, From 7b13f0a2dea61dc38b90d8718f843c14b1020d79 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Sat, 15 Feb 2020 23:47:11 +0100 Subject: [PATCH 119/139] 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 45ab4244fc9609f314d2088497e97002e65ab953 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sat, 15 Feb 2020 17:55:25 -0500 Subject: [PATCH 120/139] Restore this that got shifted. --- src/lua_baselib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 2ef45ac96..b16ac6a60 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2335,6 +2335,8 @@ static int lib_rGetNameByColor(lua_State *L) return 1; } +// S_SOUND +//////////// static int lib_sStartSound(lua_State *L) { const void *origin = NULL; From 3a82864ce9de523af5cc62daef20957343b1f5f4 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 16 Feb 2020 11:34:02 -0500 Subject: [PATCH 121/139] 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 512c6f24a902215d45ea93a2ef5eb497e5968f03 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 16 Feb 2020 20:19:24 +0100 Subject: [PATCH 122/139] Clean up the mess that is extracolormap_t::fog --- src/hardware/hw_main.c | 14 ++---------- src/p_saveg.c | 10 ++++----- src/p_spec.c | 17 +++++++-------- src/r_data.c | 48 +++++++++++++++++++++--------------------- src/r_data.h | 10 ++++----- src/r_defs.h | 5 ++++- src/r_plane.c | 15 ++----------- src/r_segs.c | 30 ++++++++++++-------------- src/r_things.c | 6 +++--- 9 files changed, 66 insertions(+), 89 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 7e913c4c7..5dd222dfd 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5022,12 +5022,7 @@ void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boo planeinfo[numplanes].isceiling = isceiling; planeinfo[numplanes].fixedheight = fixedheight; - - if (planecolormap && (planecolormap->fog & 1)) - planeinfo[numplanes].lightlevel = lightlevel; - else - planeinfo[numplanes].lightlevel = 255; - + planeinfo[numplanes].lightlevel = (planecolormap && (planecolormap->flags & CMF_FOG)) ? lightlevel : 255; planeinfo[numplanes].levelflat = levelflat; planeinfo[numplanes].xsub = xsub; planeinfo[numplanes].alpha = alpha; @@ -5059,12 +5054,7 @@ void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polyse polyplaneinfo[numpolyplanes].isceiling = isceiling; polyplaneinfo[numpolyplanes].fixedheight = fixedheight; - - if (planecolormap && (planecolormap->fog & 1)) - polyplaneinfo[numpolyplanes].lightlevel = lightlevel; - else - polyplaneinfo[numpolyplanes].lightlevel = 255; - + polyplaneinfo[numpolyplanes].lightlevel = (planecolormap && (planecolormap->flags & CMF_FOG)) ? lightlevel : 255; polyplaneinfo[numpolyplanes].levelflat = levelflat; polyplaneinfo[numpolyplanes].polysector = polysector; polyplaneinfo[numpolyplanes].alpha = alpha; diff --git a/src/p_saveg.c b/src/p_saveg.c index 853856880..31ac79931 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -609,7 +609,7 @@ static void P_NetArchiveColormaps(void) WRITEUINT8(save_p, exc->fadestart); WRITEUINT8(save_p, exc->fadeend); - WRITEUINT8(save_p, exc->fog); + WRITEUINT8(save_p, exc->flags); WRITEINT32(save_p, exc->rgba); WRITEINT32(save_p, exc->fadergba); @@ -639,7 +639,7 @@ static void P_NetUnArchiveColormaps(void) for (exc = net_colormaps; i < num_net_colormaps; i++, exc = exc_next) { - UINT8 fadestart, fadeend, fog; + UINT8 fadestart, fadeend, flags; INT32 rgba, fadergba; #ifdef EXTRACOLORMAPLUMPS char lumpname[9]; @@ -647,7 +647,7 @@ static void P_NetUnArchiveColormaps(void) fadestart = READUINT8(save_p); fadeend = READUINT8(save_p); - fog = READUINT8(save_p); + flags = READUINT8(save_p); rgba = READINT32(save_p); fadergba = READINT32(save_p); @@ -679,7 +679,7 @@ static void P_NetUnArchiveColormaps(void) exc->fadestart = fadestart; exc->fadeend = fadeend; - exc->fog = fog; + exc->flags = flags; exc->rgba = rgba; exc->fadergba = fadergba; @@ -689,7 +689,7 @@ static void P_NetUnArchiveColormaps(void) exc->lumpname[0] = 0; #endif - existing_exc = R_GetColormapFromListByValues(rgba, fadergba, fadestart, fadeend, fog); + existing_exc = R_GetColormapFromListByValues(rgba, fadergba, fadestart, fadeend, flags); if (existing_exc) exc->colormap = existing_exc->colormap; diff --git a/src/p_spec.c b/src/p_spec.c index 76a80d754..28d48d5d8 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3516,7 +3516,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) false, // subtract FadeA (no flag for this, just pass negative alpha) false, // subtract FadeStart (we ran out of flags) false, // subtract FadeEnd (we ran out of flags) - false, // ignore Fog (we ran out of flags) + false, // ignore Flags (we ran out of flags) line->flags & ML_DONTPEGBOTTOM, (line->flags & ML_DONTPEGBOTTOM) ? (sides[line->sidenum[0]].textureoffset >> FRACBITS) : 0, (line->flags & ML_DONTPEGBOTTOM) ? (sides[line->sidenum[0]].rowoffset >> FRACBITS) : 0, @@ -3883,7 +3883,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) false, // subtract FadeA (no flag for this, just pass negative alpha) false, // subtract FadeStart (we ran out of flags) false, // subtract FadeEnd (we ran out of flags) - false, // ignore Fog (we ran out of flags) + false, // ignore Flags (we ran out of flags) line->flags & ML_DONTPEGBOTTOM, (line->flags & ML_DONTPEGBOTTOM) ? (sides[line->sidenum[0]].textureoffset >> FRACBITS) : 0, (line->flags & ML_DONTPEGBOTTOM) ? (sides[line->sidenum[0]].rowoffset >> FRACBITS) : 0, @@ -7081,10 +7081,9 @@ void P_SpawnSpecials(boolean fromnetsave) case 202: // Fog ffloorflags = FF_EXISTS|FF_RENDERALL|FF_FOG|FF_BOTHPLANES|FF_INVERTPLANES|FF_ALLSIDES|FF_INVERTSIDES|FF_CUTEXTRA|FF_EXTRA|FF_DOUBLESHADOW|FF_CUTSPRITES; sec = sides[*lines[i].sidenum].sector - sectors; - // SoM: Because it's fog, check for an extra colormap and set - // the fog flag... + // SoM: Because it's fog, check for an extra colormap and set the fog flag... if (sectors[sec].extra_colormap) - sectors[sec].extra_colormap->fog = 1; + sectors[sec].extra_colormap->flags = CMF_FOG; P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); break; @@ -8472,7 +8471,7 @@ void T_FadeColormap(fadecolormap_t *d) extracolormap_t *exc; INT32 duration = d->ticbased ? d->duration : 256; fixed_t factor = min(FixedDiv(duration - d->timer, duration), 1*FRACUNIT); - INT16 cr, cg, cb, ca, fadestart, fadeend, fog; + INT16 cr, cg, cb, ca, fadestart, fadeend, flags; INT32 rgba, fadergba; // NULL failsafes (or intentionally set to signify default) @@ -8521,7 +8520,7 @@ void T_FadeColormap(fadecolormap_t *d) fadestart = APPLYFADE(d->dest_exc->fadestart, d->source_exc->fadestart, d->sector->extra_colormap->fadestart); fadeend = APPLYFADE(d->dest_exc->fadeend, d->source_exc->fadeend, d->sector->extra_colormap->fadeend); - fog = abs(factor) > FRACUNIT/2 ? d->dest_exc->fog : d->source_exc->fog; // set new fog flag halfway through fade + flags = abs(factor) > FRACUNIT/2 ? d->dest_exc->flags : d->source_exc->flags; // set new flags halfway through fade #undef APPLYFADE @@ -8529,12 +8528,12 @@ void T_FadeColormap(fadecolormap_t *d) // setup new colormap ////////////////// - if (!(d->sector->extra_colormap = R_GetColormapFromListByValues(rgba, fadergba, fadestart, fadeend, fog))) + if (!(d->sector->extra_colormap = R_GetColormapFromListByValues(rgba, fadergba, fadestart, fadeend, flags))) { exc = R_CreateDefaultColormap(false); exc->fadestart = fadestart; exc->fadeend = fadeend; - exc->fog = (boolean)fog; + exc->flags = flags; exc->rgba = rgba; exc->fadergba = fadergba; exc->colormap = R_CreateLightTable(exc); diff --git a/src/r_data.c b/src/r_data.c index 5608fdbde..f5a24c2c4 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1799,7 +1799,7 @@ extracolormap_t *R_CreateDefaultColormap(boolean lighttable) extracolormap_t *exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL); exc->fadestart = 0; exc->fadeend = 31; - exc->fog = 0; + exc->flags = 0; exc->rgba = 0; exc->fadergba = 0x19000000; exc->colormap = lighttable ? R_CreateLightTable(exc) : NULL; @@ -1903,17 +1903,17 @@ void R_AddColormapToList(extracolormap_t *extra_colormap) // #ifdef EXTRACOLORMAPLUMPS boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams, - INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog, lumpnum_t lump) + INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags, lumpnum_t lump) #else boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams, - INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog) + INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags) #endif { return ( (!checkparams ? true : (fadestart == 0 && fadeend == 31 - && !fog) + && !flags) ) && (!checkrgba ? true : rgba == 0) && (!checkfadergba ? true : fadergba == 0x19000000) @@ -1930,9 +1930,9 @@ boolean R_CheckDefaultColormap(extracolormap_t *extra_colormap, boolean checkrgb return true; #ifdef EXTRACOLORMAPLUMPS - return R_CheckDefaultColormapByValues(checkrgba, checkfadergba, checkparams, extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->fog, extra_colormap->lump); + return R_CheckDefaultColormapByValues(checkrgba, checkfadergba, checkparams, extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->flags, extra_colormap->lump); #else - return R_CheckDefaultColormapByValues(checkrgba, checkfadergba, checkparams, extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->fog); + return R_CheckDefaultColormapByValues(checkrgba, checkfadergba, checkparams, extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->flags); #endif } @@ -1952,7 +1952,7 @@ boolean R_CheckEqualColormaps(extracolormap_t *exc_a, extracolormap_t *exc_b, bo (!checkparams ? true : (exc_a->fadestart == exc_b->fadestart && exc_a->fadeend == exc_b->fadeend - && exc_a->fog == exc_b->fog) + && exc_a->flags == exc_b->flags) ) && (!checkrgba ? true : exc_a->rgba == exc_b->rgba) && (!checkfadergba ? true : exc_a->fadergba == exc_b->fadergba) @@ -1968,9 +1968,9 @@ boolean R_CheckEqualColormaps(extracolormap_t *exc_a, extracolormap_t *exc_b, bo // NOTE: Returns NULL if no match is found // #ifdef EXTRACOLORMAPLUMPS -extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog, lumpnum_t lump) +extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags, lumpnum_t lump) #else -extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog) +extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags) #endif { extracolormap_t *exc; @@ -1982,7 +1982,7 @@ extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 && fadergba == exc->fadergba && fadestart == exc->fadestart && fadeend == exc->fadeend - && fog == exc->fog + && flags == exc->flags #ifdef EXTRACOLORMAPLUMPS && (lump != LUMPERROR && lump == exc->lump) #endif @@ -2001,9 +2001,9 @@ extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 extracolormap_t *R_GetColormapFromList(extracolormap_t *extra_colormap) { #ifdef EXTRACOLORMAPLUMPS - return R_GetColormapFromListByValues(extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->fog, extra_colormap->lump); + return R_GetColormapFromListByValues(extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->flags, extra_colormap->lump); #else - return R_GetColormapFromListByValues(extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->fog); + return R_GetColormapFromListByValues(extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->flags); #endif } @@ -2035,7 +2035,7 @@ extracolormap_t *R_ColormapForName(char *name) // is no real way to tell how GL should handle a colormap lump anyway.. exc->fadestart = 0; exc->fadeend = 31; - exc->fog = 0; + exc->flags = 0; exc->rgba = 0; exc->fadergba = 0x19000000; @@ -2192,7 +2192,7 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3) // default values UINT8 cr = 0, cg = 0, cb = 0, ca = 0, cfr = 0, cfg = 0, cfb = 0, cfa = 25; UINT32 fadestart = 0, fadeend = 31; - UINT8 fog = 0; + UINT8 flags = 0; INT32 rgba = 0, fadergba = 0x19000000; #define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0) @@ -2241,12 +2241,12 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3) #define NUMFROMCHAR(c) (c >= '0' && c <= '9' ? c - '0' : 0) - // Get parameters like fadestart, fadeend, and the fogflag + // Get parameters like fadestart, fadeend, and flags if (p2[0] == '#') { if (p2[1]) { - fog = NUMFROMCHAR(p2[1]); + flags = NUMFROMCHAR(p2[1]); if (p2[2] && p2[3]) { fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10); @@ -2313,18 +2313,18 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3) // Did we just make a default colormap? #ifdef EXTRACOLORMAPLUMPS - if (R_CheckDefaultColormapByValues(true, true, true, rgba, fadergba, fadestart, fadeend, fog, LUMPERROR)) + if (R_CheckDefaultColormapByValues(true, true, true, rgba, fadergba, fadestart, fadeend, flags, LUMPERROR)) return NULL; #else - if (R_CheckDefaultColormapByValues(true, true, true, rgba, fadergba, fadestart, fadeend, fog)) + if (R_CheckDefaultColormapByValues(true, true, true, rgba, fadergba, fadestart, fadeend, flags)) return NULL; #endif // Look for existing colormaps #ifdef EXTRACOLORMAPLUMPS - exc = R_GetColormapFromListByValues(rgba, fadergba, fadestart, fadeend, fog, LUMPERROR); + exc = R_GetColormapFromListByValues(rgba, fadergba, fadestart, fadeend, flags, LUMPERROR); #else - exc = R_GetColormapFromListByValues(rgba, fadergba, fadestart, fadeend, fog); + exc = R_GetColormapFromListByValues(rgba, fadergba, fadestart, fadeend, flags); #endif if (exc) return exc; @@ -2336,7 +2336,7 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3) extra_colormap->fadestart = (UINT16)fadestart; extra_colormap->fadeend = (UINT16)fadeend; - extra_colormap->fog = fog; + extra_colormap->flags = flags; extra_colormap->rgba = rgba; extra_colormap->fadergba = fadergba; @@ -2363,7 +2363,7 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3) extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *exc_addend, boolean subR, boolean subG, boolean subB, boolean subA, boolean subFadeR, boolean subFadeG, boolean subFadeB, boolean subFadeA, - boolean subFadeStart, boolean subFadeEnd, boolean ignoreFog, + boolean subFadeStart, boolean subFadeEnd, boolean ignoreFlags, boolean useAltAlpha, INT16 altAlpha, INT16 altFadeAlpha, boolean lighttable) { @@ -2451,8 +2451,8 @@ extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *ex // HACK: fadeend defaults to 31, so don't add anything in this case , 31), 0); - if (!ignoreFog) // overwrite fog with new value - exc_augend->fog = exc_addend->fog; + if (!ignoreFlags) // overwrite flags with new value + exc_augend->flags = exc_addend->flags; /////////////////// // put it together diff --git a/src/r_data.h b/src/r_data.h index 145f0182b..0569893cd 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -135,12 +135,12 @@ void R_AddColormapToList(extracolormap_t *extra_colormap); #ifdef EXTRACOLORMAPLUMPS boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams, - INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog, lumpnum_t lump); -extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog, lumpnum_t lump); + INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags, lumpnum_t lump); +extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags, lumpnum_t lump); #else boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams, - INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog); -extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog); + INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags); +extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags); #endif boolean R_CheckDefaultColormap(extracolormap_t *extra_colormap, boolean checkrgba, boolean checkfadergba, boolean checkparams); boolean R_CheckEqualColormaps(extracolormap_t *exc_a, extracolormap_t *exc_b, boolean checkrgba, boolean checkfadergba, boolean checkparams); @@ -151,7 +151,7 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3); extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *exc_addend, boolean subR, boolean subG, boolean subB, boolean subA, boolean subFadeR, boolean subFadeG, boolean subFadeB, boolean subFadeA, - boolean subFadeStart, boolean subFadeEnd, boolean ignoreFog, + boolean subFadeStart, boolean subFadeEnd, boolean ignoreFlags, boolean useAltAlpha, INT16 altAlpha, INT16 altFadeAlpha, boolean lighttable); #ifdef EXTRACOLORMAPLUMPS diff --git a/src/r_defs.h b/src/r_defs.h index 88d418fc9..f2774edbc 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -53,11 +53,14 @@ typedef struct // Could even use more than 32 levels. typedef UINT8 lighttable_t; +#define CMF_FADEFULLBRIGHTSPRITES 1 +#define CMF_FOG 4 + // ExtraColormap type. Use for extra_colormaps from now on. typedef struct extracolormap_s { UINT8 fadestart, fadeend; - UINT8 fog; // categorical value, not boolean + UINT8 flags; // store rgba values in combined bitwise // also used in OpenGL instead lighttables diff --git a/src/r_plane.c b/src/r_plane.c index 5d5e1f20d..e62e571e4 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -44,9 +44,6 @@ // Quincunx antialiasing of flats! //#define QUINCUNX -// good night sweet prince -#define SHITPLANESPARENCY - //SoM: 3/23/2000: Use Boom visplane hashing. visplane_t *visplanes[MAXVISPLANES]; @@ -995,11 +992,7 @@ void R_DrawSinglePlane(visplane_t *pl) else // Opaque, but allow transparent flat pixels spanfunctype = SPANDRAWFUNC_SPLAT; -#ifdef SHITPLANESPARENCY - if ((spanfunctype == SPANDRAWFUNC_SPLAT) != (pl->extra_colormap && (pl->extra_colormap->fog & 4))) -#else - if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2)) -#endif + if ((spanfunctype == SPANDRAWFUNC_SPLAT) || (pl->extra_colormap && (pl->extra_colormap->flags & CMF_FOG))) light = (pl->lightlevel >> LIGHTSEGSHIFT); else light = LIGHTLEVELS-1; @@ -1053,11 +1046,7 @@ void R_DrawSinglePlane(visplane_t *pl) else // Opaque, but allow transparent flat pixels spanfunctype = SPANDRAWFUNC_SPLAT; -#ifdef SHITPLANESPARENCY - if ((spanfunctype == SPANDRAWFUNC_SPLAT) != (pl->extra_colormap && (pl->extra_colormap->fog & 4))) -#else - if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2)) -#endif + if ((spanfunctype == SPANDRAWFUNC_SPLAT) || (pl->extra_colormap && (pl->extra_colormap->flags & CMF_FOG))) light = (pl->lightlevel >> LIGHTSEGSHIFT); else light = LIGHTLEVELS-1; diff --git a/src/r_segs.c b/src/r_segs.c index dcb5fc160..88897ab8e 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -418,14 +418,14 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) rlight->extra_colormap = *light->extra_colormap; rlight->flags = light->flags; - if (rlight->flags & FF_FOG || (rlight->extra_colormap && rlight->extra_colormap->fog)) + if ((colfunc != colfuncs[COLDRAWFUNC_FUZZY]) + || (rlight->flags & FF_FOG) + || (rlight->extra_colormap && (rlight->extra_colormap->flags & CMF_FOG))) lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT); - else if (colfunc == colfuncs[COLDRAWFUNC_FUZZY]) - lightnum = LIGHTLEVELS - 1; else - lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT); + lightnum = LIGHTLEVELS - 1; - if (rlight->extra_colormap && rlight->extra_colormap->fog) + if (rlight->extra_colormap && (rlight->extra_colormap->flags & CMF_FOG)) ; else if (curline->v1->y == curline->v2->y) lightnum--; @@ -437,18 +437,14 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) } else { - if (colfunc == colfuncs[COLDRAWFUNC_FUZZY]) - { - if (frontsector->extra_colormap && frontsector->extra_colormap->fog) - lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT); - else - lightnum = LIGHTLEVELS - 1; - } - else + if ((colfunc != colfuncs[COLDRAWFUNC_FUZZY]) + || frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG)) lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT); + else + lightnum = LIGHTLEVELS - 1; if (colfunc == colfuncs[COLDRAWFUNC_FOG] - || (frontsector->extra_colormap && frontsector->extra_colormap->fog)) + || (frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG))) ; else if (curline->v1->y == curline->v2->y) lightnum--; @@ -947,7 +943,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) else rlight->lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT); - if (pfloor->flags & FF_FOG || rlight->flags & FF_FOG || (rlight->extra_colormap && rlight->extra_colormap->fog)) + if (pfloor->flags & FF_FOG || rlight->flags & FF_FOG || (rlight->extra_colormap && (rlight->extra_colormap->flags & CMF_FOG))) ; else if (curline->v1->y == curline->v2->y) rlight->lightnum--; @@ -962,7 +958,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) else { // Get correct light level! - if ((frontsector->extra_colormap && frontsector->extra_colormap->fog)) + if ((frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG))) lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT); else if (pfloor->flags & FF_FOG) lightnum = (pfloor->master->frontsector->lightlevel >> LIGHTSEGSHIFT); @@ -972,7 +968,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) lightnum = R_FakeFlat(frontsector, &tempsec, &templight, &templight, false) ->lightlevel >> LIGHTSEGSHIFT; - if (pfloor->flags & FF_FOG || (frontsector->extra_colormap && frontsector->extra_colormap->fog)); + if (pfloor->flags & FF_FOG || (frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG))); else if (curline->v1->y == curline->v2->y) lightnum--; else if (curline->v1->x == curline->v2->x) diff --git a/src/r_things.c b/src/r_things.c index ca285644f..cf81e3e04 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1094,8 +1094,8 @@ static void R_SplitSprite(vissprite_t *sprite) newsprite->extra_colormap = *sector->lightlist[i].extra_colormap; - if (!((newsprite->cut & SC_FULLBRIGHT) - && (!newsprite->extra_colormap || !(newsprite->extra_colormap->fog & 1)))) + if (!(newsprite->cut & SC_FULLBRIGHT) + || (newsprite->extra_colormap && (newsprite->extra_colormap->flags & CMF_FADEFULLBRIGHTSPRITES))) { lindex = FixedMul(sprite->xscale, FixedDiv(640, vid.width))>>(LIGHTSCALESHIFT); @@ -1882,7 +1882,7 @@ static void R_ProjectSprite(mobj_t *thing) vis->cut |= SC_FULLBRIGHT; if (vis->cut & SC_FULLBRIGHT - && (!vis->extra_colormap || !(vis->extra_colormap->fog & 1))) + && (!vis->extra_colormap || !(vis->extra_colormap->flags & CMF_FADEFULLBRIGHTSPRITES))) { // full bright: goggles vis->colormap = colormaps; From cb97aafd054a1f888a89db53232c135feb282205 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 16 Feb 2020 18:45:49 -0500 Subject: [PATCH 123/139] 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 124/139] 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 125/139] 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 126/139] 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 // From ae53c146e6302227134d29d17800b37a6871398f Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 16 Feb 2020 21:32:03 -0600 Subject: [PATCH 127/139] Allow SHOWTITLECARDFOR = NONE --- src/dehacked.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 63cfc8d41..875518b40 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1841,7 +1841,7 @@ static void readlevelheader(MYFILE *f, INT32 num) mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARDRECORDATTACK; else if (fastcmp(tmp, "ALL")) mapheaderinfo[num-1]->levelflags &= ~LF_NOTITLECARD; - else + else if (!fastcmp(tmp, "NONE")) deh_warning("Level header %d: unknown titlecard show option %s\n", num, tmp); } while((tmp = strtok(NULL,",")) != NULL); From 0fbff66e25a96872364d3870f0f7dc04e05c1fac Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sat, 1 Feb 2020 20:02:14 -0600 Subject: [PATCH 128/139] Let scripters see if player just launched from slope --- src/d_player.h | 1 + src/dehacked.c | 3 ++- src/p_mobj.c | 9 +++++++-- src/p_slopes.c | 3 +++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index db55a9913..7ff4ce2a2 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -278,6 +278,7 @@ typedef enum pw_nights_linkfreeze, pw_nocontrol, //for linedef exec 427 + pw_justlaunched, // Launched off a slope this tic (0=none, 1=standard launch, 2=half-pipe launch) NUMPOWERS } powertype_t; diff --git a/src/dehacked.c b/src/dehacked.c index 6093d6fd6..aa6acdb69 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -9138,7 +9138,8 @@ static const char *const POWERS_LIST[] = { "NIGHTS_LINKFREEZE", //for linedef exec 427 - "NOCONTROL" + "NOCONTROL", + "JUSTLAUNCHED", }; static const char *const HUDITEMS_LIST[] = { diff --git a/src/p_mobj.c b/src/p_mobj.c index 10898f70e..03ca56aa8 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1997,8 +1997,12 @@ void P_XYMovement(mobj_t *mo) { mo->momz = transfermomz; mo->standingslope = NULL; - if (player && (player->pflags & PF_SPINNING)) - player->pflags |= PF_THOKKED; + if (player) + { + player->powers[pw_justlaunched] = 2; + if (player->pflags & PF_SPINNING) + player->pflags |= PF_THOKKED; + } } } #endif @@ -3922,6 +3926,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) // Needed for gravity boots P_CheckGravity(mobj, false); + mobj->player->powers[pw_justlaunched] = 0; if (mobj->momx || mobj->momy) { P_XYMovement(mobj); diff --git a/src/p_slopes.c b/src/p_slopes.c index d584bb92d..6d5930882 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -726,6 +726,9 @@ void P_SlopeLaunch(mobj_t *mo) //CONS_Printf("Launched off of slope.\n"); mo->standingslope = NULL; + + if (mo->player) + mo->player->powers[pw_justlaunched] = 1; } // From 9e83e2751df383c0f6fb1bcd4d68554f89a86271 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 17 Feb 2020 00:36:10 -0300 Subject: [PATCH 129/139] Clear setrenderneeded after calling VID_CheckRenderer --- src/d_main.c | 4 +++- src/sdl/i_video.c | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 2ff0042fd..6616dfaa6 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1291,12 +1291,14 @@ void D_SRB2Main(void) // Lactozilla: Does the render mode need to change? if ((setrenderneeded != 0) && (setrenderneeded != rendermode)) { + CONS_Printf("Switching the renderer...\n"); needpatchflush = true; needpatchrecache = true; VID_CheckRenderer(); SCR_ChangeRendererCVars(setrenderneeded); + D_CheckRendererState(); + setrenderneeded = 0; } - D_CheckRendererState(); wipegamestate = gamestate; diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 13e2423c4..7af1863ab 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1499,7 +1499,6 @@ void VID_CheckRenderer(void) { I_StartupHardwareGraphics(); R_InitHardwareMode(); - HWR_Switch(); } #endif } From 07d71778dc8093b88f5c5665f55b83fb042e4ae0 Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Sat, 1 Feb 2020 22:11:21 -0500 Subject: [PATCH 130/139] FIX COLOR BUG --- src/hardware/hw_data.h | 1 - src/hardware/hw_md2.c | 57 ++++++++++++++++++------------------------ src/p_setup.c | 5 ++++ src/w_wad.c | 2 +- src/z_zone.c | 2 ++ src/z_zone.h | 1 + 6 files changed, 33 insertions(+), 35 deletions(-) diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index f525e041f..ef57426a4 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -48,7 +48,6 @@ struct GLMipmap_s struct GLMipmap_s *nextcolormap; const UINT8 *colormap; - INT32 tcindex; // opengl struct GLMipmap_s *nextmipmap; // opengl : liste of all texture in opengl driver diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index a107a6d05..f24976c60 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1020,32 +1020,13 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT // mostly copied from HWR_GetMappedPatch, hence the similarities and comment GLMipmap_t *grmip, *newmip; - if ((colormap == colormaps || colormap == NULL) && (skinnum > TC_DEFAULT)) + if (colormap == colormaps || colormap == NULL) { // Don't do any blending HWD.pfnSetTexture(gpatch->mipmap); return; } - // search for the mipmap - // skip the first (no colormap translated) - for (grmip = gpatch->mipmap; grmip->nextcolormap; ) - { - grmip = grmip->nextcolormap; - if (grmip->colormap == colormap || (skinnum < TC_DEFAULT && grmip->tcindex == skinnum)) - { - if (grmip->downloaded && grmip->grInfo.data) - { - HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture - Z_ChangeTag(grmip->grInfo.data, PU_HWRMODELTEXTURE); - return; - } - } - } - - // If here, the blended texture has not been created - // So we create it - if ((blendgpatch && blendgpatch->mipmap->grInfo.format) && (gpatch->width != blendgpatch->width || gpatch->height != blendgpatch->height)) { @@ -1054,21 +1035,39 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT return; } + // search for the mipmap + // skip the first (no colormap translated) + for (grmip = gpatch->mipmap; grmip->nextcolormap; ) + { + grmip = grmip->nextcolormap; + if (grmip->colormap == colormap) + { + if (grmip->downloaded && grmip->grInfo.data) + { + HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture + Z_ChangeTag(grmip->grInfo.data, PU_HWRMODELTEXTURE_UNLOCKED); + return; + } + } + } + + // If here, the blended texture has not been created + // So we create it + //BP: WARNING: don't free it manually without clearing the cache of harware renderer // (it have a liste of mipmap) // this malloc is cleared in HWR_FreeTextureCache // (...) unfortunately z_malloc fragment alot the memory :(so malloc is better newmip = calloc(1, sizeof (*newmip)); if (newmip == NULL) - I_Error("%s: Out of memory", "HWR_GetMappedPatch"); + I_Error("%s: Out of memory", "HWR_GetBlendedTexture"); grmip->nextcolormap = newmip; newmip->colormap = colormap; - newmip->tcindex = skinnum; HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color); HWD.pfnSetTexture(newmip); - Z_ChangeTag(newmip->grInfo.data, PU_HWRMODELTEXTURE); + Z_ChangeTag(newmip->grInfo.data, PU_HWRMODELTEXTURE_UNLOCKED); } #define NORMALFOG 0x00000000 @@ -1298,7 +1297,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr) if (gpatch && gpatch->mipmap->grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture { - INT32 skinnum = INT32_MAX; + INT32 skinnum = TC_DEFAULT; if ((spr->mobj->flags & (MF_ENEMY|MF_BOSS)) && (spr->mobj->flags2 & MF2_FRET) && !(spr->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash" { @@ -1329,15 +1328,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr) } // Translation or skin number found - if (skinnum != INT32_MAX) - { - HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, skinnum, spr->colormap, (skincolors_t)spr->mobj->color); - } - else - { - // Sorry nothing - HWD.pfnSetTexture(gpatch->mipmap); - } + HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, skinnum, spr->colormap, (skincolors_t)spr->mobj->color); } else { diff --git a/src/p_setup.c b/src/p_setup.c index c291dc7c3..64671c1ee 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3699,10 +3699,15 @@ void HWR_SetupLevel(void) // Meaning, they had memory allocated and marked with the PU_LEVEL tag. // Level textures are only reloaded after R_LoadTextures, which is // when the texture list is loaded. + + // Sal: Unfortunately, NOT freeing them causes the dreaded Color Bug. + HWR_FreeMipmapCache(); + #ifdef ALAM_LIGHTING // BP: reset light between levels (we draw preview frame lights on current frame) HWR_ResetLights(); #endif + // Correct missing sidedefs & deep water trick HWR_CorrectSWTricks(); HWR_CreatePlanePolygons((INT32)numnodes - 1); diff --git a/src/w_wad.c b/src/w_wad.c index e544378c8..bfadd9081 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1475,7 +1475,7 @@ void W_FlushCachedPatches(void) Z_FreeTag(PU_HWRPATCHINFO); Z_FreeTag(PU_HWRMODELTEXTURE); Z_FreeTag(PU_HWRCACHE); - Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRPATCHINFO_UNLOCKED); + Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRMODELTEXTURE_UNLOCKED); } needpatchflush = false; } diff --git a/src/z_zone.c b/src/z_zone.c index e0e37312a..8cd2f7ead 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -519,6 +519,7 @@ void Z_FlushCachedPatches(void) Z_FreeTag(PU_HWRCACHE); Z_FreeTag(PU_HWRCACHE_UNLOCKED); Z_FreeTag(PU_HWRPATCHINFO_UNLOCKED); + Z_FreeTag(PU_HWRMODELTEXTURE_UNLOCKED); } // happens before a renderer switch @@ -816,6 +817,7 @@ static void Command_Memfree_f(void) CONS_Printf(M_GetText("HW Texture cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10)); CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10)); CONS_Printf(M_GetText("HW Texture used : %7d KB\n"), HWR_GetTextureUsed()>>10); + CONS_Printf(M_GetText("HW model textures : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRMODELTEXTURE)>>10)); } #endif diff --git a/src/z_zone.h b/src/z_zone.h index 9e5f74343..250885e10 100644 --- a/src/z_zone.h +++ b/src/z_zone.h @@ -64,6 +64,7 @@ enum // 'second-level' cache for graphics // stored in hardware format and downloaded as needed PU_HWRPATCHINFO_UNLOCKED = 103, // 'unlocked' PU_HWRPATCHINFO memory + PU_HWRMODELTEXTURE_UNLOCKED = 104, // 'unlocked' PU_HWRMODELTEXTURE memory }; // From 067a2667e3dcc83261961b403acd4338fb6a0245 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Sat, 8 Feb 2020 18:27:44 -0300 Subject: [PATCH 131/139] move hw texture used to be always below. --- src/z_zone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/z_zone.c b/src/z_zone.c index 8cd2f7ead..e06f7bf1a 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -816,8 +816,8 @@ static void Command_Memfree_f(void) CONS_Printf(M_GetText("Mipmap patches : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHCOLMIPMAP)>>10)); CONS_Printf(M_GetText("HW Texture cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10)); CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10)); - CONS_Printf(M_GetText("HW Texture used : %7d KB\n"), HWR_GetTextureUsed()>>10); CONS_Printf(M_GetText("HW model textures : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRMODELTEXTURE)>>10)); + CONS_Printf(M_GetText("HW Texture used : %7d KB\n"), HWR_GetTextureUsed()>>10); } #endif From f4c2a4551bf1f45113ef7a1f74d41f8238908e09 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 16 Feb 2020 20:45:09 -0800 Subject: [PATCH 132/139] How many bruh moments can we have? --- src/r_segs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_segs.c b/src/r_segs.c index 88897ab8e..df998898f 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -438,7 +438,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) else { if ((colfunc != colfuncs[COLDRAWFUNC_FUZZY]) - || frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG)) + || (frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG))) lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT); else lightnum = LIGHTLEVELS - 1; From b3933c7842ccff52c1c5b61fbb904459f86dd654 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 17 Feb 2020 22:59:36 -0300 Subject: [PATCH 133/139] Fix R_CacheRotSprite not working with PNG lumps --- src/r_patch.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/r_patch.c b/src/r_patch.c index 80c0f846f..4304f3eab 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -1212,14 +1212,23 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp INT32 width, height, leftoffset; fixed_t ca, sa; lumpnum_t lump = sprframe->lumppat[rot]; + size_t lumplength; if (lump == LUMPERROR) return; + + patch = (patch_t *)W_CacheLumpNum(lump, PU_STATIC); + lumplength = W_LumpLength(lump); + +#ifndef NO_PNG_LUMPS + if (R_IsLumpPNG((UINT8 *)patch, lumplength)) + patch = R_PNGToPatch((UINT8 *)patch, lumplength, NULL); + else +#endif // Because there's something wrong with SPR_DFLM, I guess if (!R_CheckIfPatch(lump)) return; - patch = (patch_t *)W_CacheLumpNum(lump, PU_STATIC); width = patch->width; height = patch->height; leftoffset = patch->leftoffset; From 369fd8e35f430abaef47e744f1f869e59fbd92ee Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 17 Feb 2020 23:06:38 -0300 Subject: [PATCH 134/139] Fix LUAh_SeenPlayer not working --- src/lua_hooklib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 306bf6839..f9dad6cb7 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -1594,7 +1594,7 @@ boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend) hook_p hookp; boolean hasSeenPlayer = true; if (!gL || !(hooksAvailable[hook_SeenPlayer/8] & (1<<(hook_SeenPlayer%8)))) - return 0; + return true; lua_settop(gL, 0); hud_running = true; // local hook From e3ba369ae4dd239b93c2aa812f0eb8e1b227aa42 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 17 Feb 2020 19:38:14 -0800 Subject: [PATCH 135/139] Fix M_Ftrim - Use '%f' instead of '%g' to avoid going scientific. Should also fix some compiler warnings. - The trailing zero trimming code is now useful. It started on the terminating byte before and wouldn't have done anything with '%g' anyway. - Use the absolute fractional value to avoid a sign. --- src/m_misc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/m_misc.c b/src/m_misc.c index 3dfeef81e..d762712b6 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -2618,14 +2618,15 @@ const char * M_Ftrim (double f) static char dig[9];/* "0." + 6 digits (6 is printf's default) */ int i; /* I know I said it's the default, but just in case... */ - sprintf(dig, "%.6g", modf(f, &f)); - if (dig[0]) + sprintf(dig, "%.6f", fabs(modf(f, &f))); + /* trim trailing zeroes */ + for (i = strlen(dig)-1; dig[i] == '0'; --i) + ; + if (dig[i] == '.')/* :NOTHING: */ + return ""; + else { - for (i = strlen(dig); dig[i] == '0'; --i) - ; dig[i + 1] = '\0'; return &dig[1];/* skip the 0 */ } - else - return ""; } From c76a8e8a58fbd89813b8c5940dbb972dca4cf429 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Tue, 18 Feb 2020 22:19:09 -0300 Subject: [PATCH 136/139] Standards --- src/p_mobj.c | 57 ++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index f53f2a7d5..299083b03 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7996,6 +7996,37 @@ static void P_MobjSceneryThink(mobj_t *mobj) mobj->frame = (mobj->frame & ~FF_TRANSMASK) | ((10 - (mobj->fuse*2)) << (FF_TRANSSHIFT)); } break; + case MT_FINISHFLAG: + { + if (!mobj->target || mobj->target->player->playerstate == PST_DEAD || !cv_exitmove.value) + { + P_RemoveMobj(mobj); + return; + } + + if (!camera.chase) + mobj->flags2 |= MF2_DONTDRAW; + else + mobj->flags2 &= ~MF2_DONTDRAW; + + P_UnsetThingPosition(mobj); + { + fixed_t radius = FixedMul(10*mobj->info->speed, mobj->target->scale); + angle_t fa; + + mobj->angle += FixedAngle(mobj->info->speed); + + fa = mobj->angle >> ANGLETOFINESHIFT; + + mobj->x = mobj->target->x + FixedMul(FINECOSINE(fa),radius); + mobj->y = mobj->target->y + FixedMul(FINESINE(fa),radius); + mobj->z = mobj->target->z + mobj->target->height/2; + } + P_SetThingPosition(mobj); + + P_SetScale(mobj, mobj->target->scale); + } + break; case MT_VWREF: case MT_VWREB: { @@ -8006,32 +8037,6 @@ static void P_MobjSceneryThink(mobj_t *mobj) if (strength < 10) mobj->frame |= ((10 - strength) << (FF_TRANSSHIFT)); } - case MT_FINISHFLAG: - { - if (!mobj->target || mobj->target->player->playerstate == PST_DEAD || !cv_exitmove.value) - { - P_RemoveMobj(mobj); - return; - } - - if (!camera.chase) - mobj->flags2 |= MF2_DONTDRAW; - else - mobj->flags2 &= ~MF2_DONTDRAW; - - fixed_t radius = FixedMul(10*mobj->info->speed, mobj->target->scale); - mobj->angle += FixedAngle(mobj->info->speed); - angle_t fa = mobj->angle >> ANGLETOFINESHIFT; - - P_UnsetThingPosition(mobj); - - mobj->x = mobj->target->x + FixedMul(FINECOSINE(fa),radius); - mobj->y = mobj->target->y + FixedMul(FINESINE(fa),radius); - mobj->z = mobj->target->z + mobj->target->height/2; - - P_SetThingPosition(mobj); - P_SetScale(mobj, mobj->target->scale); - } /* FALLTHRU */ default: if (mobj->fuse) From ec67e776dcb0c388e50814caa0ade52d465500bc Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Tue, 18 Feb 2020 22:50:22 -0300 Subject: [PATCH 137/139] Standards 2 --- src/p_user.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 38f7f2719..85fa32acf 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -378,11 +378,11 @@ void P_GiveEmerald(boolean spawnObj) // void P_GiveFinishFlags(player_t *player) { + angle_t angle = FixedAngle(player->mo->angle << FRACBITS); + if (!player->mo) return; - - angle_t angle = FixedAngle(player->mo->angle << FRACBITS); - + for (UINT8 i = 0; i < 3; i++) { angle_t fa = (angle >> ANGLETOFINESHIFT) & FINEMASK; From 4a8de7cb55dda9dbc4eb86319ce0c3300fec07ee Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Tue, 18 Feb 2020 22:55:40 -0300 Subject: [PATCH 138/139] Enough --- 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 85fa32acf..c9efe7596 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -379,11 +379,12 @@ void P_GiveEmerald(boolean spawnObj) void P_GiveFinishFlags(player_t *player) { angle_t angle = FixedAngle(player->mo->angle << FRACBITS); + UINT8 i; if (!player->mo) return; - for (UINT8 i = 0; i < 3; i++) + for (i = 0; i < 3; i++) { angle_t fa = (angle >> ANGLETOFINESHIFT) & FINEMASK; fixed_t xoffs = FINECOSINE(fa); From 08627752b20b7ab4754bc5c4ac45a173bb36e0a0 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 20 Feb 2020 17:25:15 -0800 Subject: [PATCH 139/139] Fix NOPNG compiling --- src/r_patch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/r_patch.c b/src/r_patch.c index 4304f3eab..9e31d4d19 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -1212,15 +1212,17 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp INT32 width, height, leftoffset; fixed_t ca, sa; lumpnum_t lump = sprframe->lumppat[rot]; +#ifndef NO_PNG_LUMPS size_t lumplength; +#endif if (lump == LUMPERROR) return; patch = (patch_t *)W_CacheLumpNum(lump, PU_STATIC); +#ifndef NO_PNG_LUMPS lumplength = W_LumpLength(lump); -#ifndef NO_PNG_LUMPS if (R_IsLumpPNG((UINT8 *)patch, lumplength)) patch = R_PNGToPatch((UINT8 *)patch, lumplength, NULL); else