mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-29 05:41:02 +00:00
musicplus-le-changemusic 2.2 -> 2.1 backport
This commit is contained in:
parent
0cfe0824b6
commit
2e0e0a3856
2 changed files with 75 additions and 19 deletions
|
@ -1514,19 +1514,33 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
|
||||||
{
|
{
|
||||||
M_Memcpy(process,msd->bottomtexture,8);
|
M_Memcpy(process,msd->bottomtexture,8);
|
||||||
process[8] = '\0';
|
process[8] = '\0';
|
||||||
sd->bottomtexture = get_number(process)-1;
|
sd->bottomtexture = get_number(process);
|
||||||
}
|
}
|
||||||
M_Memcpy(process,msd->toptexture,8);
|
|
||||||
process[8] = '\0';
|
|
||||||
sd->text = Z_Malloc(7, PU_LEVEL, NULL);
|
|
||||||
|
|
||||||
// If they type in O_ or D_ and their music name, just shrug,
|
if (!(msd->midtexture[0] == '-' && msd->midtexture[1] == '\0') || msd->midtexture[1] != '\0')
|
||||||
// then copy the rest instead.
|
{
|
||||||
if ((process[0] == 'O' || process[0] == 'D') && process[7])
|
M_Memcpy(process,msd->midtexture,8);
|
||||||
M_Memcpy(sd->text, process+2, 6);
|
process[8] = '\0';
|
||||||
else // Assume it's a proper music name.
|
sd->midtexture = get_number(process);
|
||||||
M_Memcpy(sd->text, process, 6);
|
}
|
||||||
sd->text[6] = 0;
|
|
||||||
|
// always process if back sidedef, because we need that - symbol
|
||||||
|
sd->text = Z_Malloc(7, PU_LEVEL, NULL);
|
||||||
|
if (i == 1 || msd->toptexture[0] != '-' || msd->toptexture[1] != '\0')
|
||||||
|
{
|
||||||
|
M_Memcpy(process,msd->toptexture,8);
|
||||||
|
process[8] = '\0';
|
||||||
|
|
||||||
|
// If they type in O_ or D_ and their music name, just shrug,
|
||||||
|
// then copy the rest instead.
|
||||||
|
if ((process[0] == 'O' || process[0] == 'D') && process[7])
|
||||||
|
M_Memcpy(sd->text, process+2, 6);
|
||||||
|
else // Assume it's a proper music name.
|
||||||
|
M_Memcpy(sd->text, process, 6);
|
||||||
|
sd->text[6] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sd->text[0] = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 414: // Play SFX
|
case 414: // Play SFX
|
||||||
|
|
58
src/p_spec.c
58
src/p_spec.c
|
@ -2419,18 +2419,60 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
// console player only unless NOCLIMB is set
|
// console player only unless NOCLIMB is set
|
||||||
if ((line->flags & ML_NOCLIMB) || (mo && mo->player && P_IsLocalPlayer(mo->player)))
|
if ((line->flags & ML_NOCLIMB) || (mo && mo->player && P_IsLocalPlayer(mo->player)))
|
||||||
{
|
{
|
||||||
UINT16 tracknum = (UINT16)sides[line->sidenum[0]].bottomtexture;
|
boolean musicsame = (!sides[line->sidenum[0]].text[0] || !strnicmp(sides[line->sidenum[0]].text, S_MusicName(), 7));
|
||||||
|
UINT16 tracknum = (UINT16)max(sides[line->sidenum[0]].bottomtexture, 0);
|
||||||
|
INT32 position = (INT32)max(sides[line->sidenum[0]].midtexture, 0);
|
||||||
|
UINT32 prefadems = (UINT32)max(sides[line->sidenum[0]].textureoffset >> FRACBITS, 0);
|
||||||
|
UINT32 postfadems = (UINT32)max(sides[line->sidenum[0]].rowoffset >> FRACBITS, 0);
|
||||||
|
UINT8 fadetarget = (UINT8)max((line->sidenum[1] != 0xffff) ? sides[line->sidenum[1]].textureoffset >> FRACBITS : 0, 0);
|
||||||
|
INT16 fadesource = (INT16)max((line->sidenum[1] != 0xffff) ? sides[line->sidenum[1]].rowoffset >> FRACBITS : 0, -1);
|
||||||
|
|
||||||
strncpy(mapmusname, sides[line->sidenum[0]].text, 7);
|
if (line->flags & ML_EFFECT1)
|
||||||
mapmusname[6] = 0;
|
{
|
||||||
|
// adjust for loop point if subtracting
|
||||||
|
if (position < 0 && S_GetMusicLength() &&
|
||||||
|
S_GetMusicPosition() > S_GetMusicLoopPoint() &&
|
||||||
|
S_GetMusicPosition() + position < S_GetMusicLoopPoint())
|
||||||
|
position = max(S_GetMusicLength() - (S_GetMusicLoopPoint() - (S_GetMusicPosition() + position)), 0);
|
||||||
|
else
|
||||||
|
position = max(S_GetMusicPosition() + position, 0);
|
||||||
|
}
|
||||||
|
|
||||||
mapmusflags = tracknum & MUSIC_TRACKMASK;
|
if ((line->flags & ML_EFFECT2) && fadetarget && musicsame)
|
||||||
if (!(line->flags & ML_BLOCKMONSTERS))
|
{
|
||||||
mapmusflags |= MUSIC_RELOADRESET;
|
if (!postfadems)
|
||||||
|
S_SetInternalMusicVolume(fadetarget);
|
||||||
|
else
|
||||||
|
S_FadeMusicFromVolume(fadetarget, fadesource, postfadems);
|
||||||
|
|
||||||
mapmusposition = 0;
|
if (position)
|
||||||
|
S_SetMusicPosition(position);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strncpy(mapmusname, sides[line->sidenum[0]].text, 7);
|
||||||
|
mapmusname[6] = 0;
|
||||||
|
|
||||||
S_ChangeMusic(mapmusname, mapmusflags, !(line->flags & ML_EFFECT4));
|
mapmusflags = tracknum & MUSIC_TRACKMASK;
|
||||||
|
if (!(line->flags & ML_BLOCKMONSTERS))
|
||||||
|
mapmusflags |= MUSIC_RELOADRESET;
|
||||||
|
if (line->flags & ML_BOUNCY)
|
||||||
|
mapmusflags |= MUSIC_FORCERESET;
|
||||||
|
|
||||||
|
mapmusposition = position;
|
||||||
|
|
||||||
|
S_ChangeMusicEx(mapmusname, mapmusflags, !(line->flags & ML_EFFECT4), position,
|
||||||
|
!(line->flags & ML_EFFECT2) ? prefadems : 0,
|
||||||
|
!(line->flags & ML_EFFECT2) ? postfadems : 0);
|
||||||
|
|
||||||
|
if ((line->flags & ML_EFFECT2) && fadetarget)
|
||||||
|
{
|
||||||
|
if (!postfadems)
|
||||||
|
S_SetInternalMusicVolume(fadetarget);
|
||||||
|
else
|
||||||
|
S_FadeMusicFromVolume(fadetarget, fadesource, postfadems);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Except, you can use the ML_BLOCKMONSTERS flag to change this behavior.
|
// Except, you can use the ML_BLOCKMONSTERS flag to change this behavior.
|
||||||
// if (mapmusflags & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn.
|
// if (mapmusflags & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn.
|
||||||
|
|
Loading…
Reference in a new issue