From b68d1ebdb36632327f75969c9d2d24dee25d8bf6 Mon Sep 17 00:00:00 2001 From: yellowtd Date: Mon, 3 Apr 2017 22:12:53 -0400 Subject: [PATCH] titlemap - fix game crash with skybox point game crash on skybox object use fix --- src/f_finale.c | 38 +++++++++++++++++++++++++++++++++++--- src/r_main.c | 2 +- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 50c94eec3..07812946d 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1436,9 +1436,42 @@ void F_StartTitleScreen(void) if (!mapheaderinfo[gamemap-1]) P_AllocMapHeader(gamemap-1); + maptol = mapheaderinfo[gamemap-1]->typeoflevel; + globalweather = mapheaderinfo[gamemap-1]->weather; + G_DoLoadLevel(true); players[displayplayer].playerstate = PST_DEAD; // Don't spawn the player in dummy (I'm still a filthy cheater) - camera.subsector = NULL; // toast is filthy too + //camera.subsector = NULL; // toast is filthy too + + // Set Default Position + mapthing_t *startpos; + if (playerstarts[0]) + startpos = playerstarts[0]; + else if (deathmatchstarts[0]) + startpos = deathmatchstarts[0]; + else + startpos = NULL; + + if (startpos) + { + camera.x = startpos->x << FRACBITS; + camera.y = startpos->y << FRACBITS; + camera.subsector = R_PointInSubsector(camera.x, camera.y); + camera.z = camera.subsector->sector->floorheight + ((startpos->options >> ZSHIFT) << FRACBITS); + camera.angle = (startpos->angle % 360)*ANG1; + camera.aiming = 0; + } + else + { + camera.x = camera.y = camera.z = camera.angle = camera.aiming = 0; + camera.subsector = NULL; // toast is filthy too + } + camera.chase = true; + camera.height = 0; + + //camera.x = camera.y = camera.height = camera.aiming = 0; + //camera.z = 128*FRACUNIT; + //CON_ClearHUD(); wipegamestate = prevwipegamestate; @@ -1545,8 +1578,7 @@ void F_TitleScreenTicker(boolean run) // Do a lil' camera spin if a title map is loaded. if (titlemapinaction) { - camera.x = camera.y = camera.height = camera.aiming = 0; - camera.z = 128*FRACUNIT; + // Default behavior camera.angle += titlescrollspeed; } diff --git a/src/r_main.c b/src/r_main.c index 4cff0ff83..c4ca7784b 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1000,7 +1000,7 @@ void R_SetupFrame(player_t *player, boolean skybox) chasecam = (cv_chasecam.value != 0); } - if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD) + if (player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD || gamestate == GS_TITLESCREEN) chasecam = true; // force chasecam on else if (player->spectator) // no spectator chasecam chasecam = false; // force chasecam off