Allow changing titlemap's cameraref via Line 422 Cut-Away View; change music too

This commit is contained in:
mazmazz 2018-11-18 01:53:18 -05:00
parent 758647fab2
commit f3be97a95a
3 changed files with 29 additions and 12 deletions

View File

@ -1351,6 +1351,8 @@ void F_GameEndTicker(void)
// ==============
// TITLE SCREEN
// ==============
mobj_t *titlemapcameraref = NULL;
void F_StartTitleScreen(void)
{
if (menumeta[MN_MAIN].musname[0])
@ -1535,22 +1537,28 @@ void F_TitleScreenTicker(boolean run)
mobj_t *mo2;
mobj_t *cameraref = NULL;
for (th = thinkercap.next; th != &thinkercap; th = th->next)
// If there's a Line 422 Switch Cut-Away view, don't force us.
if (!titlemapcameraref || titlemapcameraref->type != MT_ALTVIEWMAN)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
continue;
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
continue;
mo2 = (mobj_t *)th;
mo2 = (mobj_t *)th;
if (!mo2)
continue;
if (!mo2)
continue;
if (mo2->type != MT_ALTVIEWMAN)
continue;
if (mo2->type != MT_ALTVIEWMAN)
continue;
cameraref = mo2;
break;
cameraref = titlemapcameraref = mo2;
break;
}
}
else
cameraref = titlemapcameraref;
if (cameraref)
{

View File

@ -80,6 +80,7 @@ typedef enum
} titlemap_enum;
extern UINT8 titlemapinaction;
extern mobj_t *titlemapcameraref;
//
// WIPE

View File

@ -2591,7 +2591,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
case 413: // Change music
// 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)) || titlemapinaction)
{
UINT16 tracknum = (UINT16)sides[line->sidenum[0]].bottomtexture;
@ -2890,7 +2890,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
{
mobj_t *altview;
if (!mo || !mo->player) // only players have views
if ((!mo || !mo->player) && !titlemapinaction) // only players have views, and title screens
return;
if ((secnum = P_FindSectorFromLineTag(line, -1)) < 0)
@ -2900,6 +2900,14 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (!altview)
return;
// If titlemap, set the camera ref for title's thinker
// This is not revoked until overwritten; awayviewtics is ignored
if (titlemapinaction)
{
titlemapcameraref = altview;
return;
}
P_SetTarget(&mo->player->awayviewmobj, altview);
mo->player->awayviewtics = P_AproxDistance(line->dx, line->dy)>>FRACBITS;