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) 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, }; 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..261ffb9d5 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, @@ -1823,7 +1861,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 +1902,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 +1943,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 +1984,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 +2024,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 +2036,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 +2065,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); @@ -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; } } } @@ -2072,7 +2110,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 +2149,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; 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/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! 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")) diff --git a/src/p_user.c b/src/p_user.c index c144c04bd..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,6 +3625,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] && !affected_by_loop) { + // 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, 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;