Skip to content

Commit

Permalink
Fixed "HeXen: End game trigger doesn't work" (see here http://sourcef…
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Nov 13, 2009
1 parent 955719a commit ef9b11b
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 151 deletions.
72 changes: 34 additions & 38 deletions doomsday/plugins/common/src/d_netcl.c
Expand Up @@ -594,23 +594,31 @@ void NetCl_UpdatePSpriteState(byte *data)
*/
}

void NetCl_Intermission(byte *data)
void NetCl_Intermission(byte* data)
{
uint i;
int flags;
int flags;

NetCl_SetReadBuffer(data);
flags = NetCl_ReadByte();

//Con_Printf( "NetCl_Intermission: flags=%x\n", flags);

// Close any automaps left open at the end of the previous map.
for(i = 0; i < MAXPLAYERS; ++i)
AM_Open(AM_MapForPlayer(i), false, true);

#if __JDOOM__ || __JDOOM64__
if(flags & IMF_BEGIN)
{
uint i;

// Close any automaps left open at the end of the previous map.
for(i = 0; i < MAXPLAYERS; ++i)
AM_Open(AM_MapForPlayer(i), false, true);

GL_SetFilter(false);

#if __JHEXEN__
SN_StopAllSequences();
#endif

// @fixme jHeretic does not transmit the intermission info!
#if __JDOOM__ || __JDOOM64__
wmInfo.maxKills = NetCl_ReadShort();
wmInfo.maxItems = NetCl_ReadShort();
wmInfo.maxSecret = NetCl_ReadShort();
Expand All @@ -619,55 +627,43 @@ void NetCl_Intermission(byte *data)
wmInfo.didSecret = NetCl_ReadByte();

G_PrepareWIData();
#elif __JHEXEN__
leaveMap = NetCl_ReadByte();
leavePosition = NetCl_ReadByte();
#endif

G_ChangeGameState(GS_INTERMISSION);

#if __JDOOM__ || __JDOOM64__
WI_Start(&wmInfo);
#elif __JHERETIC__
IN_Start(&wmInfo);
#elif __JHEXEN__
IN_Start();
#endif
}

if(flags & IMF_END)
{
#if __JDOOM__ || __JDOOM64__
WI_End();
#elif __JHERETIC__ || __JHEXEN__
IN_Stop();
#endif
}

if(flags & IMF_STATE)
{
#if __JDOOM__ || __JDOOM64__
WI_SetState(NetCl_ReadByte());
}
#elif __JHERETIC__ || __JHEXEN__
interState = (int) NetCl_ReadByte();
#endif
}

#if __JHERETIC__
if(flags & IMF_STATE)
interState = (int) NetCl_ReadByte();
if(flags & IMF_TIME)
interTime = NetCl_ReadShort();
if(flags & IMF_BEGIN)
{
G_ChangeGameState(GS_INTERMISSION);

// @fixme jHeretic does not transmit the intermission info!
IN_Start(&wmInfo);
}
if(flags & IMF_END)
{
IN_Stop();
}
#endif

#if __JHEXEN__ || __JSTRIFE__
if(flags & IMF_BEGIN)
{
leaveMap = NetCl_ReadByte();
leavePosition = NetCl_ReadByte();
G_ChangeGameState(GS_INTERMISSION);
IN_Start();
}
if(flags & IMF_END)
{
IN_Stop();
}
if(flags & IMF_STATE)
interState = (int) NetCl_ReadByte();
#endif
}

Expand Down
29 changes: 19 additions & 10 deletions doomsday/plugins/common/src/g_game.c
Expand Up @@ -1540,7 +1540,7 @@ void G_DoReborn(int plrNum)
}
}

#if __JHEXEN__ || __JSTRIFE__
#if __JHEXEN__
void G_StartNewInit(void)
{
SV_HxInitBaseSlot();
Expand All @@ -1556,7 +1556,7 @@ void G_StartNewInit(void)

void G_StartNewGame(skillmode_t skill)
{
int realMap = 1;
int realMap = 1;

G_StartNewInit();
# if __JHEXEN__
Expand Down Expand Up @@ -1615,7 +1615,7 @@ void G_LeaveMap(int map, int position, boolean secret)
}
#endif

#if __JHEXEN__ || __JSTRIFE__
#if __JHEXEN__
leaveMap = map;
leavePosition = position;
#else
Expand Down Expand Up @@ -1669,7 +1669,7 @@ boolean G_IfVictory(void)

void G_DoCompleted(void)
{
int i;
int i;

G_SetGameAction(GA_NONE);

Expand All @@ -1687,11 +1687,17 @@ void G_DoCompleted(void)
}
}

GL_SetFilter(false);

#if __JHEXEN__
SN_StopAllSequences();
#endif

// Go to an intermission?
#if __JDOOM__ || __JHERETIC__ || __JDOOM64__
{
ddmapinfo_t minfo;
char levid[8];
ddmapinfo_t minfo;
char levid[8];

P_GetMapLumpName(gameEpisode, gameMap, levid);

Expand All @@ -1701,6 +1707,12 @@ void G_DoCompleted(void)
return;
}
}
#elif __JHEXEN__
if(!deathmatch)
{
G_WorldDone();
return;
}
#endif

// Has the player completed the game?
Expand Down Expand Up @@ -1893,12 +1905,9 @@ void G_PrepareWIData(void)

void G_WorldDone(void)
{
#if !__JHEXEN__
#else
# if __JDOOM__ || __JDOOM64__
#if __JDOOM__ || __JDOOM64__
if(secretExit)
players[CONSOLEPLAYER].didSecret = true;
# endif
#endif

// Clear the currently playing script, if any.
Expand Down

0 comments on commit ef9b11b

Please sign in to comment.