Merge branch 'sonicitems' of https://git.magicalgirl.moe/KartKrew/Kart.git into sonicitems

This commit is contained in:
toaster 2018-07-04 22:58:18 +01:00
commit 91941830fa
13 changed files with 110 additions and 75 deletions

View File

@ -4257,7 +4257,7 @@ void D_GameTypeChanged(INT32 lastgametype)
// When swapping to a gametype that supports spectators,
// make everyone a spectator initially.
/*if (!splitscreen && (G_GametypeHasSpectators()))
/*if (G_GametypeHasSpectators())
{
INT32 i;
for (i = 0; i < MAXPLAYERS; i++)

View File

@ -449,6 +449,7 @@ extern boolean mirrormode;
extern boolean comeback;
extern SINT8 battlewanted[4];
extern tic_t wantedcalcdelay;
extern tic_t indirectitemcooldown;
extern tic_t spbincoming;
extern UINT8 spbplayer;

View File

@ -528,6 +528,7 @@ static const char *credits[] = {
"\"Nev3r\"",
"\"Ritz\"",
"\"Spherallic\"",
"\"DirkTheHusky\"",
"",
"\1Produced By",
"Kart Krew",

View File

@ -258,6 +258,7 @@ SINT8 pickedvote; // What vote the host rolls
// Server-sided 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

View File

@ -138,7 +138,7 @@ const UINT8 KartColor_Opposite[MAXSKINCOLORS*2] =
SKINCOLOR_INDIGO,8, // 26 // SKINCOLOR_YELLOW
SKINCOLOR_INDIGO,8, // 27 // SKINCOLOR_CANARY
SKINCOLOR_BROWN,8, // 28 // SKINCOLOR_PEACH
SKINCOLOR_BLUEBERRY,8, // 29 // SKINCOLOR_CREAMSICLE
SKINCOLOR_BLUEBERRY,8, // 29 // SKINCOLOR_CREAMSICLE
SKINCOLOR_LAVENDER,8, // 30 // SKINCOLOR_GOLD
SKINCOLOR_BEIGE,8, // 31 // SKINCOLOR_CARAMEL
SKINCOLOR_PURPLE,8, // 32 // SKINCOLOR_VOMIT
@ -246,7 +246,7 @@ UINT8 colortranslations[MAXSKINCOLORS][16] = {
{224, 225, 226, 228, 229, 231, 232, 234, 235, 237, 238, 240, 241, 243, 244, 246}, // SKINCOLOR_SAPPHIRE, removed for other colors
{160, 160, 160, 184, 184, 184, 185, 185, 185, 186, 187, 187, 188, 188, 189, 190}, // SKINCOLOR_JADE, removed for other colors
{224, 225, 226, 212, 213, 213, 214, 215, 220, 221, 172, 222, 173, 223, 174, 175}, // SKINCOLOR_FROST, merged into Aqua
{ 72, 73, 74, 75, 76, 77, 78, 79, 48, 49, 50, 51, 52, 53, 54, 55}, // SKINCOLOR_CARAMEL, new Caramel was previously Shiny Caramel
{ 72, 73, 74, 75, 76, 77, 78, 79, 48, 49, 50, 51, 52, 53, 54, 55}, // SKINCOLOR_CARAMEL, new Caramel was previously Shiny Caramel
{ 1, 145, 125, 73, 83, 114, 106, 180, 187, 168, 219, 205, 236, 206, 199, 255}, // SKINCOLOR_RAINBOW, is Vomit 2.0
*/
};
@ -851,7 +851,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
if (pingame == 1 && oddsvalid[0]) // Record Attack, or just alone
useodds = 0;
else if (pdis <= 0) // (64*14) * 0 = 0
useodds = disttable[0];
useodds = disttable[0];
else if (pdis > distvar * ((12 * distlen) / 14)) // (64*14) * 12 = 10752
useodds = disttable[distlen-1];
else
@ -1241,6 +1241,26 @@ void K_KartMoveAnimation(player_t *player)
}
}
static void K_TauntVoiceTimers(player_t *player)
{
if (!player)
return;
player->kartstuff[k_tauntvoices] = 6*TICRATE;
player->kartstuff[k_voices] = 4*TICRATE;
}
static void K_RegularVoiceTimers(player_t *player)
{
if (!player)
return;
player->kartstuff[k_voices] = 4*TICRATE;
if (player->kartstuff[k_tauntvoices] < 4*TICRATE)
player->kartstuff[k_tauntvoices] = 4*TICRATE;
}
static void K_PlayTauntSound(mobj_t *source)
{
if (source->player && source->player->kartstuff[k_tauntvoices]) // Prevents taunt sounds from playing every time the button is pressed
@ -1248,11 +1268,7 @@ static void K_PlayTauntSound(mobj_t *source)
S_StartSound(source, sfx_taunt1+P_RandomKey(4));
if (source->player)
{
source->player->kartstuff[k_tauntvoices] = 6*TICRATE;
source->player->kartstuff[k_voices] = 3*TICRATE;
}
K_TauntVoiceTimers(source->player);
}
static void K_PlayOvertakeSound(mobj_t *source)
@ -1269,26 +1285,14 @@ static void K_PlayOvertakeSound(mobj_t *source)
S_StartSound(source, sfx_slow);
if (source->player)
{
source->player->kartstuff[k_voices] = 3*TICRATE;
if (source->player->kartstuff[k_tauntvoices] < 3*TICRATE)
source->player->kartstuff[k_tauntvoices] = 3*TICRATE;
}
K_RegularVoiceTimers(source->player);
}
static void K_PlayHitEmSound(mobj_t *source)
{
S_StartSound(source, sfx_hitem);
if (source->player)
{
source->player->kartstuff[k_voices] = 3*TICRATE;
if (source->player->kartstuff[k_tauntvoices] < 3*TICRATE)
source->player->kartstuff[k_tauntvoices] = 3*TICRATE;
}
K_RegularVoiceTimers(source->player);
}
void K_MomentumToFacing(player_t *player)
@ -1496,9 +1500,9 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem
karmahitbox->destscale = player->mo->scale;
P_SetScale(karmahitbox, player->mo->scale);
CONS_Printf(M_GetText("%s lost all of their bumpers!\n"), player_names[player-players]);
if (K_IsPlayerWanted(player))
K_CalculateBattleWanted();
}
if (K_IsPlayerWanted(player))
K_CalculateBattleWanted();
player->kartstuff[k_bumper]--;
}
@ -1563,9 +1567,9 @@ void K_SquishPlayer(player_t *player, mobj_t *source)
karmahitbox->destscale = player->mo->scale;
P_SetScale(karmahitbox, player->mo->scale);
CONS_Printf(M_GetText("%s lost all of their bumpers!\n"), player_names[player-players]);
if (K_IsPlayerWanted(player))
K_CalculateBattleWanted();
}
if (K_IsPlayerWanted(player))
K_CalculateBattleWanted();
player->kartstuff[k_bumper]--;
}
@ -1624,9 +1628,9 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju
karmahitbox->destscale = player->mo->scale;
P_SetScale(karmahitbox, player->mo->scale);
CONS_Printf(M_GetText("%s lost all of their bumpers!\n"), player_names[player-players]);
if (K_IsPlayerWanted(player))
K_CalculateBattleWanted();
}
if (K_IsPlayerWanted(player))
K_CalculateBattleWanted();
player->kartstuff[k_bumper]--;
}
@ -2139,7 +2143,7 @@ static mobj_t *K_FindLastTrailMobj(player_t *player)
if (!player || !(trail = player->mo) || !player->mo->hnext || !player->mo->hnext->health)
return NULL;
while (trail->hnext && !P_MobjWasRemoved(trail->hnext) && trail->hnext->health)
{
trail = trail->hnext;
@ -3263,8 +3267,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (!player->exiting)
{
if (player->kartstuff[k_oldposition] <= player->kartstuff[k_position]) // But first, if you lost a place,
if (player->kartstuff[k_oldposition] < player->kartstuff[k_position]) // But first, if you lost a place,
{
player->kartstuff[k_oldposition] = player->kartstuff[k_position]; // then the other player taunts.
K_RegularVoiceTimers(player); // and you can't for a bit
}
else if (player->kartstuff[k_oldposition] > player->kartstuff[k_position]) // Otherwise,
{
K_PlayOvertakeSound(player->mo); // Say "YOU'RE TOO SLOW!"
@ -3275,13 +3282,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->kartstuff[k_positiondelay])
player->kartstuff[k_positiondelay]--;
// Race Spectator
if (netgame && player->jointime < 1
&& G_RaceGametype() && countdown)
{
player->spectator = true;
player->powers[pw_nocontrol] = 5;
}
// Race force spectate
if (player->spectator && netgame && G_RaceGametype() && P_FindHighestLap() > 0)
player->powers[pw_flashing] = 5;
if ((player->pflags & PF_ATTACKDOWN) && !(cmd->buttons & BT_ATTACK))
player->pflags &= ~PF_ATTACKDOWN;
@ -3786,7 +3789,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
// Start charging once you're given the opportunity.
if (leveltime >= starttime-(2*TICRATE) && leveltime <= starttime)
{
{
if (cmd->buttons & BT_ACCELERATE)
player->kartstuff[k_boostcharge]++;
else
@ -3809,7 +3812,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->kartstuff[k_sneakertimer] >= 70)
S_StartSound(player->mo, sfx_s25f); // Special sound for the perfect start boost!
else if (player->kartstuff[k_sneakertimer] >= sneakertime)
S_StartSound(player->mo, sfx_cdfm01); // Sneaker boost sound for big boost
S_StartSound(player->mo, sfx_cdfm01); // Sneaker boost sound for big boost
else
S_StartSound(player->mo, sfx_s23c); // Drift boost sound for small boost
}
@ -3843,6 +3846,8 @@ void K_CalculateBattleWanted(void)
return;
}
wantedcalcdelay = wantedfrequency;
for (i = 0; i < MAXPLAYERS; i++)
camppos[i] = -1; // initialize
@ -4491,7 +4496,7 @@ static void K_drawKartItem(void)
{
V_DrawScaledPatch(ITEM_X+28, ITEM_Y+41, V_HUDTRANS|splitflags, kp_itemx);
V_DrawKartString(ITEM_X+38, ITEM_Y+36, V_HUDTRANS|splitflags, va("%d", stplyr->kartstuff[k_itemamount]));
}
}
}
else
V_DrawScaledPatch(ITEM_X, ITEM_Y, V_HUDTRANS|splitflags, localpatch);

View File

@ -1 +0,0 @@
Press any key to continue . . .

View File

@ -2839,9 +2839,9 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
karmahitbox->destscale = player->mo->scale;
P_SetScale(karmahitbox, player->mo->scale);
CONS_Printf(M_GetText("%s lost all of their bumpers!\n"), player_names[player-players]);
if (K_IsPlayerWanted(player))
K_CalculateBattleWanted();
}
if (K_IsPlayerWanted(player))
K_CalculateBattleWanted();
player->kartstuff[k_bumper]--;
}

View File

@ -183,6 +183,7 @@ boolean P_AnalogMove(player_t *player);
boolean P_TransferToNextMare(player_t *player);
UINT8 P_FindLowestMare(void);
UINT8 P_FindLowestLap(void);
UINT8 P_FindHighestLap(void);
void P_FindEmerald(void);
void P_TransferToAxis(player_t *player, INT32 axisnum);
boolean P_PlayerMoving(INT32 pnum);

View File

@ -6940,7 +6940,7 @@ void P_MobjThinker(mobj_t *mobj)
{
P_SetMobjState(mobj, S_PLAYERARROW_BOX);
mobj->tracer->sprite = SPR_ITEM;
mobj->tracer->frame = FF_FULLBRIGHT|((mobj->target->player->kartstuff[k_itemroulette] % (13*3)) / 3);
mobj->tracer->frame = FF_FULLBRIGHT|(((mobj->target->player->kartstuff[k_itemroulette] % (13*3)) / 3) + 1);
}
else if (mobj->target->player->kartstuff[k_itemtype])
{
@ -6962,9 +6962,11 @@ void P_MobjThinker(mobj_t *mobj)
break;
}
if (mobj->target->player->kartstuff[k_growshrinktimer])
if (mobj->target->player->kartstuff[k_growshrinktimer] > 0)
{
mobj->tracer->sprite = SPR_ITEM;
mobj->tracer->frame = FF_FULLBRIGHT|KITEM_GROW;
if (leveltime & 1)
mobj->tracer->flags2 |= MF2_DONTDRAW;
else
@ -8178,7 +8180,7 @@ void P_MobjThinker(mobj_t *mobj)
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
break;
case MT_KARMAHITBOX:
if (!mobj->target || !mobj->target->health || !mobj->target->player
if (!mobj->target || !mobj->target->health || !mobj->target->player || mobj->target->player->spectator
|| (G_RaceGametype() || mobj->target->player->kartstuff[k_bumper]))
{
P_RemoveMobj(mobj);
@ -9797,24 +9799,27 @@ void P_RespawnSpecials(void)
//
void P_SpawnPlayer(INT32 playernum)
{
UINT8 i, pcount = 0;
player_t *p = &players[playernum];
mobj_t *mobj;
if (p->playerstate == PST_REBORN)
G_PlayerReborn(playernum);
for (i = 0; i < MAXPLAYERS; i++)
{
if (i == playernum)
continue;
if (!playeringame[i] || players[i].spectator)
continue;
pcount++;
}
// spawn as spectator determination
if (!G_GametypeHasSpectators())
{
// Special case for (NiGHTS) special stages!
// if stage has already started, force players to become spectators until the next stage
/*if (multiplayer && netgame && G_IsSpecialStage(gamemap) && useNightsSS && leveltime > 0)
p->spectator = true;
else*/
p->spectator = false;
}
else if (netgame && p->jointime < 1)
/*p->spectator = true*/;
p->spectator = false;
else if (netgame && p->jointime <= 1 && pcount > 1)
p->spectator = true;
else if (multiplayer && !netgame)
{
// If you're in a team game and you don't have a team assigned yet...
@ -9893,19 +9898,10 @@ void P_SpawnPlayer(INT32 playernum)
overheadarrow->flags2 |= MF2_DONTDRAW;
P_SetScale(overheadarrow, mobj->destscale);
/*INT32 i;
INT32 pcount = 0;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || players[i].spectator || &players[i] == p)
continue;
if (players[i].jointime > 1)
continue;
pcount++;
}*/
if (p->kartstuff[k_bumper] > 0 || leveltime < 1/* || pcount <= 1*/)
if (p->spectator) // 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;
@ -9913,8 +9909,8 @@ void P_SpawnPlayer(INT32 playernum)
fixed_t newx;
fixed_t newy;
mobj_t *mo;
if (leveltime < 1 && !p->spectator /*|| pcount <= 1*/) // Start of the map?
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)

View File

@ -3260,6 +3260,7 @@ static void P_NetArchiveMisc(void)
for (i = 0; i < 4; i++)
WRITESINT8(save_p, battlewanted[i]);
WRITEUINT32(save_p, wantedcalcdelay);
WRITEUINT32(save_p, indirectitemcooldown);
WRITEUINT32(save_p, spbincoming);
WRITEUINT8(save_p, spbplayer);
@ -3363,6 +3364,7 @@ static inline boolean P_NetUnArchiveMisc(void)
for (i = 0; i < 4; i++)
battlewanted[i] = READSINT8(save_p);
wantedcalcdelay = READUINT32(save_p);
indirectitemcooldown = READUINT32(save_p);
spbincoming = READUINT32(save_p);
spbplayer = READUINT8(save_p);

View File

@ -3009,6 +3009,7 @@ boolean P_SetupLevel(boolean skipprecip)
for (i = 0; i < 4; i++)
battlewanted[i] = -1;
wantedcalcdelay = wantedfrequency*2;
indirectitemcooldown = 0;
spbincoming = 0;
spbplayer = 0;

View File

@ -677,9 +677,6 @@ void P_Ticker(boolean run)
if (countdown2)
countdown2--;
if (G_BattleGametype() && leveltime % wantedfrequency == 0 && leveltime > wantedfrequency)
K_CalculateBattleWanted();
if (spbincoming && --spbincoming <= 0)
{
UINT8 best = 0;
@ -715,6 +712,12 @@ void P_Ticker(boolean run)
if (indirectitemcooldown)
indirectitemcooldown--;
if (G_BattleGametype())
{
if (wantedcalcdelay && --wantedcalcdelay <= 0)
K_CalculateBattleWanted();
}
if (quake.time)
{
fixed_t ir = quake.intensity>>1;

View File

@ -406,6 +406,31 @@ UINT8 P_FindLowestLap(void)
return lowest;
}
//
// P_FindHighestLap
//
UINT8 P_FindHighestLap(void)
{
INT32 i;
UINT8 highest = 0;
if (!G_RaceGametype())
return 0;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || players[i].spectator)
continue;
if (players[i].laps > highest)
highest = players[i].laps;
}
CONS_Debug(DBG_GAMELOGIC, "Highest laps found: %d\n", highest);
return highest;
}
//
// P_TransferToNextMare
//