diff --git a/src/deh_soc.c b/src/deh_soc.c index 6a937201b..53da34d0b 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -1494,6 +1494,18 @@ void readlevelheader(MYFILE *f, char * name) deh_warning("Level header %d: invalid lobby size '%s'", num, word2); } } + else if (fastcmp(word, "CAMHEIGHT") || fastcmp(word, "CAMERAHEIGHT")) + { + fixed_t camheight = FloatToFixed(atof(word2)); + + if (camheight < 0) + { + deh_warning("Level header %d: invalid camera height %s", num, word2); + continue; + } + + mapheaderinfo[num]->cameraHeight = camheight;; + } else deh_warning("Level header %d: unknown word '%s'", num, word); } diff --git a/src/doomstat.h b/src/doomstat.h index 1c188e967..a9e46a0e9 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -558,6 +558,8 @@ struct mapheader_t mapheader_lighting_t lighting_encore; ///< Alternative lighting for Encore mode boolean use_encore_lighting; ///< Whether to use separate Encore lighting + fixed_t cameraHeight; ///< Player camera height to use on this map + // Audience information UINT8 numFollowers; ///< Internal. For audience support. INT16 *followers; ///< List of audience followers in this level. Allocated dynamically for space reasons. Be careful. diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 89b2e7c4c..7329f355b 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -2572,6 +2572,8 @@ static int mapheaderinfo_get(lua_State *L) lua_pushfixed(L, header->mobj_scale); else if (fastcmp(field, "gravity")) lua_pushfixed(L, header->gravity); + else if (fastcmp(field, "cameraheight")) + lua_pushfixed(L, header->cameraHeight); else { // Read custom vars now // (note: don't include the "LUA." in your lua scripts!) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index b4a4b985b..fa1240f7e 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -526,6 +526,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 num) mapheaderinfo[num]->automedaltime[1] = 2; mapheaderinfo[num]->automedaltime[2] = 3; mapheaderinfo[num]->automedaltime[3] = 4; + mapheaderinfo[num]->cameraHeight = INT32_MIN; } /** Allocates a new map-header structure. diff --git a/src/p_spec.c b/src/p_spec.c index 6721c6253..23cf990ef 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -9601,6 +9601,11 @@ void P_DoQuakeOffset(UINT8 view, mappoint_t *viewPos, mappoint_t *offset) fixed_t maxShake = FixedMul(cv_cam_height[view].value, mapobjectscale) * 3 / 4; + if (mapheaderinfo[gamemap-1]->cameraHeight >= 0) + { + maxShake = FixedMul(mapheaderinfo[gamemap-1]->cameraHeight, mapobjectscale) * 3 / 4; + } + if (battle) { addZ /= 2; diff --git a/src/p_user.c b/src/p_user.c index abd2138e4..925627794 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3361,6 +3361,11 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall camdist = FixedMul(cv_cam_dist[num].value, cameraScale); camheight = FixedMul(cv_cam_height[num].value, cameraScale); + if (mapheaderinfo[gamemap-1]->cameraHeight >= 0) + { + camheight = FixedMul(mapheaderinfo[gamemap-1]->cameraHeight, cameraScale); + } + if (loop_in < loop->zoom_in_speed) { fixed_t f = loop_out < loop->zoom_out_speed @@ -4543,7 +4548,7 @@ void P_PlayerThink(player_t *player) player->mo->renderflags &= ~RF_DONTDRAW; player->mo->flags &= ~MF_NOCLIPTHING; } - + boolean deathcontrolled = (player->respawn.state != RESPAWNST_NONE && player->respawn.truedeath == true) || (player->pflags & PF_NOCONTEST) || (player->karmadelay); boolean powercontrolled = (player->hyudorotimer) || (player->growshrinktimer > 0);