Merge branch 'sonicitems' into bumpstuff

This commit is contained in:
TehRealSalt 2018-07-22 00:32:11 -04:00
commit cac613f3ef
13 changed files with 215 additions and 154 deletions

View file

@ -2522,18 +2522,12 @@ static void Command_Teamchange_f(void)
return;
}
if (G_GametypeHasTeams())
{
if (NetPacket.packet.newteam == (unsigned)players[consoleplayer].ctfteam ||
(players[consoleplayer].spectator && !NetPacket.packet.newteam))
error = true;
}
else if (G_GametypeHasSpectators())
{
if ((players[consoleplayer].spectator && !NetPacket.packet.newteam) ||
(!players[consoleplayer].spectator && NetPacket.packet.newteam == 3))
error = true;
}
if (players[consoleplayer].spectator && !(players[consoleplayer].pflags & PF_WANTSTOJOIN) && !NetPacket.packet.newteam)
error = true;
else if (G_GametypeHasTeams() && NetPacket.packet.newteam == (unsigned)players[consoleplayer].ctfteam)
error = true;
else if (G_GametypeHasSpectators() && !players[consoleplayer].spectator && NetPacket.packet.newteam == 3)
error = true;
#ifdef PARANOIA
else
I_Error("Invalid gametype after initial checks!");
@ -2619,18 +2613,12 @@ static void Command_Teamchange2_f(void)
return;
}
if (G_GametypeHasTeams())
{
if (NetPacket.packet.newteam == (unsigned)players[secondarydisplayplayer].ctfteam ||
(players[secondarydisplayplayer].spectator && !NetPacket.packet.newteam))
error = true;
}
else if (G_GametypeHasSpectators())
{
if ((players[secondarydisplayplayer].spectator && !NetPacket.packet.newteam) ||
(!players[secondarydisplayplayer].spectator && NetPacket.packet.newteam == 3))
error = true;
}
if (players[secondarydisplayplayer].spectator && !(players[secondarydisplayplayer].pflags & PF_WANTSTOJOIN) && !NetPacket.packet.newteam)
error = true;
else if (G_GametypeHasTeams() && NetPacket.packet.newteam == (unsigned)players[secondarydisplayplayer].ctfteam)
error = true;
else if (G_GametypeHasSpectators() && !players[secondarydisplayplayer].spectator && NetPacket.packet.newteam == 3)
error = true;
#ifdef PARANOIA
else
I_Error("Invalid gametype after initial checks!");
@ -2716,18 +2704,12 @@ static void Command_Teamchange3_f(void)
return;
}
if (G_GametypeHasTeams())
{
if (NetPacket.packet.newteam == (unsigned)players[thirddisplayplayer].ctfteam ||
(players[thirddisplayplayer].spectator && !NetPacket.packet.newteam))
error = true;
}
else if (G_GametypeHasSpectators())
{
if ((players[thirddisplayplayer].spectator && !NetPacket.packet.newteam) ||
(!players[thirddisplayplayer].spectator && NetPacket.packet.newteam == 3))
error = true;
}
if (players[thirddisplayplayer].spectator && !(players[thirddisplayplayer].pflags & PF_WANTSTOJOIN) && !NetPacket.packet.newteam)
error = true;
else if (G_GametypeHasTeams() && NetPacket.packet.newteam == (unsigned)players[thirddisplayplayer].ctfteam)
error = true;
else if (G_GametypeHasSpectators() && !players[thirddisplayplayer].spectator && NetPacket.packet.newteam == 3)
error = true;
#ifdef PARANOIA
else
I_Error("Invalid gametype after initial checks!");
@ -2813,18 +2795,12 @@ static void Command_Teamchange4_f(void)
return;
}
if (G_GametypeHasTeams())
{
if (NetPacket.packet.newteam == (unsigned)players[fourthdisplayplayer].ctfteam ||
(players[fourthdisplayplayer].spectator && !NetPacket.packet.newteam))
error = true;
}
else if (G_GametypeHasSpectators())
{
if ((players[fourthdisplayplayer].spectator && !NetPacket.packet.newteam) ||
(!players[fourthdisplayplayer].spectator && NetPacket.packet.newteam == 3))
error = true;
}
if (players[fourthdisplayplayer].spectator && !(players[fourthdisplayplayer].pflags & PF_WANTSTOJOIN) && !NetPacket.packet.newteam)
error = true;
else if (G_GametypeHasTeams() && NetPacket.packet.newteam == (unsigned)players[fourthdisplayplayer].ctfteam)
error = true;
else if (G_GametypeHasSpectators() && !players[fourthdisplayplayer].spectator && NetPacket.packet.newteam == 3)
error = true;
#ifdef PARANOIA
else
I_Error("Invalid gametype after initial checks!");
@ -3024,24 +3000,23 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
}
// Prevent multiple changes in one go.
if (G_TagGametype())
if (players[playernum].spectator && !(players[playernum].pflags & PF_WANTSTOJOIN) && !NetPacket.packet.newteam)
return;
else if (G_TagGametype())
{
if (((players[playernum].pflags & PF_TAGIT) && NetPacket.packet.newteam == 1) ||
(!(players[playernum].pflags & PF_TAGIT) && NetPacket.packet.newteam == 2) ||
(players[playernum].spectator && NetPacket.packet.newteam == 0) ||
(!players[playernum].spectator && NetPacket.packet.newteam == 3))
return;
}
else if (G_GametypeHasTeams())
{
if ((NetPacket.packet.newteam && (NetPacket.packet.newteam == (unsigned)players[playernum].ctfteam)) ||
(players[playernum].spectator && !NetPacket.packet.newteam))
if (NetPacket.packet.newteam && (NetPacket.packet.newteam == (unsigned)players[playernum].ctfteam))
return;
}
else if (G_GametypeHasSpectators())
{
if ((players[playernum].spectator && !NetPacket.packet.newteam) ||
(!players[playernum].spectator && NetPacket.packet.newteam == 3))
if (!players[playernum].spectator && NetPacket.packet.newteam == 3)
return;
}
else
@ -3113,19 +3088,26 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
}
//Safety first!
if (players[playernum].mo)
// (not respawning spectators here...)
if (!players[playernum].spectator)
{
if (!players[playernum].spectator)
P_DamageMobj(players[playernum].mo, NULL, NULL, 10000);
/*else
if (players[playernum].mo)
{
P_RemoveMobj(players[playernum].mo);
players[playernum].mo = NULL;
//if (!players[playernum].spectator)
P_DamageMobj(players[playernum].mo, NULL, NULL, 10000);
/*else
{
if (players[playernum].mo)
{
P_RemoveMobj(players[playernum].mo);
players[playernum].mo = NULL;
}
players[playernum].playerstate = PST_REBORN;
}*/
}
else
players[playernum].playerstate = PST_REBORN;
}*/
}
else
players[playernum].playerstate = PST_REBORN;
//Now that we've done our error checking and killed the player
//if necessary, put the player on the correct team/status.
@ -3210,6 +3192,8 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
}
else if (NetPacket.packet.newteam == 3)
/*CONS_Printf(M_GetText("%s entered the game.\n"), player_names[playernum])*/;
else if (players[playernum].pflags & PF_WANTSTOJOIN)
players[playernum].pflags &= ~PF_WANTSTOJOIN;
else
CONS_Printf(M_GetText("%s became a spectator.\n"), player_names[playernum]);

View file

@ -454,6 +454,7 @@ extern tic_t wantedcalcdelay;
extern tic_t indirectitemcooldown;
extern tic_t spbincoming;
extern UINT8 spbplayer;
extern tic_t mapreset;
extern boolean legitimateexit;
extern boolean comebackshowninfo;

View file

@ -257,14 +257,15 @@ INT16 votelevels[4][2]; // Levels that were rolled by the host
SINT8 votes[MAXPLAYERS]; // Each player's vote
SINT8 pickedvote; // What vote the host rolls
// Server-sided variables
// Server-sided, synched variables
SINT8 battlewanted[4]; // WANTED players in battle, worth x2 points
tic_t wantedcalcdelay; // Time before it recalculates WANTED
tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any other item that works indirectly is awarded
tic_t spbincoming; // Timer before SPB hits, can switch targets at this point
UINT8 spbplayer; // Player num that used the last SPB
tic_t mapreset; // Map reset delay when enough players have joined an empty game
// Client-sided variables (NEVER use in anything that needs to be synced with other players)
// Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players)
boolean legitimateexit; // Did this client actually finish the match?
boolean comebackshowninfo; // Have you already seen the "ATTACK OR PROTECT" message?
tic_t curlap; // Current lap time
@ -2175,7 +2176,9 @@ void G_Ticker(boolean run)
if (run)
{
if (G_GametypeHasSpectators() && (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING))
if (G_GametypeHasSpectators()
&& (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING // definitely good
|| gamestate == GS_WAITINGPLAYERS)) // definitely a problem if we don't do it at all in this gamestate, but might need more protection?
K_CheckSpectateStatus();
if (pausedelay)

View file

@ -209,7 +209,7 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
// if it's meant to cover the whole screen, black out the rest
// cx and cy are possibly *slightly* off from float maths
// This is done before here compared to software because we directly alter cx and cy to centre
if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
/*if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
{
// Need to temporarily cache the real patch to get the colour of the top left pixel
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
@ -217,7 +217,7 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
const UINT8 *source = (const UINT8 *)(column) + 3;
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
Z_Free(realpatch);
}
}*/
// centre screen
if (vid.width != BASEVIDWIDTH * vid.dupx)
{
@ -357,7 +357,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
// if it's meant to cover the whole screen, black out the rest
// cx and cy are possibly *slightly* off from float maths
// This is done before here compared to software because we directly alter cx and cy to centre
if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
/*if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
{
// Need to temporarily cache the real patch to get the colour of the top left pixel
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
@ -365,7 +365,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
const UINT8 *source = (const UINT8 *)(column) + 3;
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
Z_Free(realpatch);
}
}*/
// centre screen
if (vid.width != BASEVIDWIDTH * vid.dupx)
{

View file

@ -30,6 +30,7 @@
// indirectitemcooldown is timer before anyone's allowed another Shrink/SPB
// spbincoming is the timer before k_deathsentence is cast on the player in 1st
// spbplayer is the last player who fired a SPB
// mapreset is set when enough players fill an empty server
//{ SRB2kart Color Code
@ -1192,6 +1193,9 @@ void K_RespawnChecker(player_t *player)
{
ticcmd_t *cmd = &player->cmd;
if (player->spectator)
return;
if (player->kartstuff[k_respawn] > 3)
{
player->kartstuff[k_respawn]--;
@ -1201,7 +1205,8 @@ void K_RespawnChecker(player_t *player)
if (leveltime % 8 == 0)
{
INT32 i;
S_StartSound(player->mo, sfx_s3kcas);
if (!mapreset)
S_StartSound(player->mo, sfx_s3kcas);
for (i = 0; i < 8; i++)
{
@ -3449,7 +3454,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
else if (cmd->buttons & BT_ATTACK)
player->pflags |= PF_ATTACKDOWN;
if (player && player->mo && player->mo->health > 0 && !player->spectator && !player->exiting && player->kartstuff[k_spinouttimer] == 0)
if (player && player->mo && player->mo->health > 0 && !player->spectator && !(player->exiting || mapreset) && player->kartstuff[k_spinouttimer] == 0)
{
// First, the really specific, finicky items that function without the item being directly in your item slot.
// Eggman Monitor throwing
@ -4152,44 +4157,47 @@ void K_CheckBumpers(void)
void K_CheckSpectateStatus(void)
{
UINT8 respawnlist[MAXPLAYERS];
UINT8 i, no = 0;
UINT8 numingame = 0, numjoiners = 0;
UINT8 i, numingame = 0, numjoiners = 0;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i])
continue;
if (!players[i].spectator)
{
numingame++;
if (gamestate != GS_LEVEL)
continue;
if (G_RaceGametype() && players[i].laps > 0)
return;
}
if (cv_allowteamchange.value && !(players[i].pflags & PF_WANTSTOJOIN))
continue;
respawnlist[no++] = i;
}
numjoiners = no; // Move the map change stuff up here when it gets a delay, and remove this redundant numjoiners var
while (no)
P_SpectatorJoinGame(&players[respawnlist[--no]]);
if (!server)
return;
// Reset the match if you're in an empty server, TODO: put it on a short 5-10 second timer, so you have a chance to roam.
if (gamestate == GS_LEVEL && (numingame < 2 && numingame+numjoiners >= 2))
// Get the number of players in game, and the players to be de-spectated.
for (i = 0; i < MAXPLAYERS; i++)
{
CONS_Printf("Here comes a new challenger! Resetting map...\n");
D_MapChange(gamemap, gametype, ultimatemode, true, 0, false, false);
return;
if (!playeringame[i])
continue;
if (!players[i].spectator)
{
numingame++;
if (gamestate != GS_LEVEL) // Allow if you're not in a level
continue;
if (players[i].exiting) // DON'T allow if anyone's exiting
return;
if (numingame < 2 || leveltime < starttime || mapreset) // Allow if the match hasn't started yet
continue;
if (G_RaceGametype() && players[i].laps) // DON'T allow if the race is at 2 laps
return;
continue;
}
else if (!(players[i].pflags & PF_WANTSTOJOIN))
continue;
respawnlist[numjoiners++] = i;
}
// literally zero point in going any further if nobody is joining
if (!numjoiners)
return;
// Reset the match if you're in an empty server
if (!mapreset && gamestate == GS_LEVEL && leveltime >= starttime && (numingame < 2 && numingame+numjoiners >= 2))
{
S_ChangeMusicInternal("chalng", false); // COME ON
mapreset = 3*TICRATE; // Even though only the server uses this for game logic, set for everyone for HUD in the future
}
// Finally, we can de-spectate everyone!
for (i = 0; i < numjoiners; i++)
P_SpectatorJoinGame(&players[respawnlist[i]]);
}
//}
@ -4265,6 +4273,8 @@ static patch_t *kp_spbwarning[2];
static patch_t *kp_fpview[3];
static patch_t *kp_inputwheel[5];
static patch_t *kp_challenger[25];
void K_LoadKartHUDGraphics(void)
{
INT32 i, j;
@ -4418,6 +4428,15 @@ void K_LoadKartHUDGraphics(void)
buffer[7] = '0'+i;
kp_inputwheel[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
}
// HERE COMES A NEW CHALLENGER
sprintf(buffer, "K_CHALxx");
for (i = 0; i < 25; i++)
{
buffer[6] = '0'+((i+1)/10);
buffer[7] = '0'+((i+1)%10);
kp_challenger[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
}
}
//}
@ -5849,6 +5868,22 @@ static void K_drawInput(void)
}
}
static void K_drawChallengerScreen(void)
{
// This is an insanely complicated animation.
static UINT8 anim[52] = {
0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13, // frame 1-14, 2 tics: HERE COMES A NEW slides in
14,14,14,14,14,14, // frame 15, 6 tics: pause on the W
15,16,17,18, // frame 16-19, 1 tic: CHALLENGER approaches screen
19,20,19,20,19,20,19,20,19,20, // frame 20-21, 1 tic, 5 alternating: all text vibrates from impact
21,22,23,24 // frame 22-25, 1 tic: CHALLENGER turns gold
};
const UINT8 offset = min(52-1, (3*TICRATE)-mapreset);
V_DrawFadeScreen(0xFF00, 16); // Fade out
V_DrawScaledPatch(0, 0, 0, kp_challenger[anim[offset]]);
}
static void K_drawCheckpointDebugger(void)
{
if ((numstarposts/2 + stplyr->starpostnum) >= numstarposts)
@ -5884,6 +5919,12 @@ void K_drawKartHUD(void)
K_drawKartMinimap();
// Draw full screen stuff that turns off the rest of the HUD
if (mapreset)
{
K_drawChallengerScreen();
return;
}
if ((G_BattleGametype())
&& (stplyr->exiting
|| (stplyr->kartstuff[k_bumper] <= 0

View file

@ -535,6 +535,7 @@ static menuitem_t MPauseMenu[] =
{IT_STRING | IT_CALL, NULL, "Spectate", M_ConfirmSpectate, 48},
{IT_STRING | IT_CALL, NULL, "Enter Game", M_ConfirmEnterGame, 48},
{IT_STRING | IT_CALL, NULL, "Cancel Join", M_ConfirmSpectate, 48},
{IT_STRING | IT_SUBMENU, NULL, "Switch Team...", &MISC_ChangeTeamDef, 48},
{IT_CALL | IT_STRING, NULL, "Player Setup...", M_SetupMultiPlayer, 56}, // alone
{IT_CALL | IT_STRING, NULL, "Options", M_Options, 64},
@ -557,6 +558,7 @@ typedef enum
#endif
mpause_spectate,
mpause_entergame,
mpause_canceljoin,
mpause_switchteam,
mpause_psetup,
mpause_options,
@ -2842,6 +2844,7 @@ void M_StartControlPanel(void)
#endif
MPauseMenu[mpause_spectate].status = IT_DISABLED;
MPauseMenu[mpause_entergame].status = IT_DISABLED;
MPauseMenu[mpause_canceljoin].status = IT_DISABLED;
MPauseMenu[mpause_switchteam].status = IT_DISABLED;
MPauseMenu[mpause_psetup].status = IT_DISABLED;
// Reset these in case splitscreen messes things up
@ -2889,7 +2892,14 @@ void M_StartControlPanel(void)
if (G_GametypeHasTeams())
MPauseMenu[mpause_switchteam].status = IT_STRING | IT_SUBMENU;
else if (G_GametypeHasSpectators())
MPauseMenu[((&players[consoleplayer] && players[consoleplayer].spectator) ? mpause_entergame : mpause_spectate)].status = IT_STRING | IT_CALL;
{
if (!players[consoleplayer].spectator)
MPauseMenu[mpause_spectate].status = IT_STRING | IT_CALL;
else if (players[consoleplayer].pflags & PF_WANTSTOJOIN)
MPauseMenu[mpause_canceljoin].status = IT_STRING | IT_CALL;
else
MPauseMenu[mpause_entergame].status = IT_STRING | IT_CALL;
}
else // in this odd case, we still want something to be on the menu even if it's useless
MPauseMenu[mpause_spectate].status = IT_GRAYEDOUT;
}
@ -4207,11 +4217,11 @@ static void M_ConfirmSpectate(INT32 choice)
static void M_ConfirmEnterGame(INT32 choice)
{
(void)choice;
if (!cv_allowteamchange.value)
/*if (!cv_allowteamchange.value)
{
M_StartMessage(M_GetText("The server is not allowing\nteam changes at this time.\nPress a key.\n"), NULL, MM_NOTHING);
return;
}
}*/
M_ClearMenus(true);
COM_ImmedExecute("changeteam playing");
}

View file

@ -152,7 +152,7 @@ void P_ResetStarposts(void)
//
boolean P_CanPickupItem(player_t *player, boolean weapon)
{
if (player->exiting)
if (player->exiting || mapreset)
return false;
/*if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) // No bumpers in Match

View file

@ -9830,8 +9830,14 @@ void P_SpawnPlayer(INT32 playernum)
// spawn as spectator determination
if (!G_GametypeHasSpectators())
p->spectator = false;
else if (netgame && p->jointime <= 1 && pcount > 1)
else if (netgame && p->jointime <= 1 && pcount)
{
p->spectator = true;
// Oni doesn't want this
/*if (pcount == 1 || leveltime < starttime)
p->pflags |= PF_WANTSTOJOIN;
p->jointime = 2;*/
}
else if (multiplayer && !netgame)
{
// If you're in a team game and you don't have a team assigned yet...
@ -9912,41 +9918,35 @@ void P_SpawnPlayer(INT32 playernum)
overheadarrow->flags2 |= MF2_DONTDRAW;
P_SetScale(overheadarrow, mobj->destscale);
if (p->spectator) // HEY! No being cheap...
if (p->spectator && pcount > 1) // HEY! No being cheap...
p->kartstuff[k_bumper] = 0;
else if (p->kartstuff[k_bumper] > 0 || leveltime < 1
|| (p->jointime <= 1 && pcount <= 1))
{
INT32 i;
angle_t newangle;
angle_t diff;
fixed_t newx;
fixed_t newy;
mobj_t *mo;
if (leveltime < 1 || (p->jointime <= 1 && pcount <= 1)) // Start of the map?
p->kartstuff[k_bumper] = cv_kartbumpers.value; // Reset those bumpers!
if (p->kartstuff[k_bumper] <= 1)
diff = 0;
else
diff = FixedAngle(360*FRACUNIT/p->kartstuff[k_bumper]);
newangle = mobj->angle;
newx = mobj->x + P_ReturnThrustX(mobj, newangle + ANGLE_180, 64*FRACUNIT);
newy = mobj->y + P_ReturnThrustY(mobj, newangle + ANGLE_180, 64*FRACUNIT);
for (i = 0; i < p->kartstuff[k_bumper]; i++)
if (p->kartstuff[k_bumper])
{
mo = P_SpawnMobj(newx, newy, mobj->z, MT_BATTLEBUMPER);
mo->threshold = i;
P_SetTarget(&mo->target, mobj);
mo->angle = (diff * (i-1));
mo->color = mobj->color;
if (mobj->flags2 & MF2_DONTDRAW)
mo->flags2 |= MF2_DONTDRAW;
else
mo->flags2 &= ~MF2_DONTDRAW;
INT32 i;
angle_t diff = FixedAngle(360*FRACUNIT/p->kartstuff[k_bumper]);
angle_t newangle = mobj->angle;
fixed_t newx = mobj->x + P_ReturnThrustX(mobj, newangle + ANGLE_180, 64*FRACUNIT);
fixed_t newy = mobj->y + P_ReturnThrustY(mobj, newangle + ANGLE_180, 64*FRACUNIT);
mobj_t *mo;
for (i = 0; i < p->kartstuff[k_bumper]; i++)
{
mo = P_SpawnMobj(newx, newy, mobj->z, MT_BATTLEBUMPER);
mo->threshold = i;
P_SetTarget(&mo->target, mobj);
mo->angle = (diff * (i-1));
mo->color = mobj->color;
if (mobj->flags2 & MF2_DONTDRAW)
mo->flags2 |= MF2_DONTDRAW;
else
mo->flags2 &= ~MF2_DONTDRAW;
}
}
}
else if (p->kartstuff[k_bumper] <= 0)

View file

@ -3267,6 +3267,7 @@ static void P_NetArchiveMisc(void)
WRITEUINT32(save_p, indirectitemcooldown);
WRITEUINT32(save_p, spbincoming);
WRITEUINT8(save_p, spbplayer);
WRITEUINT32(save_p, mapreset);
// Is it paused?
if (paused)
@ -3371,6 +3372,7 @@ static inline boolean P_NetUnArchiveMisc(void)
indirectitemcooldown = READUINT32(save_p);
spbincoming = READUINT32(save_p);
spbplayer = READUINT8(save_p);
mapreset = READUINT32(save_p);
// Is it paused?
if (READUINT8(save_p) == 0x2f)

View file

@ -3017,6 +3017,7 @@ boolean P_SetupLevel(boolean skipprecip)
indirectitemcooldown = 0;
spbincoming = 0;
spbplayer = 0;
mapreset = 0;
// clear special respawning que
iquehead = iquetail = 0;

View file

@ -740,6 +740,13 @@ void P_Ticker(boolean run)
G_ConsGhostTic();
if (modeattacking)
G_GhostTicker();
if (mapreset && --mapreset <= 0)
{
mapreset = 0;
if (server)
D_MapChange(gamemap, gametype, ultimatemode, true, 0, false, false);
}
}
P_MapEnd();

View file

@ -1181,12 +1181,19 @@ void P_RestoreMusic(player_t *player)
if (!P_IsLocalPlayer(player)) // Only applies to a local player
return;
// Event - HERE COMES A NEW CHALLENGER
if (mapreset)
{
S_ChangeMusicInternal("chalng", false); //S_StopMusic();
return;
}
// Event - Level Ending
if (P_EndingMusic(player))
return;
S_SpeedMusic(1.0f);
// SRB2kart - We have some different powers than vanilla, some of which tweak the music.
// Event - Level Start
if (leveltime < (starttime + (TICRATE/2)))
S_ChangeMusicInternal("kstart", false); //S_StopMusic();
@ -1683,7 +1690,7 @@ void P_SpawnSpinMobj(player_t *player, mobjtype_t type)
// Player exits the map via sector trigger
void P_DoPlayerExit(player_t *player)
{
if (player->exiting)
if (player->exiting || mapreset)
return;
if ((player == &players[consoleplayer]
@ -4702,7 +4709,7 @@ static void P_3dMovement(player_t *player)
cmd = &player->cmd;
if (player->exiting || player->pflags & PF_STASIS || player->kartstuff[k_spinouttimer]) // pw_introcam?
if ((player->exiting || mapreset) || player->pflags & PF_STASIS || player->kartstuff[k_spinouttimer]) // pw_introcam?
{
cmd->forwardmove = cmd->sidemove = 0;
if (player->kartstuff[k_sneakertimer])
@ -4711,14 +4718,14 @@ static void P_3dMovement(player_t *player)
{
if (!player->skidtime)
player->pflags &= ~PF_GLIDING;
else if (player->exiting)
else if (player->exiting || mapreset)
{
player->pflags &= ~PF_GLIDING;
P_SetPlayerMobjState(player->mo, S_KART_WALK1); // SRB2kart - was S_PLAY_RUN1
player->skidtime = 0;
}
}
if (player->pflags & PF_SPINNING && !player->exiting)
if (player->pflags & PF_SPINNING && !(player->exiting || mapreset))
{
player->pflags &= ~PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND
@ -4803,7 +4810,7 @@ static void P_3dMovement(player_t *player)
player->aiming = cmd->aiming<<FRACBITS;
// Forward movement
if (!(player->exiting || (P_PlayerInPain(player) && !onground)))
if (!((player->exiting || mapreset) || (P_PlayerInPain(player) && !onground)))
{
//movepushforward = cmd->forwardmove * (thrustfactor * acceleration);
movepushforward = K_3dKartMovement(player, onground, cmd->forwardmove);
@ -4843,7 +4850,7 @@ static void P_3dMovement(player_t *player)
}
// Sideways movement
if (cmd->sidemove != 0 && !(player->exiting || player->kartstuff[k_spinouttimer]))
if (cmd->sidemove != 0 && !((player->exiting || mapreset) || player->kartstuff[k_spinouttimer]))
{
if (cmd->sidemove > 0)
movepushside = (cmd->sidemove * FRACUNIT/128) + FixedDiv(player->speed, K_GetKartSpeed(player, true));
@ -7935,7 +7942,7 @@ static void P_DeathThink(player_t *player)
}*/
// Keep time rolling
if (!(countdown2 && !countdown) && !player->exiting && !(player->pflags & PF_TIMEOVER))
if (!(countdown2 && !countdown) && !(player->exiting || mapreset) && !(player->pflags & PF_TIMEOVER))
{
if (leveltime >= starttime)
{
@ -8819,7 +8826,7 @@ boolean P_SpectatorJoinGame(player_t *player)
{
if (P_IsLocalPlayer(player))
CONS_Printf(M_GetText("Server does not allow team change.\n"));
player->powers[pw_flashing] += 2*TICRATE; //to prevent message spam.
//player->powers[pw_flashing] = TICRATE + 1; //to prevent message spam.
}
// Team changing in Team Match and CTF
// Pressing fire assigns you to a team that needs players if allowed.
@ -9308,7 +9315,7 @@ void P_PlayerThink(player_t *player)
if ((netgame || splitscreen) && player->spectator && cmd->buttons & BT_ATTACK && !player->powers[pw_flashing])
{
player->pflags ^= PF_WANTSTOJOIN;
player->powers[pw_flashing] += 2*TICRATE;
//player->powers[pw_flashing] = TICRATE + 1;
/*if (P_SpectatorJoinGame(player))
return; // player->mo was removed.*/
}
@ -9461,7 +9468,8 @@ void P_PlayerThink(player_t *player)
if (player->powers[pw_invulnerability] && player->powers[pw_invulnerability] < UINT16_MAX)
player->powers[pw_invulnerability]--;
if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && ((player->pflags & PF_NIGHTSMODE) || player->powers[pw_flashing] < K_GetKartFlashing()))
if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && ((player->pflags & PF_NIGHTSMODE)
|| (player->spectator || player->powers[pw_flashing] < K_GetKartFlashing())))
player->powers[pw_flashing]--;
if (player->powers[pw_tailsfly] && player->powers[pw_tailsfly] < UINT16_MAX && player->charability != CA_SWIM && !(player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))) // tails fly counter

View file

@ -455,13 +455,15 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
if (!(scrn & V_SCALEPATCHMASK))
{
// if it's meant to cover the whole screen, black out the rest
if (x == 0 && FixedMul(SHORT(patch->width)<<FRACBITS, pscale)>>FRACBITS == BASEVIDWIDTH
// BAD, BAD, BAD, FUCK OFF, STOP, EW, AAAAAAA
// This does NOT account for transparent pixels
/*if (x == 0 && FixedMul(SHORT(patch->width)<<FRACBITS, pscale)>>FRACBITS == BASEVIDWIDTH
&& y == 0 && FixedMul(SHORT(patch->height)<<FRACBITS, pscale)>>FRACBITS == BASEVIDHEIGHT)
{
column = (const column_t *)((const UINT8 *)(patch) + LONG(patch->columnofs[0]));
source = (const UINT8 *)(column) + 3;
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
}
}*/
if (vid.width != BASEVIDWIDTH * dupx)
{
@ -615,12 +617,14 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
desttop += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width / 2;
}
// if it's meant to cover the whole screen, black out the rest
if (x == 0 && SHORT(patch->width) == BASEVIDWIDTH && y == 0 && SHORT(patch->height) == BASEVIDHEIGHT)
// BAD, BAD, BAD, FUCK OFF, STOP, EW, AAAAAAA
// This does NOT account for transparent pixels
/*if (x == 0 && SHORT(patch->width) == BASEVIDWIDTH && y == 0 && SHORT(patch->height) == BASEVIDHEIGHT)
{
column = (const column_t *)((const UINT8 *)(patch) + LONG(patch->columnofs[0]));
source = (const UINT8 *)(column) + 3;
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
}
}*/
}
}