Skip to content

Commit

Permalink
Fixed intermission in multiplayer
Browse files Browse the repository at this point in the history
Fire/Use-to-skip was not working.
  • Loading branch information
skyjake committed Apr 19, 2011
1 parent 70c2e5d commit d4fd168
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 19 deletions.
21 changes: 15 additions & 6 deletions doomsday/plugins/common/src/d_netcl.c
Expand Up @@ -968,13 +968,22 @@ void NetCl_PlayerActionRequest(player_t *player, int actionType, int actionParam
*ptr++ = LONG(actionType);

// Position of the action.
*ptr++ = LONG(FLT2FIX(player->plr->mo->pos[VX]));
*ptr++ = LONG(FLT2FIX(player->plr->mo->pos[VY]));
*ptr++ = LONG(FLT2FIX(player->plr->mo->pos[VZ]));
if(G_GetGameState() == GS_MAP)
{
*ptr++ = LONG(FLT2FIX(player->plr->mo->pos[VX]));
*ptr++ = LONG(FLT2FIX(player->plr->mo->pos[VY]));
*ptr++ = LONG(FLT2FIX(player->plr->mo->pos[VZ]));

// Which way is the player looking at?
*ptr++ = LONG(player->plr->mo->angle);
*ptr++ = LONG(FLT2FIX(player->plr->lookDir));
// Which way is the player looking at?
*ptr++ = LONG(player->plr->mo->angle);
*ptr++ = LONG(FLT2FIX(player->plr->lookDir));
}
else
{
// Not in a map, so can't provide position/direction.
int i;
for(i = 0; i < 5; ++i) *ptr++ = 0;
}

// Currently active weapon.
if(actionType == GPA_CHANGE_WEAPON)
Expand Down
15 changes: 15 additions & 0 deletions doomsday/plugins/common/src/d_netsv.c
Expand Up @@ -1410,6 +1410,21 @@ void NetSv_DoAction(int player, const char *data)
angle, lookDir, readyWeapon);
#endif

if(G_GetGameState() != GS_MAP)
{
if(G_GetGameState() == GS_INTERMISSION)
{
if(type == GPA_USE || type == GPA_FIRE)
{
#ifdef _DEBUG
Con_Message("NetSv_DoAction: Intermission accelerate.\n");
#endif
IN_SkipToNext();
}
}
return;
}

if(pl->playerState == PST_DEAD)
{
// This player is dead. Rise, my friend!
Expand Down
5 changes: 5 additions & 0 deletions doomsday/plugins/jdoom/include/wi_stuff.h
Expand Up @@ -56,4 +56,9 @@ void WI_Ticker(void);
// Draw the intermission screen.
void WI_Drawer(void);

/**
* Skip to the next state in the intermission.
*/
void IN_SkipToNext(void);

#endif
19 changes: 17 additions & 2 deletions doomsday/plugins/jdoom/src/wi_stuff.c
Expand Up @@ -304,6 +304,11 @@ static dpatch_t bp[MAXPLAYERS]; // "gray P[1..MAXPLAYERS]"

// CODE --------------------------------------------------------------------

void IN_SkipToNext(void)
{
accelerateStage = 1;
}

void WI_slamBackground(void)
{
GL_DrawPatch(0, 0, bg.lump);
Expand Down Expand Up @@ -1320,7 +1325,12 @@ void WI_checkForAccelerate(void)
if(player->brain.attack)
{
if(!player->attackDown)
accelerateStage = 1;
{
if(IS_CLIENT)
NetCl_PlayerActionRequest(player, GPA_FIRE, 0);
else
IN_SkipToNext();
}
player->attackDown = true;
}
else
Expand All @@ -1331,7 +1341,12 @@ void WI_checkForAccelerate(void)
if(player->brain.use)
{
if(!player->useDown)
accelerateStage = 1;
{
if(IS_CLIENT)
NetCl_PlayerActionRequest(player, GPA_USE, 0);
else
IN_SkipToNext();
}
player->useDown = true;
}
else
Expand Down
5 changes: 5 additions & 0 deletions doomsday/plugins/jdoom64/include/wi_stuff.h
Expand Up @@ -81,4 +81,9 @@ void WI_Init(wbstartstruct_t *wbstartstruct);
void WI_SetState(interludestate_t st);
void WI_End(void);

/**
* Skip to the next state in the intermission.
*/
void IN_SkipToNext(void);

#endif
19 changes: 17 additions & 2 deletions doomsday/plugins/jdoom64/src/wi_stuff.c
Expand Up @@ -973,7 +973,12 @@ void WI_checkForAccelerate(void)
if(player->brain.attack)
{
if(!player->attackDown)
accelerateStage = 1;
{
if(IS_CLIENT)
NetCl_PlayerActionRequest(player, GPA_FIRE, 0);
else
IN_SkipToNext();
}
player->attackDown = true;
}
else
Expand All @@ -982,7 +987,12 @@ void WI_checkForAccelerate(void)
if(player->brain.use)
{
if(!player->useDown)
accelerateStage = 1;
{
if(IS_CLIENT)
NetCl_PlayerActionRequest(player, GPA_USE, 0);
else
IN_SkipToNext();
}
player->useDown = true;
}
else
Expand All @@ -991,6 +1001,11 @@ void WI_checkForAccelerate(void)
}
}

void IN_SkipToNext(void)
{
accelerateStage = 1;
}

/**
* Updates stuff each tick.
*/
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/jheretic/include/in_lude.h
Expand Up @@ -39,7 +39,7 @@ extern int interState;
extern int interTime;

void IN_Init(wbstartstruct_t* wbstartstruct);

void IN_SkipToNext(void);
void IN_Stop(void);

void IN_Ticker(void);
Expand Down
19 changes: 13 additions & 6 deletions doomsday/plugins/jheretic/src/in_lude.c
Expand Up @@ -474,6 +474,11 @@ void IN_Ticker(void)
}
}

void IN_SkipToNext(void)
{
skipIntermission = 1;
}

/**
* Check to see if any player hit a key.
*/
Expand All @@ -482,9 +487,6 @@ void IN_CheckForSkip(void)
int i;
player_t *player;

if(IS_CLIENT)
return;

for(i = 0, player = players; i < MAXPLAYERS; ++i, player++)
{
if(players->plr->inGame)
Expand All @@ -493,9 +495,11 @@ void IN_CheckForSkip(void)
{
if(!player->attackDown)
{
skipIntermission = 1;
if(IS_CLIENT)
NetCl_PlayerActionRequest(player, GPA_FIRE, 0);
else
IN_SkipToNext();
}

player->attackDown = true;
}
else
Expand All @@ -507,7 +511,10 @@ void IN_CheckForSkip(void)
{
if(!player->useDown)
{
skipIntermission = 1;
if(IS_CLIENT)
NetCl_PlayerActionRequest(player, GPA_USE, 0);
else
IN_SkipToNext();
}
player->useDown = true;
}
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/jhexen/include/in_lude.h
Expand Up @@ -39,5 +39,6 @@ void IN_Init(void);
void IN_Stop(void);
void IN_Ticker(void);
void IN_Drawer(void);
void IN_SkipToNext(void);

#endif
15 changes: 13 additions & 2 deletions doomsday/plugins/jhexen/src/in_lude.c
Expand Up @@ -290,6 +290,11 @@ void IN_Ticker(void)
}
}

void IN_SkipToNext(void)
{
skipIntermission = 1;
}

/**
* Check to see if any player hit a key.
*/
Expand All @@ -308,7 +313,10 @@ static void CheckForSkip(void)
{
if(!player->attackDown)
{
skipIntermission = 1;
if(IS_CLIENT)
NetCl_PlayerActionRequest(player, GPA_FIRE, 0);
else
IN_SkipToNext();
}
player->attackDown = true;
}
Expand All @@ -321,7 +329,10 @@ static void CheckForSkip(void)
{
if(!player->useDown)
{
skipIntermission = 1;
if(IS_CLIENT)
NetCl_PlayerActionRequest(player, GPA_USE, 0);
else
IN_SkipToNext();
}
player->useDown = true;
}
Expand Down

0 comments on commit d4fd168

Please sign in to comment.