From 897fe3b1b8000b740fe6285201bdb00eb2e9ae16 Mon Sep 17 00:00:00 2001 From: JugadorXEI Date: Fri, 31 May 2024 17:03:51 +0200 Subject: [PATCH 1/8] Fix off-by-one error in BRIGHT and TERRAIN lump parsing --- src/k_brightmap.c | 4 ++-- src/k_terrain.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/k_brightmap.c b/src/k_brightmap.c index a13ea65af..25e9e47c9 100644 --- a/src/k_brightmap.c +++ b/src/k_brightmap.c @@ -112,7 +112,7 @@ static boolean K_BRIGHTLumpParser(char *data, size_t size) tkn = M_GetToken(NULL); pos = M_GetTokenPos(); - if (tkn && pos < size) + if (tkn && pos <= size) { brightmapStorage_t *bms = K_GetBrightmapStorageByTextureName(tkn); @@ -127,7 +127,7 @@ static boolean K_BRIGHTLumpParser(char *data, size_t size) tkn = M_GetToken(NULL); pos = M_GetTokenPos(); - if (tkn && pos < size) + if (tkn && pos <= size) { strncpy(bms->brightmapName, tkn, 8); bms->brightmapHash = quickncasehash(tkn, 8); diff --git a/src/k_terrain.c b/src/k_terrain.c index b493c903c..189c17dc1 100644 --- a/src/k_terrain.c +++ b/src/k_terrain.c @@ -1823,7 +1823,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size) tkn = M_GetToken(NULL); pos = M_GetTokenPos(); - if (tkn && pos < size) + if (tkn && pos <= size) { t_splash_t *s = NULL; @@ -1864,7 +1864,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size) tkn = M_GetToken(NULL); pos = M_GetTokenPos(); - if (tkn && pos < size) + if (tkn && pos <= size) { t_footstep_t *fs = NULL; @@ -1905,7 +1905,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size) tkn = M_GetToken(NULL); pos = M_GetTokenPos(); - if (tkn && pos < size) + if (tkn && pos <= size) { t_overlay_t *o = NULL; @@ -1946,7 +1946,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size) tkn = M_GetToken(NULL); pos = M_GetTokenPos(); - if (tkn && pos < size) + if (tkn && pos <= size) { terrain_t *t = NULL; @@ -1986,8 +1986,8 @@ static boolean K_TERRAINLumpParser(char *data, size_t size) Z_Free(tkn); tkn = M_GetToken(NULL); pos = M_GetTokenPos(); - - if (tkn && pos < size) + + if (tkn && pos <= size) { if (stricmp(tkn, "optional") == 0) { @@ -1998,7 +1998,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size) pos = M_GetTokenPos(); } - if (tkn && pos < size) + if (tkn && pos <= size) { t_floor_t *f = NULL; @@ -2027,7 +2027,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size) tkn = M_GetToken(NULL); pos = M_GetTokenPos(); - if (tkn && pos < size) + if (tkn && pos <= size) { terrain_t *t = K_GetTerrainByName(tkn); @@ -2072,7 +2072,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size) tkn = M_GetToken(NULL); pos = M_GetTokenPos(); - if (tkn && pos < size) + if (tkn && pos <= size) { terrain_t *t = NULL; @@ -2111,7 +2111,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size) tkn = M_GetToken(NULL); pos = M_GetTokenPos(); - if (tkn && pos < size) + if (tkn && pos <= size) { t_footstep_t *fs = NULL; From 2891f603417cd1b604ac8d6e98f3b21e960629a2 Mon Sep 17 00:00:00 2001 From: JugadorXEI Date: Fri, 31 May 2024 21:15:40 +0200 Subject: [PATCH 2/8] Store terrain ID instead of terrain pointer, add new helpers and accomodate for this --- src/k_terrain.c | 42 ++++++++++++++++++++++++++++++++++++++++-- src/k_terrain.h | 29 +++++++++++++++++++++++++++++ src/r_textures.c | 6 +++--- src/r_textures.h | 2 +- 4 files changed, 73 insertions(+), 6 deletions(-) diff --git a/src/k_terrain.c b/src/k_terrain.c index b493c903c..7d2226505 100644 --- a/src/k_terrain.c +++ b/src/k_terrain.c @@ -332,6 +332,16 @@ terrain_t *K_GetDefaultTerrain(void) return K_GetTerrainByIndex(defaultTerrain); } +/*-------------------------------------------------- + size_t K_GetDefaultTerrainID(void) + + See header file for description. +--------------------------------------------------*/ +size_t K_GetDefaultTerrainID(void) +{ + return defaultTerrain; +} + /*-------------------------------------------------- terrain_t *K_GetTerrainForTextureName(const char *checkName) @@ -360,6 +370,34 @@ terrain_t *K_GetTerrainForTextureName(const char *checkName) return K_GetDefaultTerrain(); } +/*-------------------------------------------------- + size_t K_GetTerrainIDForTextureName(const char *checkName) + + See header file for description. +--------------------------------------------------*/ +size_t K_GetTerrainIDForTextureName(const char *checkName) +{ + UINT32 checkHash = quickncasehash(checkName, 8); + size_t i; + + if (numTerrainFloorDefs > 0) + { + for (i = 0; i < numTerrainFloorDefs; i++) + { + t_floor_t *f = &terrainFloorDefs[i]; + + if (checkHash == f->textureHash && !strncasecmp(checkName, f->textureName, 8)) + { + return f->terrainID; + } + } + } + + // This texture doesn't have a terrain directly applied to it, + // so we fallback to the default terrain. + return K_GetDefaultTerrainID(); +} + /*-------------------------------------------------- terrain_t *K_GetTerrainForTextureNum(INT32 textureNum) @@ -370,7 +408,7 @@ terrain_t *K_GetTerrainForTextureNum(INT32 textureNum) if (textureNum >= 0 && textureNum < numtextures) { texture_t *tex = textures[textureNum]; - return tex->terrain; + return K_GetTerrainByIndex(tex->terrainID); } // This texture doesn't have a terrain directly applied to it, @@ -2044,7 +2082,7 @@ static boolean K_TERRAINLumpParser(char *data, size_t size) INT32 tex = R_CheckTextureNumForName(f->textureName); if (tex != -1) { - textures[tex]->terrain = t; + textures[tex]->terrainID = f->terrainID; } } } diff --git a/src/k_terrain.h b/src/k_terrain.h index 314b83af6..10c862261 100644 --- a/src/k_terrain.h +++ b/src/k_terrain.h @@ -398,6 +398,19 @@ terrain_t *K_GetTerrainByName(const char *checkName); terrain_t *K_GetDefaultTerrain(void); +/*-------------------------------------------------- + size_t K_GetDefaultTerrainID(void) + + Returns the default terrain definition's ID, used + in cases where terrain is not set for a texture. + + Input Arguments:- + None + + Return:- + The default terrain definition's ID, NULL if it didn't exist. +--------------------------------------------------*/ +size_t K_GetDefaultTerrainID(void); /*-------------------------------------------------- terrain_t *K_GetTerrainForTextureName(const char *checkName); @@ -417,6 +430,22 @@ terrain_t *K_GetDefaultTerrain(void); terrain_t *K_GetTerrainForTextureName(const char *checkName); +/*-------------------------------------------------- + size_t K_GetTerrainIDForTextureName(const char *checkName) + + Returns the ID of the terrain definition applied + to the texture name inputted. + + Input Arguments:- + checkName - The texture's name. + + Return:- + The texture's terrain definition's ID if it exists, + otherwise the default terrain's ID if it exists, + otherwise NULL. +--------------------------------------------------*/ +size_t K_GetTerrainIDForTextureName(const char *checkName); + /*-------------------------------------------------- terrain_t *K_GetTerrainForTextureNum(INT32 textureNum); diff --git a/src/r_textures.c b/src/r_textures.c index 40e504610..919036e1e 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -1197,7 +1197,7 @@ Rloadflats (INT32 i, INT32 w) texture->patchcount = 1; texture->holes = false; texture->flip = 0; - texture->terrain = K_GetTerrainForTextureName(texture->name); + texture->terrainID = K_GetTerrainIDForTextureName(texture->name); // Allocate information for the texture's patches. patch = &texture->patches[0]; @@ -1335,7 +1335,7 @@ Rloadtextures (INT32 i, INT32 w) texture->patchcount = 1; texture->holes = false; texture->flip = 0; - texture->terrain = K_GetTerrainForTextureName(texture->name); + texture->terrainID = K_GetTerrainIDForTextureName(texture->name); // Allocate information for the texture's patches. patch = &texture->patches[0]; @@ -1877,7 +1877,7 @@ static texture_t *R_ParseTexture(boolean actuallyLoadTexture) resultTexture->width = newTextureWidth; resultTexture->height = newTextureHeight; resultTexture->type = TEXTURETYPE_COMPOSITE; - resultTexture->terrain = K_GetTerrainForTextureName(newTextureName); + resultTexture->terrainID = K_GetTerrainIDForTextureName(newTextureName); } Z_Free(texturesToken); texturesToken = M_GetToken(NULL); diff --git a/src/r_textures.h b/src/r_textures.h index b1079d81e..88ef22a8a 100644 --- a/src/r_textures.h +++ b/src/r_textures.h @@ -63,7 +63,7 @@ struct texture_t boolean holes; UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both void *flat; // The texture, as a flat. - terrain_t *terrain; + size_t terrainID; // All the patches[patchcount] are drawn back to front into the cached texture. INT16 patchcount; From 6185771f0cd04763c18e6c77bb35da1116225db3 Mon Sep 17 00:00:00 2001 From: hayaunderscore Date: Tue, 4 Jun 2024 09:45:47 +0800 Subject: [PATCH 3/8] Check if skin number is postive before setting replay skin colormaps Fixes #200. --- src/lua_hudlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 824825fe7..3e69f1067 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -1045,7 +1045,7 @@ static int libd_getColormap(lua_State *L) skinnum = i; } - if (demo.playback) + if (demo.playback && skinnum >= 0) skinnum = demo.skinlist[skinnum].mapping; // all was successful above, now we generate the colormap at last! From c8d57c995375c51f9afb4ab3de170984a8df88a5 Mon Sep 17 00:00:00 2001 From: Ibly Date: Tue, 11 Jun 2024 19:41:30 +0000 Subject: [PATCH 4/8] Fixed copy and paste error for "lastpickupdistance" --- src/lua_playerlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 8bd5821db..992e3e6c9 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -795,7 +795,7 @@ static int player_set(lua_State *L) else if (fastcmp(field,"distancetofinishprev")) return NOSET; else if (fastcmp(field,"lastpickupdistance")) - plr->airtime = luaL_checkinteger(L, 3); + plr->lastpickupdistance = luaL_checkinteger(L, 3); else if (fastcmp(field,"airtime")) plr->airtime = luaL_checkinteger(L, 3); else if (fastcmp(field,"lastairtime")) From c62dfa20d2655603d6c8c94f8afd145bddf2c18a Mon Sep 17 00:00:00 2001 From: Kimberly Wilber Date: Sat, 15 Jun 2024 13:54:42 -0400 Subject: [PATCH 5/8] Disable camera dampening when looking backwards. When traveling quickly, camera dampening normally causes the camera to get further away from the player, but it screws up camera angles when looking backwards. This change causes camera dampening to happen instantly when looking behind. That way, players can expect the camera to always be in a consistent location when they tap the "look behind" button. --- src/p_user.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index c144c04bd..5b074a848 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3622,6 +3622,14 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall thiscam->momx = x - thiscam->x; thiscam->momy = y - thiscam->y; + if (lookback && lookbackdelay[num]) { + // when looking back, camera's momentum + // should inherit the momentum of the player + // plus extra + thiscam->momx += 2*mo->momx; + thiscam->momy += 2*mo->momy; + } + fixed_t z_speed = Easing_Linear( player->karthud[khud_aircam], camspeed * 3 / 5, From c4154470b9778fac16a42458bb91c4634f04a97e Mon Sep 17 00:00:00 2001 From: Kimberly Wilber Date: Sun, 16 Jun 2024 15:00:55 -0400 Subject: [PATCH 6/8] Disable camera lookback during loops. --- src/p_user.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 5b074a848..c712bec7c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3193,6 +3193,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall sonicloopcamvars_t *loop = &player->loop.camera; tic_t loop_out = leveltime - loop->enter_tic; tic_t loop_in = max(leveltime, loop->exit_tic) - loop->exit_tic; + boolean affected_by_loop = (loop_out <= + (loop->zoom_in_speed + loop->zoom_out_speed) && leveltime > introtime); thiscam->old_x = thiscam->x; thiscam->old_y = thiscam->y; @@ -3406,8 +3408,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } else if (player->exiting) // SRB2Kart: Leave the camera behind while exiting, for dramatic effect! camstill = true; - else if (lookback || lookbackdelay[num]) // SRB2kart - Camera flipper + else if ((lookback || lookbackdelay[num]) && !affected_by_loop) { + // SRB2Kart -- Camera flip when looking backwards #define MAXLOOKBACKDELAY 2 camspeed = FRACUNIT; if (lookback) @@ -3622,7 +3625,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall thiscam->momx = x - thiscam->x; thiscam->momy = y - thiscam->y; - if (lookback && lookbackdelay[num]) { + if (lookback && lookbackdelay[num] && !affected_by_loop) { // when looking back, camera's momentum // should inherit the momentum of the player // plus extra From 41ef8d227f3ce62a396743b50b23144655a5aeb0 Mon Sep 17 00:00:00 2001 From: JugadorXEI Date: Fri, 9 Aug 2024 04:52:02 +0000 Subject: [PATCH 7/8] Fix reversed inputs in input display in encore replay --- src/hud/input-display.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hud/input-display.cpp b/src/hud/input-display.cpp index ae995e705..31779a7ef 100644 --- a/src/hud/input-display.cpp +++ b/src/hud/input-display.cpp @@ -104,7 +104,7 @@ void K_DrawInputDisplay(float x, float y, INT32 flags, char mode, UINT8 pid, boo (G_PlayerInputAnalog(pid, gc_up, guessinput) - G_PlayerInputAnalog(pid, gc_down, guessinput)) / (float)JOYAXISRANGE, } : Vec2 { - -cmd.turning / (float)KART_FULLTURN, + -cmd.turning * (encoremode ? -1 : 1) / (float)KART_FULLTURN, cmd.throwdir / (float)KART_FULLTURN, }; From 83c420f512998d9e45b8640f425a08aeeffc61d4 Mon Sep 17 00:00:00 2001 From: SMS Alfredo Date: Fri, 9 Aug 2024 05:16:55 +0000 Subject: [PATCH 8/8] Allow Skipping through the Sega Logo Faster --- src/f_finale.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 566d25ca7..a7b9ab9e1 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -855,8 +855,8 @@ void F_IntroTicker(void) const boolean disclaimerskippable = ( intro_scenenum == INTROSCENE_DISCLAIMER - && dc_state == DISCLAIMER_FINAL - && dc_tics >= (TICRATE/2) + (5*6) // bottom text needs to fade all the way in + && (dc_state < DISCLAIMER_SLIDE + || (dc_state == DISCLAIMER_FINAL && dc_textfade == 0)) // bottom text needs to fade all the way in ); const boolean doskip = ( @@ -874,7 +874,15 @@ void F_IntroTicker(void) if (doskip && disclaimerskippable) { - dc_state = DISCLAIMER_OUT; + if (dc_state == DISCLAIMER_FINAL) { + dc_state = DISCLAIMER_OUT; + I_FadeOutStopSong(MUSICRATE*2/3); + } else { + if (dc_state <= DISCLAIMER_FADE) + Music_Play("lawyer"); + dc_state = DISCLAIMER_SLIDE; + dc_segaframe = 23; + } dc_tics = 0; } else if (doskip || timetonext <= 0)