From f70b89b22aad5d36172234805ef75a1bb2713e8f Mon Sep 17 00:00:00 2001 From: yellowtd Date: Thu, 20 Apr 2017 17:15:57 -0400 Subject: [PATCH] titlemap - support for map camera object allows a camera thing to be placed for alternate camera placement besides player and DM starts --- src/dehacked.c | 6 ++++++ src/f_finale.c | 42 +++++++++++++++++++++++++++++++++++++++--- src/p_mobj.c | 4 ++++ 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 6734f1427..95ce0a862 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8595,6 +8595,12 @@ static inline int lib_getenum(lua_State *L) } else if (fastcmp(word,"paused")) { lua_pushboolean(L, paused); return 1; + } else if (fastcmp(word,"titlemap")) { + lua_pushinteger(L, titlemap); + return 1; + } else if (fastcmp(word,"titlemapinaction")) { + lua_pushboolean(L, titlemapinaction); + return 1; } else if (fastcmp(word,"gametype")) { lua_pushinteger(L, gametype); return 1; diff --git a/src/f_finale.c b/src/f_finale.c index 07812946d..efc87e040 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1576,10 +1576,46 @@ void F_TitleScreenTicker(boolean run) if (gameaction != ga_nothing || gamestate != GS_TITLESCREEN) return; - // Do a lil' camera spin if a title map is loaded. + thinker_t *th; + mobj_t *mo2; + mobj_t *cameraref = NULL; + + // Execute the titlemap camera settings if (titlemapinaction) { - // Default behavior - camera.angle += titlescrollspeed; + + 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; + + if (mo2->type != MT_ALTVIEWMAN) + continue; + + if (mo2) + { + cameraref = mo2; + break; + } + else + break; + } + + if (cameraref) + { + camera.x = cameraref->x; + camera.y = cameraref->y; + camera.z = cameraref->z; + camera.angle = cameraref->angle; + camera.aiming = cameraref->cusval; + } + else + { + // Default behavior: Do a lil' camera spin if a title map is loaded; + // TODO: titlescrollspeed scrolls slow here because it is not an angle + //camera.angle += titlescrollspeed; + } } // no demos to play? or, are they disabled? diff --git a/src/p_mobj.c b/src/p_mobj.c index 8f6b9797e..319845668 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -34,6 +34,7 @@ #ifdef ESLOPE #include "p_slopes.h" #endif +#include "f_finale.h" // protos. static CV_PossibleValue_t viewheight_cons_t[] = {{16, "MIN"}, {56, "MAX"}, {0, NULL}}; @@ -8423,6 +8424,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) #endif switch (mobj->type) { + case MT_ALTVIEWMAN: + if (titlemapinaction) mobj->flags &= ~MF_NOTHINK; + break; case MT_CYBRAKDEMON_NAPALM_BOMB_LARGE: mobj->fuse = mobj->info->mass; break;