Skip to content

Commit

Permalink
libhexen: Updated line special, map warp number translation wrt episo…
Browse files Browse the repository at this point in the history
…de IDs
  • Loading branch information
danij-deng committed Aug 12, 2014
1 parent f818e7b commit 4f59457
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions doomsday/plugins/hexen/src/p_spec.cpp
Expand Up @@ -198,11 +198,10 @@ dd_bool EV_LineSearchForPuzzleItem(Line *line, byte * /*args*/, mobj_t *mo)
return P_InventoryUse(mo->player - players, type, false);
}

static de::Uri mapUriFromLogicalNumber(int number)
static de::Uri getMapUriForWarpNumber(int warpNumber)
{
if(!number) return gameMapUri; // current map.
// Assume the referenced map is from the current episode.
return G_ComposeMapUri(::gameEpisode, number - 1);
if(!warpNumber) return gameMapUri; // current map.
return TranslateMapWarpNumber(COMMON_GAMESESSION->episodeId(), warpNumber - 1);
}

dd_bool P_StartLockedACS(Line *line, byte *args, mobj_t *mo, int side)
Expand Down Expand Up @@ -230,7 +229,7 @@ dd_bool P_StartLockedACS(Line *line, byte *args, mobj_t *mo, int side)
}
newArgs[4] = 0;

de::Uri mapUri = mapUriFromLogicalNumber(newArgs[1]);
de::Uri mapUri = getMapUriForWarpNumber(newArgs[1]);
return Game_ACScriptInterpreter().startScript(newArgs[0], &mapUri, &newArgs[2], mo, line, side);
}

Expand Down Expand Up @@ -481,8 +480,7 @@ dd_bool P_ExecuteLineSpecial(int special, byte args[5], Line *line, int side, mo
if(!(mo && mo->player && mo->player->playerState == PST_DEAD))
{
// Assume the referenced map is from the current episode.
G_SetGameActionMapCompleted(G_ComposeMapUri(::gameEpisode, args[0]!= 0? args[0]-1 : 0),
args[1], false);
G_SetGameActionMapCompleted(getMapUriForWarpNumber(args[0]), args[1], false);
success = true;
}
}
Expand Down Expand Up @@ -510,17 +508,17 @@ dd_bool P_ExecuteLineSpecial(int special, byte args[5], Line *line, int side, mo
break;

case 80: /* ACS_Execute */ {
de::Uri mapUri = mapUriFromLogicalNumber(args[1]);
de::Uri mapUri = getMapUriForWarpNumber(args[1]);
success = Game_ACScriptInterpreter().startScript(args[0], &mapUri, &args[2], mo, line, side);
break; }

case 81: /* ACS_Suspend */ {
de::Uri mapUri = mapUriFromLogicalNumber(args[1]);
de::Uri mapUri = getMapUriForWarpNumber(args[1]);
success = Game_ACScriptInterpreter().suspendScript(args[0], &mapUri);
break; }

case 82: /* ACS_Terminate */ {
de::Uri mapUri = mapUriFromLogicalNumber(args[1]);
de::Uri mapUri = getMapUriForWarpNumber(args[1]);
success = Game_ACScriptInterpreter().terminateScript(args[0], &mapUri);
break; }

Expand Down

0 comments on commit 4f59457

Please sign in to comment.