From f618134f15ff57a5026b26203f3980bf4fcd0a1b Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 11 Dec 2007 04:03:40 +0000 Subject: [PATCH] - Fixed: The MAPINFO flags that control jumping, crouching, and freelook, rather than overriding the dmflags values, actually overwrote the dmflags values, so they would continue to be in effect on later maps that didn't explicitly specify them. SVN r595 (trunk) --- docs/rh-log.txt | 4 ++++ src/g_game.cpp | 2 +- src/g_level.cpp | 44 +++++++++++++++++++++++++++----------------- src/g_level.h | 4 ++++ src/p_map.cpp | 2 +- src/p_mobj.cpp | 2 +- src/p_pspr.cpp | 2 +- src/p_user.cpp | 6 +++--- src/r_sky.cpp | 2 +- 9 files changed, 43 insertions(+), 25 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 410185320..72e156792 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,8 @@ December 10, 2007 +- Fixed: The MAPINFO flags that control jumping, crouching, and freelook, + rather than overriding the dmflags values, actually overwrote the dmflags + values, so they would continue to be in effect on later maps that didn't + explicitly specify them. - Fixed: Redefining a decal did not rebind any old references to the decal, so they would be left pointing at invalid data. - Fixed some more GCC warnings. diff --git a/src/g_game.cpp b/src/g_game.cpp index 8d2cf4083..038b6aeef 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -647,7 +647,7 @@ void G_AddViewPitch (int look) return; } look <<= 16; - if (dmflags & DF_NO_FREELOOK) + if (!level.IsFreelookAllowed()) { LocalViewPitch = 0; } diff --git a/src/g_level.cpp b/src/g_level.cpp index 8af056baa..072be4c43 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -2328,28 +2328,38 @@ void G_InitLevelLocals () level.levelnum = 1; } - int clear = 0, set = 0; - - if (level.flags & LEVEL_JUMP_YES) - clear = DF_NO_JUMP; - if (level.flags & LEVEL_JUMP_NO) - set = DF_NO_JUMP; - if (level.flags & LEVEL_CROUCH_YES) - clear |= DF_NO_CROUCH; - if (level.flags & LEVEL_CROUCH_NO) - set |= DF_NO_CROUCH; - if (level.flags & LEVEL_FREELOOK_YES) - clear |= DF_NO_FREELOOK; - if (level.flags & LEVEL_FREELOOK_NO) - set |= DF_NO_FREELOOK; - - dmflags = (dmflags & ~clear) | set; - compatflags.Callback(); NormalLight.ChangeFade (level.fadeto); } +bool level_locals_s::IsJumpingAllowed() const +{ + if (level.flags & LEVEL_JUMP_NO) + return false; + if (level.flags & LEVEL_JUMP_YES) + return true; + return !(dmflags & DF_NO_JUMP); +} + +bool level_locals_s::IsCrouchingAllowed() const +{ + if (level.flags & LEVEL_CROUCH_NO) + return false; + if (level.flags & LEVEL_CROUCH_YES) + return true; + return !(dmflags & DF_NO_CROUCH); +} + +bool level_locals_s::IsFreelookAllowed() const +{ + if (level.flags & LEVEL_FREELOOK_NO) + return false; + if (level.flags & LEVEL_FREELOOK_YES) + return true; + return !(dmflags & DF_NO_FREELOOK); +} + char *CalcMapName (int episode, int level) { static char lumpname[9]; diff --git a/src/g_level.h b/src/g_level.h index daf22cb98..2ffbafe7e 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -241,6 +241,10 @@ struct level_locals_s SBYTE WallHorizLight; const char *f1; + + bool IsJumpingAllowed() const; + bool IsCrouchingAllowed() const; + bool IsFreelookAllowed() const; }; typedef struct level_locals_s level_locals_t; diff --git a/src/p_map.cpp b/src/p_map.cpp index c83bf1ca3..88e002f8d 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -2698,7 +2698,7 @@ fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, fixed_t vr // can't shoot outside view angles if (vrange == 0) { - if (t1->player == NULL || dmflags & DF_NO_FREELOOK) + if (t1->player == NULL || !level.IsFreelookAllowed()) { vrange = ANGLE_1*35; } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 3876221ba..d2b423ffc 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4617,7 +4617,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, pitch = P_AimLineAttack (source, an, 16*64*FRACUNIT); if (source->player != NULL && - !(dmflags & DF_NO_FREELOOK) && + level.IsFreelookAllowed() && source->player->userinfo.aimdist <= ANGLE_1/2) { break; diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index b9050c35a..bf0b120a7 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -646,7 +646,7 @@ void P_BulletSlope (AActor *mo) bulletpitch = P_AimLineAttack (mo, an, 16*64*FRACUNIT); if (mo->player != NULL && - !(dmflags & DF_NO_FREELOOK) && + level.IsFreelookAllowed() && mo->player->userinfo.aimdist <= ANGLE_1/2) { break; diff --git a/src/p_user.cpp b/src/p_user.cpp index af2fa56f2..2110d8de5 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -1954,7 +1954,7 @@ void P_PlayerThink (player_t *player) // Handle crouching if (player->cmd.ucmd.buttons & BT_JUMP) player->cmd.ucmd.buttons &= ~BT_DUCK; - if (player->morphTics == 0 && player->health > 0 && !(dmflags & DF_NO_CROUCH)) + if (player->morphTics == 0 && player->health > 0 && level.IsCrouchingAllowed()) { if (!(player->cheats & CF_TOTALLYFROZEN)) { @@ -2003,7 +2003,7 @@ void P_PlayerThink (player_t *player) } // [RH] Look up/down stuff - if (dmflags & DF_NO_FREELOOK) + if (!level.IsFreelookAllowed()) { player->mo->pitch = 0; } @@ -2070,7 +2070,7 @@ void P_PlayerThink (player_t *player) { player->mo->momz = 3*FRACUNIT; } - else if (!(dmflags & DF_NO_JUMP) && onground && !player->jumpTics) + else if (level.IsJumpingAllowed() && onground && !player->jumpTics) { fixed_t jumpmomz = player->mo->JumpZ * 35 / TICRATE; diff --git a/src/r_sky.cpp b/src/r_sky.cpp index bee0977f1..05c840299 100644 --- a/src/r_sky.cpp +++ b/src/r_sky.cpp @@ -90,7 +90,7 @@ void R_InitSkyMap () { skytexturemid = r_Yaspect/2*FRACUNIT; skystretch = (r_stretchsky - && !(dmflags & DF_NO_FREELOOK) + && level.IsFreelookAllowed() && !(level.flags & LEVEL_FORCENOSKYSTRETCH)) ? 1 : 0; } else