This commit is contained in:
TehRealSalt 2018-07-01 04:36:09 -04:00
parent 2f8801902f
commit 5c7b66cc0f
18 changed files with 345 additions and 38 deletions

View File

@ -2430,6 +2430,9 @@ static void CL_RemovePlayer(INT32 playernum)
} }
} }
if (K_IsPlayerWanted(&players[playernum]))
K_CalculateBattleWanted();
if (gametype == GT_CTF) if (gametype == GT_CTF)
P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you! P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you!

View File

@ -3238,7 +3238,12 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
// Clear player score and rings if a spectator. // Clear player score and rings if a spectator.
if (players[playernum].spectator) if (players[playernum].spectator)
{ {
//players[playernum].score = 0; // SRB2kart if (G_BattleGametype()) // SRB2kart
{
players[playernum].score = 0;
if (K_IsPlayerWanted(&players[playernum]))
K_CalculateBattleWanted();
}
players[playernum].health = 1; players[playernum].health = 1;
if (players[playernum].mo) if (players[playernum].mo)
players[playernum].mo->health = 1; players[playernum].mo->health = 1;

View File

@ -324,6 +324,7 @@ typedef enum
k_balloon, // Number of balloons left k_balloon, // Number of balloons left
k_comebackpoints, // Number of times you've bombed or gave an item to someone; once it's 3 it gets set back to 0 and you're given a balloon k_comebackpoints, // Number of times you've bombed or gave an item to someone; once it's 3 it gets set back to 0 and you're given a balloon
k_comebackmode, // 0 = bomb, 1 = item k_comebackmode, // 0 = bomb, 1 = item
k_wanted, // Timer for determining WANTED status, lowers when hitting people, prevents the game turning into Camp Lazlo
NUMKARTSTUFF NUMKARTSTUFF
} kartstufftype_t; } kartstufftype_t;

View File

@ -415,6 +415,8 @@ extern INT32 sneakertime;
extern INT32 itemtime; extern INT32 itemtime;
extern INT32 comebacktime; extern INT32 comebacktime;
extern INT32 bumptime; extern INT32 bumptime;
extern INT32 wantedreduce;
extern INT32 wantedfrequency;
extern UINT8 introtoplay; extern UINT8 introtoplay;
extern UINT8 creditscutscene; extern UINT8 creditscutscene;
@ -445,6 +447,7 @@ extern boolean franticitems;
extern boolean mirrormode; extern boolean mirrormode;
extern boolean comeback; extern boolean comeback;
extern SINT8 battlewanted[4];
extern tic_t indirectitemcooldown; extern tic_t indirectitemcooldown;
extern tic_t spbincoming; extern tic_t spbincoming;
extern UINT8 spbplayer; extern UINT8 spbplayer;

View File

@ -215,6 +215,8 @@ INT32 sneakertime = TICRATE + (TICRATE/3);
INT32 itemtime = 8*TICRATE; INT32 itemtime = 8*TICRATE;
INT32 comebacktime = 10*TICRATE; INT32 comebacktime = 10*TICRATE;
INT32 bumptime = 6; INT32 bumptime = 6;
INT32 wantedreduce = 5*TICRATE;
INT32 wantedfrequency = 10*TICRATE;
INT32 gameovertics = 15*TICRATE; INT32 gameovertics = 15*TICRATE;
@ -255,6 +257,7 @@ SINT8 votes[MAXPLAYERS]; // Each player's vote
SINT8 pickedvote; // What vote the host rolls SINT8 pickedvote; // What vote the host rolls
// Server-sided variables // Server-sided variables
SINT8 battlewanted[4]; // WANTED players in battle, worth x2 points
tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any other item that works indirectly is awarded 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 tic_t spbincoming; // Timer before SPB hits, can switch targets at this point
UINT8 spbplayer; // Player num that used the last SPB UINT8 spbplayer; // Player num that used the last SPB
@ -2298,6 +2301,7 @@ void G_PlayerReborn(INT32 player)
INT32 starpostwp; INT32 starpostwp;
INT32 balloon; INT32 balloon;
INT32 comebackpoints; INT32 comebackpoints;
INT32 wanted;
score = players[player].score; score = players[player].score;
lives = players[player].lives; lives = players[player].lives;
@ -2354,6 +2358,7 @@ void G_PlayerReborn(INT32 player)
starpostwp = players[player].kartstuff[k_starpostwp]; starpostwp = players[player].kartstuff[k_starpostwp];
balloon = players[player].kartstuff[k_balloon]; balloon = players[player].kartstuff[k_balloon];
comebackpoints = players[player].kartstuff[k_comebackpoints]; comebackpoints = players[player].kartstuff[k_comebackpoints];
wanted = players[player].kartstuff[k_wanted];
p = &players[player]; p = &players[player];
memset(p, 0, sizeof (*p)); memset(p, 0, sizeof (*p));
@ -2412,6 +2417,7 @@ void G_PlayerReborn(INT32 player)
p->kartstuff[k_balloon] = balloon; p->kartstuff[k_balloon] = balloon;
p->kartstuff[k_comebackpoints] = comebackpoints; p->kartstuff[k_comebackpoints] = comebackpoints;
p->kartstuff[k_comebacktimer] = comebacktime; p->kartstuff[k_comebacktimer] = comebacktime;
p->kartstuff[k_wanted] = wanted;
// Don't do anything immediately // Don't do anything immediately
p->pflags |= PF_USEDOWN; p->pflags |= PF_USEDOWN;

View File

@ -25,6 +25,7 @@
// franticitems is Frantic Mode items, bool // franticitems is Frantic Mode items, bool
// mirrormode is Mirror Mode (duh), bool // mirrormode is Mirror Mode (duh), bool
// comeback is Battle Mode's karma comeback, also bool // comeback is Battle Mode's karma comeback, also bool
// battlewanted is an array of the WANTED player nums, -1 for no player in that slot
// indirectitemcooldown is timer before anyone's allowed another Shrink/SPB // indirectitemcooldown is timer before anyone's allowed another Shrink/SPB
// spbincoming is the timer before k_deathsentence is cast on the player in 1st // spbincoming is the timer before k_deathsentence is cast on the player in 1st
// spbplayer is the last player who fired a SPB // spbplayer is the last player who fired a SPB
@ -428,6 +429,21 @@ boolean K_IsPlayerLosing(player_t *player)
return (player->kartstuff[k_position] > winningpos); return (player->kartstuff[k_position] > winningpos);
} }
boolean K_IsPlayerWanted(player_t *player)
{
UINT8 i;
if (!(G_BattleGametype()))
return false;
for (i = 0; i < 4; i++)
{
if (battlewanted[i] == -1)
break;
if (player == &players[battlewanted[i]])
return true;
}
return false;
}
//{ SRB2kart Roulette Code - Position Based //{ SRB2kart Roulette Code - Position Based
#define NUMKARTODDS 40 #define NUMKARTODDS 40
@ -1438,8 +1454,10 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove
return finalspeed; return finalspeed;
} }
void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type) void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem)
{ {
const UINT8 scoremultiply = ((K_IsPlayerWanted(player) && !trapitem) ? 2 : 1);
if (player->health <= 0) if (player->health <= 0)
return; return;
@ -1457,7 +1475,14 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type)
if (G_BattleGametype()) if (G_BattleGametype())
{ {
if (source && source->player && player != source->player) if (source && source->player && player != source->player)
P_AddPlayerScore(source->player, 1); {
P_AddPlayerScore(source->player, scoremultiply);
if (!trapitem)
{
source->player->kartstuff[k_wanted] -= wantedreduce;
player->kartstuff[k_wanted] -= (wantedreduce/2);
}
}
if (player->kartstuff[k_balloon] > 0) if (player->kartstuff[k_balloon] > 0)
{ {
@ -1468,6 +1493,8 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type)
karmahitbox->destscale = player->mo->scale; karmahitbox->destscale = player->mo->scale;
P_SetScale(karmahitbox, player->mo->scale); P_SetScale(karmahitbox, player->mo->scale);
CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]); CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]);
if (K_IsPlayerWanted(player))
K_CalculateBattleWanted();
} }
player->kartstuff[k_balloon]--; player->kartstuff[k_balloon]--;
} }
@ -1502,6 +1529,8 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type)
void K_SquishPlayer(player_t *player, mobj_t *source) void K_SquishPlayer(player_t *player, mobj_t *source)
{ {
const UINT8 scoremultiply = (K_IsPlayerWanted(player) ? 2 : 1);
if (player->health <= 0) if (player->health <= 0)
return; return;
@ -1516,7 +1545,11 @@ void K_SquishPlayer(player_t *player, mobj_t *source)
if (G_BattleGametype()) if (G_BattleGametype())
{ {
if (source && source->player && player != source->player) if (source && source->player && player != source->player)
P_AddPlayerScore(source->player, 1); {
P_AddPlayerScore(source->player, scoremultiply);
source->player->kartstuff[k_wanted] -= wantedreduce;
player->kartstuff[k_wanted] -= (wantedreduce/2);
}
if (player->kartstuff[k_balloon] > 0) if (player->kartstuff[k_balloon] > 0)
{ {
@ -1527,6 +1560,8 @@ void K_SquishPlayer(player_t *player, mobj_t *source)
karmahitbox->destscale = player->mo->scale; karmahitbox->destscale = player->mo->scale;
P_SetScale(karmahitbox, player->mo->scale); P_SetScale(karmahitbox, player->mo->scale);
CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]); CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]);
if (K_IsPlayerWanted(player))
K_CalculateBattleWanted();
} }
player->kartstuff[k_balloon]--; player->kartstuff[k_balloon]--;
} }
@ -1552,6 +1587,8 @@ void K_SquishPlayer(player_t *player, mobj_t *source)
void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we just throw the player up higher here and extend their spinout timer void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we just throw the player up higher here and extend their spinout timer
{ {
const UINT8 scoremultiply = (K_IsPlayerWanted(player) ? 2 : 1);
if (player->health <= 0) if (player->health <= 0)
return; return;
@ -1569,7 +1606,11 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju
if (G_BattleGametype()) if (G_BattleGametype())
{ {
if (source && source->player && player != source->player) if (source && source->player && player != source->player)
P_AddPlayerScore(source->player, 1); {
P_AddPlayerScore(source->player, scoremultiply);
source->player->kartstuff[k_wanted] -= wantedreduce;
player->kartstuff[k_wanted] -= (wantedreduce/2);
}
if (player->kartstuff[k_balloon] > 0) if (player->kartstuff[k_balloon] > 0)
{ {
@ -1580,6 +1621,8 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju
karmahitbox->destscale = player->mo->scale; karmahitbox->destscale = player->mo->scale;
P_SetScale(karmahitbox, player->mo->scale); P_SetScale(karmahitbox, player->mo->scale);
CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]); CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]);
if (K_IsPlayerWanted(player))
K_CalculateBattleWanted();
} }
player->kartstuff[k_balloon]--; player->kartstuff[k_balloon]--;
} }
@ -2091,10 +2134,10 @@ static mobj_t *K_FindLastTrailMobj(player_t *player)
{ {
mobj_t *trail; mobj_t *trail;
if (!player || !(trail = player->mo) || !player->mo->hnext) if (!player || !(trail = player->mo) || !player->mo->hnext || !player->mo->hnext->health)
return NULL; return NULL;
while (trail->hnext && !P_MobjWasRemoved(trail->hnext)) while (trail->hnext && !P_MobjWasRemoved(trail->hnext) && trail->hnext->health)
{ {
trail = trail->hnext; trail = trail->hnext;
} }
@ -2482,13 +2525,13 @@ void K_RepairOrbitChain(mobj_t *orbit)
mobj_t *cachenext = orbit->hnext; mobj_t *cachenext = orbit->hnext;
// First, repair the chain // First, repair the chain
if (orbit->hnext && !P_MobjWasRemoved(orbit->hnext)) if (orbit->hnext && orbit->hnext->health && !P_MobjWasRemoved(orbit->hnext))
{ {
P_SetTarget(&orbit->hnext->hprev, orbit->hprev); P_SetTarget(&orbit->hnext->hprev, orbit->hprev);
P_SetTarget(&orbit->hnext, NULL); P_SetTarget(&orbit->hnext, NULL);
} }
if (orbit->hprev && !P_MobjWasRemoved(orbit->hprev)) if (orbit->hprev && orbit->hprev->health && !P_MobjWasRemoved(orbit->hprev))
{ {
P_SetTarget(&orbit->hprev->hnext, cachenext); P_SetTarget(&orbit->hprev->hnext, cachenext);
P_SetTarget(&orbit->hprev, NULL); P_SetTarget(&orbit->hprev, NULL);
@ -2537,6 +2580,12 @@ static void K_MoveHeldObjects(player_t *player)
const fixed_t radius = FixedHypot(player->mo->radius, player->mo->radius) + FixedHypot(cur->radius, cur->radius); // mobj's distance from its Target, or Radius. const fixed_t radius = FixedHypot(player->mo->radius, player->mo->radius) + FixedHypot(cur->radius, cur->radius); // mobj's distance from its Target, or Radius.
fixed_t z; fixed_t z;
if (!cur->health)
{
cur = cur->hnext;
continue;
}
cur->angle -= ANGLE_90; cur->angle -= ANGLE_90;
cur->angle += FixedAngle(cur->info->speed); cur->angle += FixedAngle(cur->info->speed);
@ -2591,18 +2640,24 @@ static void K_MoveHeldObjects(player_t *player)
while (cur && !P_MobjWasRemoved(cur)) while (cur && !P_MobjWasRemoved(cur))
{ {
const fixed_t spacing = FixedMul(3*cur->info->radius/2, player->mo->scale); const fixed_t radius = FixedHypot(targ->radius, targ->radius) + FixedHypot(cur->radius, cur->radius);
angle_t ang; angle_t ang;
fixed_t targx; fixed_t targx;
fixed_t targy; fixed_t targy;
fixed_t targz; fixed_t targz;
fixed_t speed; fixed_t speed;
fixed_t dist = spacing; fixed_t dist = radius/2;
if (!cur->health)
{
cur = cur->hnext;
continue;
}
if (cur != player->mo->hnext) if (cur != player->mo->hnext)
{ {
targ = cur->hprev; targ = cur->hprev;
dist = spacing/2; dist = radius/4;
} }
if (!targ || P_MobjWasRemoved(targ)) if (!targ || P_MobjWasRemoved(targ))
@ -2767,6 +2822,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->kartstuff[k_tauntvoices]) if (player->kartstuff[k_tauntvoices])
player->kartstuff[k_tauntvoices]--; player->kartstuff[k_tauntvoices]--;
if (G_BattleGametype() && player->kartstuff[k_balloon] > 0)
player->kartstuff[k_wanted]++;
// ??? // ???
/* /*
if (player->kartstuff[k_jmp] > 1 && onground) if (player->kartstuff[k_jmp] > 1 && onground)
@ -3591,6 +3649,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->kartstuff[k_itemtype] == KITEM_SPB if (player->kartstuff[k_itemtype] == KITEM_SPB
|| player->kartstuff[k_itemtype] == KITEM_SHRINK || player->kartstuff[k_itemtype] == KITEM_SHRINK
|| player->kartstuff[k_growshrinktimer] < 0
|| spbincoming) || spbincoming)
indirectitemcooldown = 20*TICRATE; indirectitemcooldown = 20*TICRATE;
@ -3759,6 +3818,119 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
} }
} }
void K_CalculateBattleWanted(void)
{
UINT8 numingame = 0, numwanted = 0;
SINT8 bestballoonplayer = -1, bestballoon = -1;
SINT8 camppos[MAXPLAYERS]; // who is the biggest camper
UINT8 ties = 0, nextcamppos = 0;
UINT8 i, j;
if (!G_BattleGametype())
{
for (i = 0; i < 4; i++)
battlewanted[i] = -1;
return;
}
for (i = 0; i < MAXPLAYERS; i++)
camppos[i] = -1; // initialize
for (i = 0; i < MAXPLAYERS; i++)
{
UINT8 position = 1;
if (!playeringame[i] || players[i].spectator) // Not playing
continue;
if (players[i].exiting) // We're done, don't calculate.
return;
numingame++;
if (players[i].kartstuff[k_balloon] <= 0) // Not alive, so don't do anything else
continue;
if (bestballoon == -1 || players[i].kartstuff[k_balloon] > bestballoon)
{
bestballoon = players[i].kartstuff[k_balloon];
bestballoonplayer = i;
}
else if (players[i].kartstuff[k_balloon] == bestballoon)
bestballoonplayer = -1; // Tie, no one has best balloon.
for (j = 0; j < MAXPLAYERS; j++)
{
if (!playeringame[j] || players[j].spectator)
continue;
if (players[j].kartstuff[k_balloon] <= 0)
continue;
if (j == i)
continue;
if (players[j].kartstuff[k_wanted] == players[i].kartstuff[k_wanted] && players[j].score > players[i].score)
position++;
else if (players[j].kartstuff[k_wanted] > players[i].kartstuff[k_wanted])
position++;
}
position--; // Make zero based
while (camppos[position] != -1) // Port priority!
position++;
camppos[position] = i;
}
if (numingame <= 2)
numwanted = 0;
else
numwanted = min(4, 1 + ((numingame-2) / 4));
for (i = 0; i < 4; i++)
{
if (i+1 > numwanted) // Not enough players for this slot to be wanted!
battlewanted[i] = -1;
else if (bestballoonplayer != -1) // If there's a player who has a single-handed lead over everyone else, they are the first to be wanted.
{
battlewanted[i] = bestballoonplayer;
bestballoonplayer = -1; // Don't set twice
}
else
{
// Do not add more than 2 wanted times that are tied with others.
// This could theoretically happen very easily if people don't hit each other for a while after the start of a match.
// (I will be sincerely impressed if more than 2 people tie
if (camppos[nextcamppos] == -1 // Out of entries
|| ties >= 2) // Already counted ties
{
battlewanted[i] = -1;
continue;
}
if (ties < 2)
{
ties = 0; // Reset
for (j = 0; j < 2; j++)
{
if (camppos[nextcamppos+(j+1)] == -1) // Nothing beyond, cancel
break;
if (players[camppos[nextcamppos]].kartstuff[k_wanted] == players[camppos[nextcamppos+(j+1)]].kartstuff[k_wanted])
ties++;
}
}
if (ties < 2) // Is it still less than 2 after counting?
{
battlewanted[i] = camppos[nextcamppos];
nextcamppos++;
}
else
battlewanted[i] = -1;
}
}
}
void K_CheckBalloons(void) void K_CheckBalloons(void)
{ {
UINT8 i; UINT8 i;
@ -3847,6 +4019,7 @@ static patch_t *kp_battlewin;
static patch_t *kp_battlelose; static patch_t *kp_battlelose;
static patch_t *kp_battlewait; static patch_t *kp_battlewait;
static patch_t *kp_battleinfo; static patch_t *kp_battleinfo;
static patch_t *kp_wanted;
static patch_t *kp_itembg[4]; static patch_t *kp_itembg[4];
static patch_t *kp_itemmulsticker[2]; static patch_t *kp_itemmulsticker[2];
@ -3937,6 +4110,7 @@ void K_LoadKartHUDGraphics(void)
kp_battlelose = W_CachePatchName("K_BLOSE", PU_HUDGFX); kp_battlelose = W_CachePatchName("K_BLOSE", PU_HUDGFX);
kp_battlewait = W_CachePatchName("K_BWAIT", PU_HUDGFX); kp_battlewait = W_CachePatchName("K_BWAIT", PU_HUDGFX);
kp_battleinfo = W_CachePatchName("K_BINFO", PU_HUDGFX); kp_battleinfo = W_CachePatchName("K_BINFO", PU_HUDGFX);
kp_wanted = W_CachePatchName("K_WANTED", PU_HUDGFX);
// Kart Item Windows // Kart Item Windows
kp_itembg[0] = W_CachePatchName("K_ITBG", PU_HUDGFX); kp_itembg[0] = W_CachePatchName("K_ITBG", PU_HUDGFX);
@ -4022,6 +4196,7 @@ INT32 STCD_X, STCD_Y; // Starting countdown
INT32 CHEK_Y; // CHECK graphic INT32 CHEK_Y; // CHECK graphic
INT32 MINI_X, MINI_Y; // Minimap INT32 MINI_X, MINI_Y; // Minimap
INT32 SPBW_X, SPBW_Y; // SPB warning INT32 SPBW_X, SPBW_Y; // SPB warning
INT32 WANT_X, WANT_Y; // Battle WANTED poster
static void K_initKartHUD(void) static void K_initKartHUD(void)
{ {
@ -4087,8 +4262,11 @@ static void K_initKartHUD(void)
MINI_X = BASEVIDWIDTH - 50; // 270 MINI_X = BASEVIDWIDTH - 50; // 270
MINI_Y = (BASEVIDHEIGHT/2)-16; // 84 MINI_Y = (BASEVIDHEIGHT/2)-16; // 84
// Blue Shell warning // Blue Shell warning
SPBW_X = BASEVIDWIDTH/2; // 270 SPBW_X = BASEVIDWIDTH/2; // 270
SPBW_Y = BASEVIDHEIGHT- 24; // 176 SPBW_Y = BASEVIDHEIGHT- 24; // 176
// Battle WANTED poster
WANT_X = BASEVIDWIDTH - 47; // 270
WANT_Y = BASEVIDHEIGHT- 64; // 176
if (splitscreen) // Splitscreen if (splitscreen) // Splitscreen
{ {
@ -4105,6 +4283,9 @@ static void K_initKartHUD(void)
SPBW_Y = (BASEVIDHEIGHT/2)-8; SPBW_Y = (BASEVIDHEIGHT/2)-8;
WANT_X = BASEVIDWIDTH-8;
WANT_Y = (BASEVIDHEIGHT/2)-12;
if (splitscreen > 1) // 3P/4P Small Splitscreen if (splitscreen > 1) // 3P/4P Small Splitscreen
{ {
ITEM_X = -9; ITEM_X = -9;
@ -4122,6 +4303,8 @@ static void K_initKartHUD(void)
SPBW_X = BASEVIDWIDTH/4; SPBW_X = BASEVIDWIDTH/4;
WANT_X = (BASEVIDWIDTH/2)-8;
if (splitscreen > 2) // 4P-only if (splitscreen > 2) // 4P-only
{ {
MINI_X = (BASEVIDWIDTH/2); MINI_X = (BASEVIDWIDTH/2);
@ -4730,6 +4913,64 @@ fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my
return x; return x;
} }
static void K_drawKartWanted(void)
{
UINT8 i, numwanted = 0;
/*if (splitscreen) // Can't fit the poster on screen, sadly
{
if (K_IsPlayerWanted(stplyr) && leveltime % 10 > 4)
V_DrawRightAlignedString(WANT_X, WANT_Y, K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS|V_REDMAP), "WANTED");
return;
}*/
for (i = 0; i < 4; i++)
{
if (battlewanted[i] == -1)
break;
numwanted++;
}
if (numwanted <= 0)
return;
V_DrawScaledPatch(WANT_X, WANT_Y, V_HUDTRANS|V_SNAPTORIGHT|V_SNAPTOBOTTOM, kp_wanted);
for (i = 0; i < numwanted; i++)
{
INT32 x = WANT_X+2, y = WANT_Y+16;
fixed_t scale = FRACUNIT/2;
player_t *p = &players[battlewanted[i]];
if (battlewanted[i] == -1)
break;
if (numwanted == 1)
{
x++;
scale = FRACUNIT;
}
else if (numwanted < 3)
y += 8;
if (i > 1)
y += 8;
if (numwanted == 3 && i == 2)
x += 9;
else if (i & 1)
x += 18;
if (players[battlewanted[i]].skincolor == 0)
V_DrawFixedPatch(x*scale, y*scale, scale, V_HUDTRANS|V_SNAPTORIGHT|V_SNAPTOBOTTOM, faceprefix[p->skin], NULL);
else
{
UINT8 *colormap = R_GetTranslationColormap((p->mo->colorized ? TC_RAINBOW : p->skin), p->mo->color, GTC_CACHE);
V_DrawFixedPatch(x*scale, y*scale, scale, V_HUDTRANS|V_SNAPTORIGHT|V_SNAPTOBOTTOM, faceprefix[p->skin], colormap);
}
}
}
static void K_drawKartPlayerCheck(void) static void K_drawKartPlayerCheck(void)
{ {
INT32 i; INT32 i;
@ -5217,6 +5458,10 @@ void K_drawKartHUD(void)
// Draw the item window // Draw the item window
K_drawKartItem(); K_drawKartItem();
// Draw WANTED status
if (G_BattleGametype())
K_drawKartWanted();
// If not splitscreen, draw... // If not splitscreen, draw...
if (!splitscreen) if (!splitscreen)
{ {

View File

@ -19,12 +19,13 @@ UINT8 K_GetKartColorByName(const char *name);
void K_RegisterKartStuff(void); void K_RegisterKartStuff(void);
boolean K_IsPlayerLosing(player_t *player); boolean K_IsPlayerLosing(player_t *player);
boolean K_IsPlayerWanted(player_t *player);
void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid); void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid);
void K_RespawnChecker(player_t *player); void K_RespawnChecker(player_t *player);
void K_KartMoveAnimation(player_t *player); void K_KartMoveAnimation(player_t *player);
void K_KartPlayerThink(player_t *player, ticcmd_t *cmd); void K_KartPlayerThink(player_t *player, ticcmd_t *cmd);
void K_KartPlayerAfterThink(player_t *player); void K_KartPlayerAfterThink(player_t *player);
void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type); void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, boolean trapitem);
void K_SquishPlayer(player_t *player, mobj_t *source); void K_SquishPlayer(player_t *player, mobj_t *source);
void K_ExplodePlayer(player_t *player, mobj_t *source); void K_ExplodePlayer(player_t *player, mobj_t *source);
void K_StealBalloon(player_t *player, player_t *victim, boolean force); void K_StealBalloon(player_t *player, player_t *victim, boolean force);
@ -46,6 +47,7 @@ fixed_t K_GetKartAccel(player_t *player);
UINT16 K_GetKartFlashing(void); UINT16 K_GetKartFlashing(void);
fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove); fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove);
void K_MoveKartPlayer(player_t *player, boolean onground); void K_MoveKartPlayer(player_t *player, boolean onground);
void K_CalculateBattleWanted(void);
void K_CheckBalloons(void); void K_CheckBalloons(void);
INT32 K_calcSplitFlags(INT32 snapflags); INT32 K_calcSplitFlags(INT32 snapflags);

View File

@ -1993,6 +1993,26 @@ static int lib_kGetKartColorByName(lua_State *L)
return 1; return 1;
} }
static int lib_kIsPlayerLosing(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
//HUDSAFE
if (!player)
return LUA_ErrInvalid(L, "player_t");
K_IsPlayerLosing(player);
return 0;
}
static int lib_kIsPlayerWanted(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
//HUDSAFE
if (!player)
return LUA_ErrInvalid(L, "player_t");
K_IsPlayerWanted(player);
return 0;
}
static int lib_kKartBouncing(lua_State *L) static int lib_kKartBouncing(lua_State *L)
{ {
mobj_t *mobj1 = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *mobj1 = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
@ -2013,12 +2033,13 @@ static int lib_kSpinPlayer(lua_State *L)
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
INT32 type = (INT32)luaL_checkinteger(L, 3); INT32 type = (INT32)luaL_checkinteger(L, 3);
boolean trapitem = luaL_checkboolean(L, 4);
NOHUD NOHUD
if (!player) if (!player)
return LUA_ErrInvalid(L, "player_t"); return LUA_ErrInvalid(L, "player_t");
if (!source) if (!source)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
K_SpinPlayer(player, source, type); K_SpinPlayer(player, source, type, trapitem);
return 0; return 0;
} }
@ -2375,6 +2396,8 @@ static luaL_Reg lib[] = {
// k_kart // k_kart
{"K_GetKartColorByName",lib_kGetKartColorByName}, {"K_GetKartColorByName",lib_kGetKartColorByName},
{"K_IsPlayerLosing",lib_kIsPlayerLosing},
{"K_IsPlayerWanted",lib_kIsPlayerWanted},
{"K_KartBouncing",lib_kKartBouncing}, {"K_KartBouncing",lib_kKartBouncing},
{"K_SpinPlayer",lib_kSpinPlayer}, {"K_SpinPlayer",lib_kSpinPlayer},
{"K_SquishPlayer",lib_kSquishPlayer}, {"K_SquishPlayer",lib_kSquishPlayer},

View File

@ -455,7 +455,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
boom->color = SKINCOLOR_RED; boom->color = SKINCOLOR_RED;
S_StartSound(boom, special->info->attacksound); S_StartSound(boom, special->info->attacksound);
special->target->player->kartstuff[k_comebackpoints] += 2; special->target->player->kartstuff[k_comebackpoints] += 2 * (K_IsPlayerWanted(player) ? 2 : 1);
if (netgame && cv_hazardlog.value) if (netgame && cv_hazardlog.value)
CONS_Printf(M_GetText("%s bombed %s!\n"), player_names[special->target->player-players], player_names[player-players]); CONS_Printf(M_GetText("%s bombed %s!\n"), player_names[special->target->player-players], player_names[player-players]);
if (special->target->player->kartstuff[k_comebackpoints] >= 3) if (special->target->player->kartstuff[k_comebackpoints] >= 3)
@ -2839,6 +2839,8 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
karmahitbox->destscale = player->mo->scale; karmahitbox->destscale = player->mo->scale;
P_SetScale(karmahitbox, player->mo->scale); P_SetScale(karmahitbox, player->mo->scale);
CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]); CONS_Printf(M_GetText("%s lost all of their balloons!\n"), player_names[player-players]);
if (K_IsPlayerWanted(player))
K_CalculateBattleWanted();
} }
player->kartstuff[k_balloon]--; player->kartstuff[k_balloon]--;
} }
@ -2970,6 +2972,8 @@ static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source,
static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage) static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage)
{ {
//const UINT8 scoremultiply = ((K_IsWantedPlayer(player) && !trapitem) : 2 ? 1);
if (!(inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player) && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))) if (!(inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player) && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds])))
{ {
P_DoPlayerPain(player, source, inflictor); P_DoPlayerPain(player, source, inflictor);
@ -2980,11 +2984,11 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
S_StartSound(player->mo, sfx_spkdth); S_StartSound(player->mo, sfx_spkdth);
} }
if (source && source->player && !player->powers[pw_super]) //don't score points against super players /*if (source && source->player && !player->powers[pw_super]) //don't score points against super players
{ {
// Award no points when players shoot each other when cv_friendlyfire is on. // Award no points when players shoot each other when cv_friendlyfire is on.
if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo)) if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo))
P_AddPlayerScore(source->player, 1); P_AddPlayerScore(source->player, scoremultiply);
} }
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))) if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
@ -2994,9 +2998,9 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
{ {
// Award no points when players shoot each other when cv_friendlyfire is on. // Award no points when players shoot each other when cv_friendlyfire is on.
if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo)) if (!G_GametypeHasTeams() || !(source->player->ctfteam == player->ctfteam && source != player->mo))
P_AddPlayerScore(source->player, 1); P_AddPlayerScore(source->player, scoremultiply);
} }
} }*/
// Ring loss sound plays despite hitting spikes // Ring loss sound plays despite hitting spikes
P_PlayRinglossSound(player->mo); // Ringledingle! P_PlayRinglossSound(player->mo); // Ringledingle!
@ -3200,7 +3204,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
player->mo->destscale = 6*(mapheaderinfo[gamemap-1]->mobj_scale)/8; player->mo->destscale = 6*(mapheaderinfo[gamemap-1]->mobj_scale)/8;
// Wipeout // Wipeout
K_SpinPlayer(player, source, 1); K_SpinPlayer(player, source, 1, false);
damage = player->mo->health - 1; damage = player->mo->health - 1;
P_RingDamage(player, inflictor, source, damage); P_RingDamage(player, inflictor, source, damage);
P_PlayerRingBurst(player, 5); P_PlayerRingBurst(player, 5);
@ -3270,7 +3274,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|| inflictor->player)) || inflictor->player))
{ {
player->kartstuff[k_sneakertimer] = 0; player->kartstuff[k_sneakertimer] = 0;
K_SpinPlayer(player, source, 1); K_SpinPlayer(player, source, 1, (inflictor->type == MT_FAKEITEM || inflictor->type == MT_FAKESHIELD));
damage = player->mo->health - 1; damage = player->mo->health - 1;
P_RingDamage(player, inflictor, source, damage); P_RingDamage(player, inflictor, source, damage);
P_PlayerRingBurst(player, 5); P_PlayerRingBurst(player, 5);
@ -3283,7 +3287,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
} }
else else
{ {
K_SpinPlayer(player, source, 0); K_SpinPlayer(player, source, 0, false);
} }
return true; return true;
} }

View File

@ -844,7 +844,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->state == &states[S_MINEEXPLOSION1]) if (tmthing->state == &states[S_MINEEXPLOSION1])
K_ExplodePlayer(thing->player, tmthing->target); K_ExplodePlayer(thing->player, tmthing->target);
else else
K_SpinPlayer(thing->player, tmthing->target, 0); K_SpinPlayer(thing->player, tmthing->target, 0, false);
} }
return true; // This doesn't collide with anything, but we want it to effect the player anyway. return true; // This doesn't collide with anything, but we want it to effect the player anyway.
@ -877,7 +877,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->type == MT_PLAYER) if (thing->type == MT_PLAYER)
{ {
// Player Damage // Player Damage
K_SpinPlayer(thing->player, tmthing->target, 0); K_SpinPlayer(thing->player, tmthing->target, 0, (tmthing->type == MT_BANANA || tmthing->type == MT_BANANA_SHIELD));
// This Item Damage // This Item Damage
if (tmthing->eflags & MFE_VERTICALFLIP) if (tmthing->eflags & MFE_VERTICALFLIP)
@ -1140,7 +1140,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true; return true;
// Player Damage // Player Damage
K_SpinPlayer(tmthing->player, thing->target, 0); K_SpinPlayer(tmthing->player, thing->target, 0, (thing->type == MT_BANANA || thing->type == MT_BANANA_SHIELD));
// Other Item Damage // Other Item Damage
if (thing->eflags & MFE_VERTICALFLIP) if (thing->eflags & MFE_VERTICALFLIP)
@ -1170,7 +1170,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->state == &states[S_MINEEXPLOSION1]) if (thing->state == &states[S_MINEEXPLOSION1])
K_ExplodePlayer(tmthing->player, thing->target); K_ExplodePlayer(tmthing->player, thing->target);
else else
K_SpinPlayer(tmthing->player, thing->target, 0); K_SpinPlayer(tmthing->player, thing->target, 0, false);
return true; return true;
} }
@ -1648,7 +1648,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (G_BattleGametype() && tmthing->player->kartstuff[k_pogospring]) if (G_BattleGametype() && tmthing->player->kartstuff[k_pogospring])
{ {
K_StealBalloon(tmthing->player, thing->player, false); K_StealBalloon(tmthing->player, thing->player, false);
K_SpinPlayer(thing->player, tmthing, 0); K_SpinPlayer(thing->player, tmthing, 0, false);
} }
} }
else if (P_IsObjectOnGround(tmthing) && thing->momz < 0) else if (P_IsObjectOnGround(tmthing) && thing->momz < 0)
@ -1657,7 +1657,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (G_BattleGametype() && thing->player->kartstuff[k_pogospring]) if (G_BattleGametype() && thing->player->kartstuff[k_pogospring])
{ {
K_StealBalloon(thing->player, tmthing->player, false); K_StealBalloon(thing->player, tmthing->player, false);
K_SpinPlayer(tmthing->player, thing, 0); K_SpinPlayer(tmthing->player, thing, 0, false);
} }
} }
else else
@ -1668,12 +1668,12 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (thing->player->kartstuff[k_sneakertimer] && !(tmthing->player->kartstuff[k_sneakertimer])) if (thing->player->kartstuff[k_sneakertimer] && !(tmthing->player->kartstuff[k_sneakertimer]))
{ {
K_StealBalloon(thing->player, tmthing->player, false); K_StealBalloon(thing->player, tmthing->player, false);
K_SpinPlayer(tmthing->player, thing, 0); K_SpinPlayer(tmthing->player, thing, 0, false);
} }
else if (tmthing->player->kartstuff[k_sneakertimer] && !(thing->player->kartstuff[k_sneakertimer])) else if (tmthing->player->kartstuff[k_sneakertimer] && !(thing->player->kartstuff[k_sneakertimer]))
{ {
K_StealBalloon(tmthing->player, thing->player, false); K_StealBalloon(tmthing->player, thing->player, false);
K_SpinPlayer(thing->player, tmthing, 0); K_SpinPlayer(thing->player, tmthing, 0, false);
} }
} }

View File

@ -8154,7 +8154,7 @@ void P_MobjThinker(mobj_t *mobj)
// Now for the wheels // Now for the wheels
{ {
const fixed_t rad = (mobjinfo[MT_PLAYER].radius * mobj->target->scale); const fixed_t rad = FixedMul(mobjinfo[MT_PLAYER].radius, mobj->target->scale);
mobj_t *cur = mobj->hnext; mobj_t *cur = mobj->hnext;
while (cur && !P_MobjWasRemoved(cur)) while (cur && !P_MobjWasRemoved(cur))
@ -8943,7 +8943,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
break; break;
case MT_KARMAHITBOX: // SRB2Kart case MT_KARMAHITBOX: // SRB2Kart
{ {
const fixed_t rad = mobjinfo[MT_PLAYER].radius; const fixed_t rad = FixedMul(mobjinfo[MT_PLAYER].radius, mobj->scale)
mobj_t *cur, *prev = mobj; mobj_t *cur, *prev = mobj;
INT32 i; INT32 i;

View File

@ -3257,6 +3257,9 @@ static void P_NetArchiveMisc(void)
WRITEUINT8(save_p, franticitems); WRITEUINT8(save_p, franticitems);
WRITEUINT8(save_p, comeback); WRITEUINT8(save_p, comeback);
for (i = 0; i < 4; i++)
WRITESINT8(save_p, battlewanted[i]);
WRITEUINT32(save_p, indirectitemcooldown); WRITEUINT32(save_p, indirectitemcooldown);
WRITEUINT32(save_p, spbincoming); WRITEUINT32(save_p, spbincoming);
WRITEUINT8(save_p, spbplayer); WRITEUINT8(save_p, spbplayer);
@ -3357,6 +3360,9 @@ static inline boolean P_NetUnArchiveMisc(void)
franticitems = (boolean)READUINT8(save_p); franticitems = (boolean)READUINT8(save_p);
comeback = (boolean)READUINT8(save_p); comeback = (boolean)READUINT8(save_p);
for (i = 0; i < 4; i++)
battlewanted[i] = READSINT8(save_p);
indirectitemcooldown = READUINT32(save_p); indirectitemcooldown = READUINT32(save_p);
spbincoming = READUINT32(save_p); spbincoming = READUINT32(save_p);
spbplayer = READUINT8(save_p); spbplayer = READUINT8(save_p);

View File

@ -3006,6 +3006,9 @@ boolean P_SetupLevel(boolean skipprecip)
comeback = cv_kartcomeback.value; comeback = cv_kartcomeback.value;
} }
for (i = 0; i < 4; i++)
battlewanted[i] = -1;
indirectitemcooldown = 0; indirectitemcooldown = 0;
spbincoming = 0; spbincoming = 0;
spbplayer = 0; spbplayer = 0;

View File

@ -3983,7 +3983,7 @@ DoneSection2:
case 7: // SRB2kart 190117 - Oil Slick case 7: // SRB2kart 190117 - Oil Slick
if (roversector || P_MobjReadyToTrigger(player->mo, sector)) if (roversector || P_MobjReadyToTrigger(player->mo, sector))
{ {
K_SpinPlayer(player, NULL, 0); K_SpinPlayer(player, NULL, 0, false);
} }
break; break;

View File

@ -677,6 +677,9 @@ void P_Ticker(boolean run)
if (countdown2) if (countdown2)
countdown2--; countdown2--;
if (G_BattleGametype() && leveltime % wantedfrequency == 0 && leveltime > wantedfrequency)
K_CalculateBattleWanted();
if (spbincoming && --spbincoming <= 0) if (spbincoming && --spbincoming <= 0)
{ {
UINT8 best = 0; UINT8 best = 0;

View File

@ -1041,6 +1041,9 @@ void P_AddPlayerScore(player_t *player, UINT32 amount)
{ {
//UINT32 oldscore; //UINT32 oldscore;
if (!(G_BattleGametype()))
return;
if (player->bot) if (player->bot)
player = &players[consoleplayer]; player = &players[consoleplayer];
@ -7634,7 +7637,7 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
continue; continue;
if (mo->type == MT_PLAYER) // Players wipe out in Kart if (mo->type == MT_PLAYER) // Players wipe out in Kart
K_SpinPlayer(mo->player, source, 0); K_SpinPlayer(mo->player, source, 0, false);
//} //}
else else
P_DamageMobj(mo, inflictor, source, 1000); P_DamageMobj(mo, inflictor, source, 1000);

View File

@ -601,7 +601,7 @@ sfxinfo_t S_sfx[NUMSFX] =
{"s3kdbl", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"s3kdbl", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR},
// 3D Blast sounds (the "missing" ones are direct copies of S3K's, no minor differences what-so-ever) // 3D Blast sounds (the "missing" ones are direct copies of S3K's, no minor differences what-so-ever)
{"3db06", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Bumper stolen {"3db06", false, 64, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Bumper stolen
{"3db09", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"3db09", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR},
{"3db14", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"3db14", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR},
{"3db16", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"3db16", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR},

View File

@ -2586,7 +2586,7 @@ void Y_StartVote(void)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
lumpnum_t lumpnum; lumpnum_t lumpnum;
INT16 j; //INT16 j;
// set up the str // set up the str
if (strlen(mapheaderinfo[votelevels[i][0]]->zonttl) > 0) if (strlen(mapheaderinfo[votelevels[i][0]]->zonttl) > 0)