mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Merge branch 'join-bug-fix' into 'master'
Fix for the join bug Closes #302, #338, and #347 See merge request STJr/SRB2Internal!545
This commit is contained in:
commit
9541137f5e
7 changed files with 83 additions and 75 deletions
117
src/d_main.c
117
src/d_main.c
|
@ -291,8 +291,11 @@ static void D_Display(void)
|
|||
switch (gamestate)
|
||||
{
|
||||
case GS_TITLESCREEN:
|
||||
F_TitleScreenDrawer();
|
||||
break;
|
||||
if (!titlemapinaction || !curbghide) {
|
||||
F_TitleScreenDrawer();
|
||||
break;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case GS_LEVEL:
|
||||
if (!gametic)
|
||||
break;
|
||||
|
@ -363,11 +366,56 @@ static void D_Display(void)
|
|||
|
||||
// clean up border stuff
|
||||
// see if the border needs to be initially drawn
|
||||
if (gamestate == GS_LEVEL)
|
||||
if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction && curbghide && (!hidetitlemap)))
|
||||
{
|
||||
// draw the view directly
|
||||
|
||||
D_Render();
|
||||
if (!automapactive && !dedicated && cv_renderview.value)
|
||||
{
|
||||
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
|
||||
{
|
||||
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
|
||||
objectsdrawn = 0;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
HWR_RenderPlayerView(0, &players[displayplayer]);
|
||||
else
|
||||
#endif
|
||||
if (rendermode != render_none)
|
||||
R_RenderPlayerView(&players[displayplayer]);
|
||||
}
|
||||
|
||||
// render the second screen
|
||||
if (splitscreen && players[secondarydisplayplayer].mo)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
HWR_RenderPlayerView(1, &players[secondarydisplayplayer]);
|
||||
else
|
||||
#endif
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
viewwindowy = vid.height / 2;
|
||||
M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0]));
|
||||
|
||||
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
|
||||
|
||||
R_RenderPlayerView(&players[secondarydisplayplayer]);
|
||||
|
||||
viewwindowy = 0;
|
||||
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
|
||||
}
|
||||
}
|
||||
|
||||
// Image postprocessing effect
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
if (postimgtype)
|
||||
V_DoPostProcessor(0, postimgtype, postimgparam);
|
||||
if (postimgtype2)
|
||||
V_DoPostProcessor(1, postimgtype2, postimgparam2);
|
||||
}
|
||||
}
|
||||
|
||||
if (lastdraw)
|
||||
{
|
||||
|
@ -380,9 +428,14 @@ static void D_Display(void)
|
|||
lastdraw = false;
|
||||
}
|
||||
|
||||
ST_Drawer();
|
||||
F_TextPromptDrawer();
|
||||
HU_Drawer();
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
ST_Drawer();
|
||||
F_TextPromptDrawer();
|
||||
HU_Drawer();
|
||||
}
|
||||
else
|
||||
F_TitleScreenDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -494,56 +547,6 @@ static void D_Display(void)
|
|||
}
|
||||
}
|
||||
|
||||
void D_Render(void)
|
||||
{
|
||||
if (!automapactive && !dedicated && cv_renderview.value)
|
||||
{
|
||||
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
|
||||
{
|
||||
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
|
||||
objectsdrawn = 0;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
HWR_RenderPlayerView(0, &players[displayplayer]);
|
||||
else
|
||||
#endif
|
||||
if (rendermode != render_none)
|
||||
R_RenderPlayerView(&players[displayplayer]);
|
||||
}
|
||||
|
||||
// render the second screen
|
||||
if (splitscreen && players[secondarydisplayplayer].mo)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
if (rendermode != render_soft)
|
||||
HWR_RenderPlayerView(1, &players[secondarydisplayplayer]);
|
||||
else
|
||||
#endif
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
viewwindowy = vid.height / 2;
|
||||
M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0]));
|
||||
|
||||
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
|
||||
|
||||
R_RenderPlayerView(&players[secondarydisplayplayer]);
|
||||
|
||||
viewwindowy = 0;
|
||||
M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0]));
|
||||
}
|
||||
}
|
||||
|
||||
// Image postprocessing effect
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
if (postimgtype)
|
||||
V_DoPostProcessor(0, postimgtype, postimgparam);
|
||||
if (postimgtype2)
|
||||
V_DoPostProcessor(1, postimgtype2, postimgparam2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// D_SRB2Loop
|
||||
// =========================================================================
|
||||
|
|
|
@ -54,7 +54,4 @@ const char *D_Home(void);
|
|||
void D_AdvanceDemo(void);
|
||||
void D_StartTitle(void);
|
||||
|
||||
/* Here for title maps */
|
||||
void D_Render(void);
|
||||
|
||||
#endif //__D_MAIN__
|
||||
|
|
|
@ -2588,9 +2588,7 @@ void F_TitleScreenDrawer(void)
|
|||
// Draw that sky!
|
||||
if (curbgcolor >= 0)
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
||||
else if (titlemapinaction && curbghide && ! hidetitlemap)
|
||||
D_Render();
|
||||
else
|
||||
else if (!curbghide || !titlemapinaction || gamestate == GS_WAITINGPLAYERS)
|
||||
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||
|
||||
// Don't draw outside of the title screen, or if the patch isn't there.
|
||||
|
@ -3350,6 +3348,10 @@ void F_TitleScreenTicker(boolean run)
|
|||
if (run)
|
||||
finalecount++;
|
||||
|
||||
// don't trigger if doing anything besides idling on title
|
||||
if (gameaction != ga_nothing || gamestate != GS_TITLESCREEN)
|
||||
return;
|
||||
|
||||
// Execute the titlemap camera settings
|
||||
if (titlemapinaction)
|
||||
{
|
||||
|
@ -3396,10 +3398,6 @@ void F_TitleScreenTicker(boolean run)
|
|||
}
|
||||
}
|
||||
|
||||
// don't trigger if doing anything besides idling on title
|
||||
if (gameaction != ga_nothing || gamestate != GS_TITLESCREEN)
|
||||
return;
|
||||
|
||||
// no demos to play? or, are they disabled?
|
||||
if (!cv_rollingdemos.value || !numDemos)
|
||||
return;
|
||||
|
|
|
@ -2978,7 +2978,7 @@ void G_AddPlayer(INT32 playernum)
|
|||
if (G_GametypeUsesLives() || ((netgame || multiplayer) && gametype == GT_COOP))
|
||||
p->lives = cv_startinglives.value;
|
||||
|
||||
if (countplayers && !notexiting)
|
||||
if ((countplayers && !notexiting) || G_IsSpecialStage(gamemap))
|
||||
P_DoPlayerExit(p);
|
||||
}
|
||||
|
||||
|
|
|
@ -11294,7 +11294,7 @@ void P_SpawnPlayer(INT32 playernum)
|
|||
mobj->radius = FixedMul(skins[p->skin].radius, mobj->scale);
|
||||
mobj->height = P_GetPlayerHeight(p);
|
||||
|
||||
if (!leveltime && ((maptol & TOL_NIGHTS) == TOL_NIGHTS) != (G_IsSpecialStage(gamemap))) // non-special NiGHTS stage or special non-NiGHTS stage
|
||||
if (!leveltime && !p->spectator && ((maptol & TOL_NIGHTS) == TOL_NIGHTS) != (G_IsSpecialStage(gamemap))) // non-special NiGHTS stage or special non-NiGHTS stage
|
||||
{
|
||||
if (maptol & TOL_NIGHTS)
|
||||
{
|
||||
|
|
|
@ -476,7 +476,7 @@ static inline void P_DoSpecialStageStuff(void)
|
|||
// Count up the rings of all the players and see if
|
||||
// they've collected the required amount.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i])
|
||||
if (playeringame[i] && players[i].nightstime)
|
||||
{
|
||||
tic_t oldnightstime = players[i].nightstime;
|
||||
countspheres += players[i].spheres;
|
||||
|
@ -506,12 +506,11 @@ static inline void P_DoSpecialStageStuff(void)
|
|||
{
|
||||
// Halt all the players
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i])
|
||||
if (playeringame[i] && !players[i].exiting)
|
||||
{
|
||||
players[i].mo->momx = players[i].mo->momy = 0;
|
||||
players[i].exiting = (14*TICRATE)/5 + 1;
|
||||
}
|
||||
|
||||
sstimer = 0;
|
||||
P_GiveEmerald(true);
|
||||
P_RestoreMusic(&players[consoleplayer]);
|
||||
|
|
17
src/p_user.c
17
src/p_user.c
|
@ -343,13 +343,15 @@ void P_GiveEmerald(boolean spawnObj)
|
|||
continue;
|
||||
|
||||
emmo = P_SpawnMobjFromMobj(players[i].mo, 0, 0, players[i].mo->height, MT_GOTEMERALD);
|
||||
if (!emmo)
|
||||
continue;
|
||||
P_SetTarget(&emmo->target, players[i].mo);
|
||||
P_SetMobjState(emmo, mobjinfo[MT_GOTEMERALD].meleestate + em);
|
||||
P_SetTarget(&players[i].mo->tracer, emmo);
|
||||
|
||||
if (pnum == 255)
|
||||
{
|
||||
i = pnum;
|
||||
pnum = i;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1223,6 +1225,7 @@ void P_GivePlayerSpheres(player_t *player, INT32 num_spheres)
|
|||
//
|
||||
void P_GivePlayerLives(player_t *player, INT32 numlives)
|
||||
{
|
||||
UINT8 prevlives = player->lives;
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
|
@ -1239,10 +1242,9 @@ void P_GivePlayerLives(player_t *player, INT32 numlives)
|
|||
|
||||
if ((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0)
|
||||
{
|
||||
UINT8 prevlives = player->lives;
|
||||
P_GivePlayerRings(player, 100*numlives);
|
||||
if (player->lives - prevlives >= numlives)
|
||||
return;
|
||||
goto docooprespawn;
|
||||
|
||||
numlives = (numlives + prevlives - player->lives);
|
||||
}
|
||||
|
@ -1256,6 +1258,15 @@ void P_GivePlayerLives(player_t *player, INT32 numlives)
|
|||
player->lives = 99;
|
||||
else if (player->lives < 1)
|
||||
player->lives = 1;
|
||||
|
||||
docooprespawn:
|
||||
if (cv_coopstarposts.value)
|
||||
return;
|
||||
if (prevlives > 0)
|
||||
return;
|
||||
if (!player->spectator)
|
||||
return;
|
||||
P_SpectatorJoinGame(player);
|
||||
}
|
||||
|
||||
void P_GiveCoopLives(player_t *player, INT32 numlives, boolean sound)
|
||||
|
|
Loading…
Reference in a new issue