HERE COMES A NEW CHALLENGER

This commit is contained in:
TehRealSalt 2018-07-22 00:31:02 -04:00
parent 87cc2c28ce
commit 77165631c4
7 changed files with 83 additions and 66 deletions

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 // if it's meant to cover the whole screen, black out the rest
// cx and cy are possibly *slightly* off from float maths // 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 // 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 // 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); 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; const UINT8 *source = (const UINT8 *)(column) + 3;
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0])); HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
Z_Free(realpatch); Z_Free(realpatch);
} }*/
// centre screen // centre screen
if (vid.width != BASEVIDWIDTH * vid.dupx) 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 // if it's meant to cover the whole screen, black out the rest
// cx and cy are possibly *slightly* off from float maths // 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 // 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 // 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); 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; const UINT8 *source = (const UINT8 *)(column) + 3;
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0])); HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
Z_Free(realpatch); Z_Free(realpatch);
} }*/
// centre screen // centre screen
if (vid.width != BASEVIDWIDTH * vid.dupx) if (vid.width != BASEVIDWIDTH * vid.dupx)
{ {

View File

@ -1145,7 +1145,8 @@ void K_RespawnChecker(player_t *player)
if (leveltime % 8 == 0) if (leveltime % 8 == 0)
{ {
INT32 i; INT32 i;
S_StartSound(player->mo, sfx_s3kcas); if (!mapreset)
S_StartSound(player->mo, sfx_s3kcas);
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
@ -3364,7 +3365,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
else if (cmd->buttons & BT_ATTACK) else if (cmd->buttons & BT_ATTACK)
player->pflags |= PF_ATTACKDOWN; 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. // First, the really specific, finicky items that function without the item being directly in your item slot.
// Eggman Monitor throwing // Eggman Monitor throwing
@ -4072,11 +4073,13 @@ void K_CheckSpectateStatus(void)
if (!players[i].spectator) if (!players[i].spectator)
{ {
numingame++; numingame++;
if (gamestate != GS_LEVEL) if (gamestate != GS_LEVEL) // Allow if you're not in a level
continue; continue;
if (numingame < 2) if (players[i].exiting) // DON'T allow if anyone's exiting
continue; return;
if (G_RaceGametype() && players[i].laps) 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; return;
continue; continue;
} }
@ -4090,31 +4093,11 @@ void K_CheckSpectateStatus(void)
if (!numjoiners) if (!numjoiners)
return; return;
// Check if there are any conditions that should prevent de-spectating.
// WHAT? NO, you just made it loop again, what's the point?!!
/*if ((gamestate == GS_LEVEL) && (numingame > 1))
{
// If anyone's on lap two or up in a race gametype, HALT.
if (G_RaceGametype())
{
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || players[i].spectator)
continue;
if (!players[i].laps)
continue;
return;
}
}
}*/
// Reset the match if you're in an empty server // Reset the match if you're in an empty server
if (gamestate == GS_LEVEL && (numingame < 2 && numingame+numjoiners >= 2)) if (!mapreset && gamestate == GS_LEVEL && leveltime >= starttime && (numingame < 2 && numingame+numjoiners >= 2))
{ {
CONS_Printf("Here comes a new challenger! Resetting map in 10 seconds...\n"); S_ChangeMusicInternal("chalng", false); // COME ON
mapreset = 10*TICRATE; // Even though only the server uses this for game logic, set for everyone for HUD in the future 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! // Finally, we can de-spectate everyone!
@ -4195,6 +4178,8 @@ static patch_t *kp_spbwarning[2];
static patch_t *kp_fpview[3]; static patch_t *kp_fpview[3];
static patch_t *kp_inputwheel[5]; static patch_t *kp_inputwheel[5];
static patch_t *kp_challenger[25];
void K_LoadKartHUDGraphics(void) void K_LoadKartHUDGraphics(void)
{ {
INT32 i, j; INT32 i, j;
@ -4348,6 +4333,15 @@ void K_LoadKartHUDGraphics(void)
buffer[7] = '0'+i; buffer[7] = '0'+i;
kp_inputwheel[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); 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);
}
} }
//} //}
@ -5779,6 +5773,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) static void K_drawCheckpointDebugger(void)
{ {
if ((numstarposts/2 + stplyr->starpostnum) >= numstarposts) if ((numstarposts/2 + stplyr->starpostnum) >= numstarposts)
@ -5814,6 +5824,12 @@ void K_drawKartHUD(void)
K_drawKartMinimap(); K_drawKartMinimap();
// Draw full screen stuff that turns off the rest of the HUD // Draw full screen stuff that turns off the rest of the HUD
if (mapreset)
{
K_drawChallengerScreen();
return;
}
if ((G_BattleGametype()) if ((G_BattleGametype())
&& (stplyr->exiting && (stplyr->exiting
|| (stplyr->kartstuff[k_bumper] <= 0 || (stplyr->kartstuff[k_bumper] <= 0

View File

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

View File

@ -9833,8 +9833,10 @@ void P_SpawnPlayer(INT32 playernum)
else if (netgame && p->jointime <= 1 && pcount) else if (netgame && p->jointime <= 1 && pcount)
{ {
p->spectator = true; p->spectator = true;
if (pcount == 1) // Oni doesn't want this
/*if (pcount == 1 || leveltime < starttime)
p->pflags |= PF_WANTSTOJOIN; p->pflags |= PF_WANTSTOJOIN;
p->jointime = 2;*/
} }
else if (multiplayer && !netgame) else if (multiplayer && !netgame)
{ {

View File

@ -677,25 +677,6 @@ void P_Ticker(boolean run)
if (countdown2) if (countdown2)
countdown2--; countdown2--;
if (mapreset && --mapreset <= 0)
{
mapreset = 0;
if (server)
{
UINT8 numingame = 0;
for (i = 0; i < MAXPLAYERS; i++) // Make sure there's still actually enough...
{
if (!playeringame[i] || players[i].spectator)
continue;
if (++numingame >= 2)
{
D_MapChange(gamemap, gametype, ultimatemode, true, 0, false, false);
break;
}
}
}
}
if (spbincoming && --spbincoming <= 0) if (spbincoming && --spbincoming <= 0)
{ {
UINT8 best = 0; UINT8 best = 0;
@ -759,6 +740,13 @@ void P_Ticker(boolean run)
G_ConsGhostTic(); G_ConsGhostTic();
if (modeattacking) if (modeattacking)
G_GhostTicker(); G_GhostTicker();
if (mapreset && --mapreset <= 0)
{
mapreset = 0;
if (server)
D_MapChange(gamemap, gametype, ultimatemode, true, 0, false, false);
}
} }
P_MapEnd(); P_MapEnd();

View File

@ -1177,12 +1177,19 @@ void P_RestoreMusic(player_t *player)
if (!P_IsLocalPlayer(player)) // Only applies to a local player if (!P_IsLocalPlayer(player)) // Only applies to a local player
return; return;
// Event - HERE COMES A NEW CHALLENGER
if (mapreset)
{
S_ChangeMusicInternal("chalng", false); //S_StopMusic();
return;
}
// Event - Level Ending
if (P_EndingMusic(player)) if (P_EndingMusic(player))
return; return;
S_SpeedMusic(1.0f); S_SpeedMusic(1.0f);
// SRB2kart - We have some different powers than vanilla, some of which tweak the music.
// Event - Level Start // Event - Level Start
if (leveltime < (starttime + (TICRATE/2))) if (leveltime < (starttime + (TICRATE/2)))
S_ChangeMusicInternal("kstart", false); //S_StopMusic(); S_ChangeMusicInternal("kstart", false); //S_StopMusic();
@ -1679,7 +1686,7 @@ void P_SpawnSpinMobj(player_t *player, mobjtype_t type)
// Player exits the map via sector trigger // Player exits the map via sector trigger
void P_DoPlayerExit(player_t *player) void P_DoPlayerExit(player_t *player)
{ {
if (player->exiting) if (player->exiting || mapreset)
return; return;
if ((player == &players[consoleplayer] if ((player == &players[consoleplayer]
@ -4698,7 +4705,7 @@ static void P_3dMovement(player_t *player)
cmd = &player->cmd; 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; cmd->forwardmove = cmd->sidemove = 0;
if (player->kartstuff[k_sneakertimer]) if (player->kartstuff[k_sneakertimer])
@ -4707,14 +4714,14 @@ static void P_3dMovement(player_t *player)
{ {
if (!player->skidtime) if (!player->skidtime)
player->pflags &= ~PF_GLIDING; player->pflags &= ~PF_GLIDING;
else if (player->exiting) else if (player->exiting || mapreset)
{ {
player->pflags &= ~PF_GLIDING; player->pflags &= ~PF_GLIDING;
P_SetPlayerMobjState(player->mo, S_KART_WALK1); // SRB2kart - was S_PLAY_RUN1 P_SetPlayerMobjState(player->mo, S_KART_WALK1); // SRB2kart - was S_PLAY_RUN1
player->skidtime = 0; player->skidtime = 0;
} }
} }
if (player->pflags & PF_SPINNING && !player->exiting) if (player->pflags & PF_SPINNING && !(player->exiting || mapreset))
{ {
player->pflags &= ~PF_SPINNING; player->pflags &= ~PF_SPINNING;
P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND
@ -4799,7 +4806,7 @@ static void P_3dMovement(player_t *player)
player->aiming = cmd->aiming<<FRACBITS; player->aiming = cmd->aiming<<FRACBITS;
// Forward movement // Forward movement
if (!(player->exiting || (P_PlayerInPain(player) && !onground))) if (!((player->exiting || mapreset) || (P_PlayerInPain(player) && !onground)))
{ {
//movepushforward = cmd->forwardmove * (thrustfactor * acceleration); //movepushforward = cmd->forwardmove * (thrustfactor * acceleration);
movepushforward = K_3dKartMovement(player, onground, cmd->forwardmove); movepushforward = K_3dKartMovement(player, onground, cmd->forwardmove);
@ -4839,7 +4846,7 @@ static void P_3dMovement(player_t *player)
} }
// Sideways movement // 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) if (cmd->sidemove > 0)
movepushside = (cmd->sidemove * FRACUNIT/128) + FixedDiv(player->speed, K_GetKartSpeed(player, true)); movepushside = (cmd->sidemove * FRACUNIT/128) + FixedDiv(player->speed, K_GetKartSpeed(player, true));
@ -7928,7 +7935,7 @@ static void P_DeathThink(player_t *player)
}*/ }*/
// Keep time rolling // 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) if (leveltime >= starttime)
{ {

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 (!(scrn & V_SCALEPATCHMASK))
{ {
// if it's meant to cover the whole screen, black out the rest // 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) && y == 0 && FixedMul(SHORT(patch->height)<<FRACBITS, pscale)>>FRACBITS == BASEVIDHEIGHT)
{ {
column = (const column_t *)((const UINT8 *)(patch) + LONG(patch->columnofs[0])); column = (const column_t *)((const UINT8 *)(patch) + LONG(patch->columnofs[0]));
source = (const UINT8 *)(column) + 3; source = (const UINT8 *)(column) + 3;
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0])); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
} }*/
if (vid.width != BASEVIDWIDTH * dupx) 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; desttop += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width / 2;
} }
// if it's meant to cover the whole screen, black out the rest // 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])); column = (const column_t *)((const UINT8 *)(patch) + LONG(patch->columnofs[0]));
source = (const UINT8 *)(column) + 3; source = (const UINT8 *)(column) + 3;
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0])); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
} }*/
} }
} }