Compare commits

..
Author SHA1 Message Date
alufolie91 794fda5ac5 fix issues with interpolation when spawning mobjs
fixes them seemingly coming really fast out of nowhere
needs testing as this may break some things from addons
2026-07-21 15:58:34 +02:00
6 changed files with 23 additions and 155 deletions

No files matched your search

-2
View File
@@ -3087,8 +3087,6 @@ static int lib_gPlayerDeviceRumble(lua_State *L)
if (!player)
return LUA_ErrInvalid(L, "player_t");
if (demo.playback) return 0;
pnum = P_GetLocalPlayerNumForPlayer(player);
// Not a local player
-6
View File
@@ -3106,12 +3106,6 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
// set up world state
P_SpawnSpecials(fromnetsave, reloadinggamestate);
// stupid hack but handle skipintromus and fanfare here
// lines and other map data have not been init yet
// in the original place for this
if (!reloadinggamestate)
S_HandleMusicStart();
if (!fromnetsave) // ugly hack for P_NetUnArchiveMisc (and P_LoadNetGame)
P_SpawnPrecipitation();
+1 -3
View File
@@ -2067,7 +2067,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
INT32 sfxnum;
//dont play any funky sound intros that may interfere with the music
if ((skipintromus == 1 || keepmapmusic) && (leveltime < MUSICSTARTTIME))
if ((skipintromus || keepmapmusic) && (leveltime < MUSICSTARTTIME))
return;
sfxnum = sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS;
@@ -2081,8 +2081,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
return;
}
//CONS_Printf("%s\n", S_sfx[sfxnum].name);
if (line->tag != 0) // Do special stuff only if a non-zero linedef tag is set
{
if (line->flags & ML_EFFECT5) // Repeat Midtexture
+8 -4
View File
@@ -340,14 +340,18 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
return;
}
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
const boolean doreset = mobj->resetinterp && (mobj->type != MT_GHOST) && (mobj->type != MT_PLAYERRETICULE) && (mobj->type != MT_SHADOW);
out->x = doreset ? mobj->x : R_LerpFixed(mobj->old_x, mobj->x, frac);
out->y = doreset ? mobj->y : R_LerpFixed(mobj->old_y, mobj->y, frac);
out->z = doreset ? mobj->z : R_LerpFixed(mobj->old_z, mobj->z, frac);
out->scale = mobj->resetinterp ? mobj->scale : R_LerpFixed(mobj->old_scale, mobj->scale, frac);
out->spritexscale = mobj->resetinterp ? mobj->spritexscale : R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac);
out->spriteyscale = mobj->resetinterp ? mobj->spriteyscale : R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac);
out->spritexoffset = mobj->resetinterp ? mobj->spritexoffset : R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac);
out->spriteyoffset = mobj->resetinterp ? mobj->spriteyoffset : R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac);
out->scale = mobj->resetinterp ? mobj->scale : R_LerpFixed(mobj->old_scale, mobj->scale, frac);
//out->subsector = R_PointInSubsector(out->x, out->y); // this is unused
if (mobj->player)
+13 -138
View File
@@ -114,16 +114,8 @@ consvar_t cv_keepmusic = {"keepmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, N
consvar_t cv_skipintromusic = {"skipintromusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
//consvar_t cv_ignoremusicchanges = {"ignoremusicchanges", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
enum
{
SKPMUS_OFF,
SKPMUS_SKIP,
SKPMUS_PLAYMUS,
SKPMUS_PLAYSKIP,
};
boolean keepmapmusic = false; // keep the current music on map restart
UINT8 skipintromus = SKPMUS_OFF; // skip the intro fanfare
boolean skipintromus = false; // skip the intro fanfare
static music_t keepmusic;
#ifdef HAVE_OPENMPT
@@ -1987,8 +1979,7 @@ static boolean S_CheckMusicException(void)
void S_ResetKeepAndSpecialMus(void)
{
keepmapmusic = false;
skipintromus = SKPMUS_OFF;
keepmapmusic = skipintromus = false;
}
@@ -2044,134 +2035,32 @@ void S_HandleReloadResetMusic(void)
mapmusic.resume = 0;
}
// TODO: make this a seperate lump
// would rather NOT hardcode stuff like this
// FIXME: i did this while sleep deprived and when it was 39c
// idk why i just didnt check for full map names instead
typedef struct
{
const char *name; // sfx to check
UINT8 action; // what those sfx do
} sfxintro_t;
static sfxintro_t introsfxlist[] = {
{"KMAPPF", SKPMUS_PLAYSKIP}, {"DPFINT", SKPMUS_PLAYSKIP}, // RA Extended
{"D00DMM", SKPMUS_PLAYMUS}, {"D00DCE", SKPMUS_PLAYMUS}, {"D00DSD", SKPMUS_PLAYMUS}, // RA Extended
{"D00DLD", SKPMUS_PLAYSKIP}, {"D00DGE", SKPMUS_PLAYSKIP}, // RA Extended
{"SSVO", SKPMUS_PLAYMUS}, {"SSVOH", SKPMUS_PLAYMUS}, // subsonic
{"NFMMM", SKPMUS_PLAYSKIP}, {"NFMMME", SKPMUS_PLAYSKIP}, {"SRALLY", SKPMUS_PLAYSKIP}, // sparkcup
{"AMLUY0", SKPMUS_PLAYSKIP}, // ceroba
{"HOURIN", SKPMUS_PLAYSKIP}, {"HOURIM", SKPMUS_PLAYSKIP}, // hourglass
{"KAIJIS", SKPMUS_PLAYMUS}, // mauromania
{"SKINTO", SKPMUS_PLAYMUS}, // shovelknight
{"WALU01", SKPMUS_PLAYMUS}, {"WADE00", SKPMUS_PLAYMUS}, {"INTRO", SKPMUS_PLAYSKIP}, // pata
{"WARINT", SKPMUS_PLAYSKIP}, {"PTIMED", SKPMUS_PLAYSKIP}, {"PTISEW", SKPMUS_PLAYSKIP}, // pizza tower pata
{"PTIFIN", SKPMUS_PLAYSKIP}, {"PTIFAC", SKPMUS_PLAYSKIP}, {"PTISPA", SKPMUS_PLAYSKIP}, // pizza tower pata
{"K4TM10", SKPMUS_PLAYSKIP}, {"K4TM20", SKPMUS_PLAYSKIP}, {"K4TM30", SKPMUS_PLAYSKIP}, // boon county pata
{"MBMWIN", SKPMUS_PLAYSKIP}, // ivo motobug
{"START", SKPMUS_PLAYMUS}, {"STARR", SKPMUS_PLAYMUS}, {"3STA", SKPMUS_PLAYMUS}, // assaultpack
{"SLFARE", SKPMUS_PLAYSKIP}, {"LTSAGO", SKPMUS_PLAYSKIP}, // secret slide
{"SPKINT", SKPMUS_PLAYSKIP}, // cotopack spelunky
{"LOZOPN", SKPMUS_PLAYSKIP}, {"LOZOPM", SKPMUS_PLAYSKIP}, // nostalgia pack zelda
{"MLINTR", SKPMUS_PLAYSKIP}, {"RALLYY", SKPMUS_PLAYSKIP}, // coffee cup
{"CCLSTR", SKPMUS_PLAYMUS}, {"CCSTRT", SKPMUS_PLAYSKIP}, {"CCENCR", SKPMUS_PLAYSKIP}, // keks land
{"PNTPBL", SKPMUS_PLAYMUS}, // plompack
};
// :chaosleep:
static UINT8 S_CheckIntroSfx(void)
{
size_t i, h;
sfxinfo_t *sfx = NULL;
INT32 sfxnum = sfx_None;
UINT8 ret = SKPMUS_PLAYMUS; // for now default to just playing sounds while the music is playing
// useful for finding intros that were missed
// go through the whole map
// and scan for any lines with the play sfx special
// we cannot really detect here if they are supposed to play on map start
// but the list contains things that are "known" to be intros
// this sucks immense ass but what can you do
for (i = 0; i < numlines; i++)
{
const line_t *line = &lines[i];
// "play sfx" special
if (line->special != 414)
continue;
// if theres a sound name in the toptexture
// this will give us a valid sound id
sfxnum = sides[line->sidenum[0]].toptexture; //P_AproxDistance(line->dx, line->dy)>>FRACBITS;
// no valid sound id?
if (sfxnum <= sfx_None || sfxnum >= NUMSFX)
{
continue;
}
sfx = &S_sfx[sfxnum];
// somehow sound does not exist
if (!sfx)
{
continue;
}
// now check if the corresponding sound matches anything from our list
for (h = 0; h < sizeof(introsfxlist)/sizeof(introsfxlist[0]); h++)
{
// case insensitive, for some reason some sounds freeslot lowercase?
if (fasticmp(sfx->name, introsfxlist[h].name))
{
const UINT8 skipaction = introsfxlist[h].action;
// intros that plays music or otherwise wont fit with the music playing
// have precendence over EVERYTHING
if (skipaction == SKPMUS_PLAYSKIP)
return SKPMUS_PLAYSKIP;
// otherwise keep going
// always prefer higher priority
// not really needed currently
// but idk if i edit this again some other time
if (skipaction > ret)
ret = skipaction;
}
}
}
return ret;
}
static UINT8 S_SkipIntroMusic(void)
static boolean S_SkipIntroMusic(void)
{
if (!cv_skipintromusic.value)
return SKPMUS_OFF;
return false;
// dont skip if we disabled music, weird? but this would skip sounds that play on map start as well otherwise
if (music_disabled)
return SKPMUS_OFF;
return false;
// check if menu music is playing, otherwise it may continue playing
if (fasticmp(music.name, "titles"))
return SKPMUS_OFF;
return false;
// wandering balls changes its song when the race starts Zzz...
CLEANUP(Z_Pfree) char *maptitle = G_BuildMapTitle(gamemap);
if (maptitle && fasticmp(maptitle, "Wandering Falls"))
CLEANUP(Z_Pfree) char *maptitle = G_BuildMapTitle(gamemap); // Zzz...
if (maptitle && fasticmp(maptitle, "Wandering Falls")) // wandering balls changes its song when the race starts Zzz...
{
return SKPMUS_OFF;
return false;
}
// without sound there wont be any intro playing
if (sound_disabled)
return SKPMUS_SKIP;
return true;
// yes i sometimes play with only music but no sound
return S_CheckIntroSfx();
return true;
}
//
@@ -2191,10 +2080,7 @@ void S_InitMapMusic(void)
// Starting ambience should always be restarted
// lug: but not when we keep the map music lol
S_StopMusic();
}
void S_HandleMusicStart(void)
{
skipintromus = S_SkipIntroMusic();
if (skipintromus)
@@ -2215,7 +2101,7 @@ void S_StartMapMusic(void)
return;
}
if (skipintromus == SKPMUS_SKIP || skipintromus == SKPMUS_PLAYMUS)
if (skipintromus)
{
if (leveltime < starttime)
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, mapmusic.position, 0, 0);
@@ -2225,17 +2111,6 @@ void S_StartMapMusic(void)
return;
}
if (skipintromus)
{
if (leveltime == MUSICSTARTTIME)
{
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, mapmusic.position, 0, 0);
S_ShowMusicCredit();
}
return;
}
if (leveltime < starttime) // SRB2Kart
S_ChangeMusicInternal((encoremode ? "estart" : "kstart"), false); // yes this will be spammed otherwise encore and some stuff WILL overwrite it
else if (leveltime == starttime) // The GO! sound stops the level start ambience
+1 -2
View File
@@ -73,7 +73,7 @@ extern consvar_t cv_keepmusic;
extern consvar_t cv_skipintromusic;
//extern consvar_t cv_ignoremusicchanges;
extern boolean keepmapmusic;
extern UINT8 skipintromus;
extern boolean skipintromus;
#define MUSICSTARTTIME (starttime + (TICRATE/2))
@@ -114,7 +114,6 @@ void S_ClearSfx(void);
void S_ResetKeepAndSpecialMus(void);
void S_InitMapMusic(void);
void S_HandleMusicStart(void);
void S_StartMapMusic(void);
void S_HandleReloadResetMusic(void);