Skip to content

Commit

Permalink
Doom|Heretic: Only alter the mobj State definitions when -fast changes
Browse files Browse the repository at this point in the history
This is still a huge kludge as it assumes the original values have
not been modified (e.g., via a DED or DeHackEd patch).

Todo for later: We really do need address this. I'm getting tired
of chasing obscure bugs only to find they are caused by the shaky
-fast handling.
  • Loading branch information
danij-deng committed Aug 12, 2012
1 parent ff670e9 commit 22df7e1
Showing 1 changed file with 52 additions and 44 deletions.
96 changes: 52 additions & 44 deletions doomsday/plugins/common/src/g_game.c
Expand Up @@ -2246,12 +2246,49 @@ static void G_InitNewGame(void)
#endif
}

static void G_ApplyGameRules(skillmode_t skill)
#if __JDOOM__ || __JDOOM64__
static void G_ApplyGameRuleFastMonsters(boolean fast)
{
static boolean oldFast = false;
int i;

// Only modify when the rule changes state.
if(fast == oldFast) return;
oldFast = fast;

/// @fixme Kludge: Assumes the original values speed values haven't been modified!
for(i = S_SARG_RUN1; i <= S_SARG_RUN8; ++i)
STATES[i].tics = fast? 1 : 2;
for(i = S_SARG_ATK1; i <= S_SARG_ATK3; ++i)
STATES[i].tics = fast? 4 : 8;
for(i = S_SARG_PAIN; i <= S_SARG_PAIN2; ++i)
STATES[i].tics = fast? 1 : 2;
// Kludge end.
}
#endif

#if __JDOOM__ || __JHERETIC__ || __JDOOM64__
int i, speed;
static void G_ApplyGameRuleFastMissiles(boolean fast)
{
static boolean oldFast = false;
int i;

// Only modify when the rule changes state.
if(fast == oldFast) return;
oldFast = fast;

/// @fixme Kludge: Assumes the original values speed values haven't been modified!
for(i = 0; MonsterMissileInfo[i].type != -1; ++i)
{
MOBJINFO[MonsterMissileInfo[i].type].speed =
MonsterMissileInfo[i].speed[fast? 1 : 0];
}
// Kludge end.
}
#endif

static void G_ApplyGameRules(skillmode_t skill)
{
if(skill < SM_BABY)
skill = SM_BABY;
if(skill > NUM_SKILL_MODES - 1)
Expand All @@ -2277,56 +2314,27 @@ static void G_ApplyGameRules(skillmode_t skill)
respawnMonsters = cfg.respawnMonstersNightmare;
#endif

#if __JDOOM__
// Disabled in Chex and HacX because this messes with the original games' values.
if(gameMode != doom2_hacx && gameMode != doom_chex)
#endif
{
/// @kludge Doom/Heretic Fast Monters/Missiles
// Fast monsters?
#if __JDOOM__ || __JDOOM64__
// Fast monsters?
if(fastParm
{
boolean fastMonsters = fastParm;
# if __JDOOM__
|| (skill == SM_NIGHTMARE && gameSkill != SM_NIGHTMARE)
if(gameSkill == SM_NIGHTMARE) fastMonsters = true;
# endif
)
{
for(i = S_SARG_RUN1; i <= S_SARG_RUN8; ++i)
STATES[i].tics = 1;
for(i = S_SARG_ATK1; i <= S_SARG_ATK3; ++i)
STATES[i].tics = 4;
for(i = S_SARG_PAIN; i <= S_SARG_PAIN2; ++i)
STATES[i].tics = 1;
}
else
{
for(i = S_SARG_RUN1; i <= S_SARG_RUN8; ++i)
STATES[i].tics = 2;
for(i = S_SARG_ATK1; i <= S_SARG_ATK3; ++i)
STATES[i].tics = 8;
for(i = S_SARG_PAIN; i <= S_SARG_PAIN2; ++i)
STATES[i].tics = 2;
}
G_ApplyGameRuleFastMonsters(fastMonsters);
}
#endif

// Fast missiles?
// Fast missiles?
#if __JDOOM__ || __JHERETIC__ || __JDOOM64__
# if __JDOOM64__
speed = fastParm;
# elif __JDOOM__
speed = (fastParm || (skill == SM_NIGHTMARE && gameSkill != SM_NIGHTMARE));
# else
speed = skill == SM_NIGHTMARE;
{
boolean fastMissiles = fastParm;
# if !__JDOOM64__
if(gameSkill == SM_NIGHTMARE) fastMissiles = true;
# endif

for(i = 0; MonsterMissileInfo[i].type != -1; ++i)
{
MOBJINFO[MonsterMissileInfo[i].type].speed =
MonsterMissileInfo[i].speed[speed];
}
#endif
// <-- KLUDGE
G_ApplyGameRuleFastMissiles(fastMissiles);
}
#endif
}

void G_LeaveMap(uint newMap, uint _entryPoint, boolean _secretExit)
Expand Down

0 comments on commit 22df7e1

Please sign in to comment.