mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-20 19:02:37 +00:00
Flags for only drawing an object on one person's screen, for juicy Boo splitscreen support
(also more item changes from last night that I just forgot to commit earlier)
This commit is contained in:
parent
eb8464744b
commit
babc8be5da
12 changed files with 220 additions and 65 deletions
|
@ -7311,6 +7311,10 @@ static const char *const MOBJEFLAG_LIST[] = {
|
|||
"JUSTBOUNCEDWALL", // SRB2Kart: Mobj already bounced off a wall this tic
|
||||
"SPRUNG", // Mobj was already sprung this tic
|
||||
"APPLYPMOMZ", // Platform movement
|
||||
"DRAWONLYFORP1", // SRB2Kart: Splitscreen sprite draw flags
|
||||
"DRAWONLYFORP2",
|
||||
"DRAWONLYFORP3",
|
||||
"DRAWONLYFORP4",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
@ -15242,7 +15242,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
100, // mass
|
||||
1, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
|
||||
MF_NOBLOCKMAP|MF_NOCLIPHEIGHT|MF_NOCLIPTHING|MF_NOGRAVITY|MF_SCENERY, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
|
93
src/k_kart.c
93
src/k_kart.c
|
@ -367,11 +367,11 @@ static INT32 K_KartItemOddsDistance_Retro[NUMKARTITEMS][9] =
|
|||
//P-Odds 0 1 2 3 4 5 6 7 8
|
||||
/*Magnet*/ { 0, 1, 2, 0, 0, 0, 0, 0, 0 }, // Magnet
|
||||
/*Boo*/ { 0, 0, 2, 2, 1, 0, 0, 0, 0 }, // Boo
|
||||
/*Mushroom*/ { 1, 0, 0, 3, 7, 5, 0, 0, 0 }, // Mushroom
|
||||
/*Triple Mushroom*/ { 0, 0, 0, 0, 3, 8, 6, 4, 0 }, // Triple Mushroom
|
||||
/*Mega Mushroom*/ { 0, 0, 0, 0, 0, 1, 1, 1, 2 }, // Mega Mushroom
|
||||
/*Gold Mushroom*/ { 0, 0, 0, 0, 0, 2, 4, 3, 0 }, // Gold Mushroom
|
||||
/*Star*/ { 0, 0, 0, 0, 0, 1, 6, 8,18 }, // Star
|
||||
/*Mushroom*/ {20, 0, 0, 3, 7, 6, 0, 0, 0 }, // Mushroom
|
||||
/*Triple Mushroom*/ { 0, 0, 0, 0, 3, 8, 7, 4, 0 }, // Triple Mushroom
|
||||
/*Mega Mushroom*/ { 0, 0, 0, 0, 0, 0, 1, 1, 2 }, // Mega Mushroom
|
||||
/*Gold Mushroom*/ { 0, 0, 0, 0, 0, 3, 5, 4, 0 }, // Gold Mushroom
|
||||
/*Star*/ { 0, 0, 0, 0, 0, 1, 6, 9,18 }, // Star
|
||||
|
||||
/*Triple Banana*/ { 0, 0, 1, 1, 0, 0, 0, 0, 0 }, // Triple Banana
|
||||
/*Fake Item*/ { 0, 4, 2, 1, 0, 0, 0, 0, 0 }, // Fake Item
|
||||
|
@ -393,25 +393,25 @@ static INT32 K_KartItemOddsBalloons[NUMKARTITEMS][6] =
|
|||
//P-Odds 0 1 2 3 4 5
|
||||
/*Magnet*/ { 0, 0, 0, 0, 0, 0 }, // Magnet
|
||||
/*Boo*/ { 0, 0, 1, 1, 0, 0 }, // Boo
|
||||
/*Mushroom*/ { 0, 1, 2, 1, 0, 1 }, // Mushroom
|
||||
/*Triple Mushroom*/ { 0, 0, 0, 0, 0, 0 }, // Triple Mushroom
|
||||
/*Mega Mushroom*/ { 1, 2, 0, 0, 0, 1 }, // Mega Mushroom
|
||||
/*Mushroom*/ { 3, 1, 2, 2, 0, 2 }, // Mushroom
|
||||
/*Triple Mushroom*/ { 3, 0, 0, 0, 0, 2 }, // Triple Mushroom
|
||||
/*Mega Mushroom*/ { 4, 2, 0, 0, 0, 2 }, // Mega Mushroom
|
||||
/*Gold Mushroom*/ { 0, 0, 0, 0, 0, 0 }, // Gold Mushroom
|
||||
/*Star*/ { 1, 2, 0, 0, 0, 1 }, // Star
|
||||
/*Star*/ { 4, 2, 1, 0, 0, 2 }, // Star
|
||||
|
||||
/*Triple Banana*/ { 0, 1, 1, 0, 0, 1 }, // Triple Banana
|
||||
/*Fake Item*/ { 0, 0, 2, 1, 1, 0 }, // Fake Item
|
||||
/*Banana*/ { 0, 0, 3, 1, 1, 0 }, // Banana
|
||||
/*Green Shell*/ { 0, 0, 5, 3, 2, 0 }, // Green Shell
|
||||
/*Red Shell*/ { 0, 3, 3, 0, 0, 1 }, // Red Shell
|
||||
/*Triple Green Shell*/ { 0, 1, 1, 0, 0, 1 }, // Triple Green Shell
|
||||
/*Bob-omb*/ { 0, 3, 3, 0, 0, 1 }, // Bob-omb
|
||||
/*Triple Banana*/ { 0, 2, 2, 1, 1, 2 }, // Triple Banana
|
||||
/*Fake Item*/ { 0, 0, 2, 2, 3, 0 }, // Fake Item
|
||||
/*Banana*/ { 0, 0, 2, 3, 6, 0 }, // Banana
|
||||
/*Green Shell*/ { 0, 0, 3, 5,10, 0 }, // Green Shell
|
||||
/*Red Shell*/ { 3, 3, 2, 1, 0, 2 }, // Red Shell
|
||||
/*Triple Green Shell*/ { 0, 3, 1, 1, 0, 2 }, // Triple Green Shell
|
||||
/*Bob-omb*/ { 0, 3, 2, 1, 0, 2 }, // Bob-omb
|
||||
/*Blue Shell*/ { 0, 0, 0, 0, 0, 0 }, // Blue Shell
|
||||
/*Fire Flower*/ { 0, 3, 3, 0, 0, 1 }, // Fire Flower
|
||||
/*Triple Red Shell*/ { 1, 2, 0, 0, 0, 1 }, // Triple Red Shell
|
||||
/*Fire Flower*/ { 0, 2, 1, 1, 0, 2 }, // Fire Flower
|
||||
/*Triple Red Shell*/ { 3, 2, 0, 0, 0, 2 }, // Triple Red Shell
|
||||
/*Lightning*/ { 0, 0, 0, 0, 0, 0 }, // Lightning
|
||||
|
||||
/*Feather*/ { 0, 0, 1, 1, 0, 0 } // Feather
|
||||
/*Feather*/ { 0, 0, 1, 2, 0, 0 } // Feather
|
||||
};
|
||||
|
||||
/** \brief Item Roulette for Kart
|
||||
|
@ -548,6 +548,8 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd)
|
|||
INT32 distvar = (64*14);
|
||||
INT32 avgballoon = 0;
|
||||
INT32 secondist = 0;
|
||||
SINT8 first = -1;
|
||||
SINT8 second = -1;
|
||||
boolean mashed = false;
|
||||
|
||||
// This makes the roulette cycle through items - if this is 0, you shouldn't be here.
|
||||
|
@ -594,9 +596,6 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd)
|
|||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
SINT8 first = -1;
|
||||
SINT8 second = -1;
|
||||
|
||||
if (playeringame[i] && !players[i].spectator && players[i].mo)
|
||||
{
|
||||
if (players[i].kartstuff[k_position] < player->kartstuff[k_position])
|
||||
|
@ -610,15 +609,15 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd)
|
|||
if (players[i].kartstuff[k_position] == 2 && second == -1)
|
||||
second = i;
|
||||
}
|
||||
|
||||
if (first != -1 && second != -1 && !secondist) // calculate 2nd's distance from 1st, for blue shell
|
||||
secondist = P_AproxDistance(P_AproxDistance(players[first].mo->x - players[second].mo->x,
|
||||
players[first].mo->y - players[second].mo->y),
|
||||
players[first].mo->z - players[second].mo->z) / mapheaderinfo[gamemap-1]->mobj_scale
|
||||
* (pingame - 1)
|
||||
/ ((pingame - 1) * (pingame + 1) / 3);
|
||||
}
|
||||
|
||||
if (first != -1 && second != -1 && !secondist) // calculate 2nd's distance from 1st, for blue shell
|
||||
secondist = P_AproxDistance(P_AproxDistance(players[first].mo->x - players[second].mo->x,
|
||||
players[first].mo->y - players[second].mo->y),
|
||||
players[first].mo->z - players[second].mo->z) / mapheaderinfo[gamemap-1]->mobj_scale
|
||||
* (pingame - 1)
|
||||
/ ((pingame - 1) * (pingame + 1) / 3);
|
||||
|
||||
player->kartstuff[k_itemclose] = 0; // Reset the item window closer.
|
||||
|
||||
if (G_BattleGametype()) // Battle Mode
|
||||
|
@ -652,6 +651,8 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd)
|
|||
else useodds = 8;
|
||||
}
|
||||
|
||||
//CONS_Printf("%d %d\n", secondist, distvar*2);
|
||||
|
||||
#define SETITEMRESULT(pos, itemnum) \
|
||||
for (chance = 0; chance < K_KartGetItemOdds(pos, itemnum, mashed); chance++) \
|
||||
spawnchance[numchoices++] = itemnum
|
||||
|
@ -674,7 +675,7 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd)
|
|||
if (cv_triplegreenshell.value) SETITEMRESULT(useodds, 13); // Triple Green Shell
|
||||
if (cv_bobomb.value) SETITEMRESULT(useodds, 14); // Bob-omb
|
||||
if (cv_blueshell.value && pexiting == 0
|
||||
&& !lightningcooldown && secondist > distvar*2) SETITEMRESULT(useodds, 15); // Blue Shell
|
||||
&& (secondist > distvar*4) && !lightningcooldown) SETITEMRESULT(useodds, 15); // Blue Shell
|
||||
if (cv_fireflower.value) SETITEMRESULT(useodds, 16); // Fire Flower
|
||||
if (cv_tripleredshell.value && pingame > 2) SETITEMRESULT(useodds, 17); // Triple Red Shell
|
||||
if (cv_lightning.value && pingame > pexiting && !lightningcooldown) SETITEMRESULT(useodds, 18); // Lightning
|
||||
|
@ -3323,23 +3324,47 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
|
||||
if (player->kartstuff[k_bootimer] > 0)
|
||||
{
|
||||
if ((player == &players[displayplayer] && !splitscreen)
|
||||
|| (!(player == &players[displayplayer] && !splitscreen)
|
||||
&& (player->kartstuff[k_bootimer] < 1*TICRATE/2 || player->kartstuff[k_bootimer] > bootime-(1*TICRATE/2))))
|
||||
if (splitscreen)
|
||||
{
|
||||
if (leveltime & 1)
|
||||
player->mo->flags2 |= MF2_DONTDRAW;
|
||||
else
|
||||
player->mo->flags2 &= ~MF2_DONTDRAW;
|
||||
|
||||
if (player->kartstuff[k_bootimer] >= (1*TICRATE/2) && player->kartstuff[k_bootimer] <= bootime-(1*TICRATE/2))
|
||||
{
|
||||
if (player == &players[secondarydisplayplayer])
|
||||
player->mo->eflags |= MFE_DRAWONLYFORP2;
|
||||
else if (player == &players[thirddisplayplayer] && splitscreen > 1)
|
||||
player->mo->eflags |= MFE_DRAWONLYFORP3;
|
||||
else if (player == &players[fourthdisplayplayer] && splitscreen > 2)
|
||||
player->mo->eflags |= MFE_DRAWONLYFORP4;
|
||||
else
|
||||
player->mo->eflags |= MFE_DRAWONLYFORP1;
|
||||
}
|
||||
else
|
||||
player->mo->eflags &= ~(MFE_DRAWONLYFORP1|MFE_DRAWONLYFORP2|MFE_DRAWONLYFORP3|MFE_DRAWONLYFORP4);
|
||||
}
|
||||
else
|
||||
player->mo->flags2 |= MF2_DONTDRAW;
|
||||
{
|
||||
if (player == &players[displayplayer]
|
||||
|| (player != &players[displayplayer] && (player->kartstuff[k_bootimer] < (1*TICRATE/2) || player->kartstuff[k_bootimer] > bootime-(1*TICRATE/2))))
|
||||
{
|
||||
if (leveltime & 1)
|
||||
player->mo->flags2 |= MF2_DONTDRAW;
|
||||
else
|
||||
player->mo->flags2 &= ~MF2_DONTDRAW;
|
||||
}
|
||||
else
|
||||
player->mo->flags2 |= MF2_DONTDRAW;
|
||||
}
|
||||
|
||||
player->powers[pw_flashing] = player->kartstuff[k_bootimer]; // We'll do this for now, let's people know about the invisible people through subtle hints
|
||||
}
|
||||
else if (player->kartstuff[k_bootimer] == 0)
|
||||
{
|
||||
player->mo->flags2 &= ~MF2_DONTDRAW;
|
||||
player->mo->eflags &= ~(MFE_DRAWONLYFORP1|MFE_DRAWONLYFORP2|MFE_DRAWONLYFORP3|MFE_DRAWONLYFORP4);
|
||||
}
|
||||
|
||||
if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) // dead in match? you da bomb
|
||||
|
|
|
@ -3127,8 +3127,10 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
player->kartstuff[k_mushroomtimer] = 0;
|
||||
|
||||
// Thunder
|
||||
if (damage == 64 && player != source->player)
|
||||
if (damage == 64)
|
||||
{
|
||||
if (player == source->player)
|
||||
return false;
|
||||
// Don't flip out while super!
|
||||
if (!player->kartstuff[k_startimer] && player->kartstuff[k_growshrinktimer] <= 0)
|
||||
{
|
||||
|
@ -3148,20 +3150,18 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_LIGHTNING);
|
||||
return true;
|
||||
}
|
||||
else if (damage == 64 && player == source->player)
|
||||
return false;
|
||||
|
||||
// Blue Thunder
|
||||
if (damage == 65 && player->kartstuff[k_position] == 1)
|
||||
if (damage == 65)
|
||||
{
|
||||
if (player == source->player)
|
||||
return false;
|
||||
// Just need to do this now! Being thrown upwards is done by the explosion.
|
||||
P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUELIGHTNING);
|
||||
blueexplode = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BLUEEXPLOSION);
|
||||
P_SetTarget(&blueexplode->target, source);
|
||||
return true;
|
||||
}
|
||||
else if (damage == 65 && player->kartstuff[k_position] > 1)
|
||||
return false;
|
||||
//}
|
||||
|
||||
// Sudden-Death mode
|
||||
|
|
84
src/p_mobj.c
84
src/p_mobj.c
|
@ -6264,6 +6264,26 @@ void P_RunShadows(void)
|
|||
else
|
||||
mobj->flags2 &= ~MF2_DONTDRAW;
|
||||
|
||||
if (mobj->target->eflags & MFE_DRAWONLYFORP1) // groooooaann...
|
||||
mobj->eflags |= MFE_DRAWONLYFORP1;
|
||||
else
|
||||
mobj->eflags &= ~MFE_DRAWONLYFORP1;
|
||||
|
||||
if (mobj->target->eflags & MFE_DRAWONLYFORP2)
|
||||
mobj->eflags |= MFE_DRAWONLYFORP2;
|
||||
else
|
||||
mobj->eflags &= ~MFE_DRAWONLYFORP2;
|
||||
|
||||
if (mobj->target->eflags & MFE_DRAWONLYFORP3)
|
||||
mobj->eflags |= MFE_DRAWONLYFORP3;
|
||||
else
|
||||
mobj->eflags &= ~MFE_DRAWONLYFORP3;
|
||||
|
||||
if (mobj->target->eflags & MFE_DRAWONLYFORP4)
|
||||
mobj->eflags |= MFE_DRAWONLYFORP4;
|
||||
else
|
||||
mobj->eflags &= ~MFE_DRAWONLYFORP4;
|
||||
|
||||
// First scale to the same radius
|
||||
P_SetScale(mobj, FixedDiv(mobj->target->radius, mobj->info->radius));
|
||||
|
||||
|
@ -6576,27 +6596,46 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
|
||||
if (mobj->target->player->kartstuff[k_bootimer] > 0)
|
||||
{
|
||||
if ((mobj->target->player == &players[displayplayer]
|
||||
|| (splitscreen && mobj->target->player == &players[secondarydisplayplayer])
|
||||
|| (splitscreen > 1 && mobj->target->player == &players[thirddisplayplayer])
|
||||
|| (splitscreen > 2 && mobj->target->player == &players[fourthdisplayplayer]))
|
||||
|| (!(mobj->target->player == &players[displayplayer]
|
||||
|| (splitscreen && mobj->target->player == &players[secondarydisplayplayer])
|
||||
|| (splitscreen > 1 && mobj->target->player == &players[thirddisplayplayer])
|
||||
|| (splitscreen > 2 && mobj->target->player == &players[fourthdisplayplayer]))
|
||||
&& (mobj->target->player->kartstuff[k_bootimer] < 1*TICRATE/2 || mobj->target->player->kartstuff[k_bootimer] > bootime-(1*TICRATE/2))))
|
||||
if (splitscreen)
|
||||
{
|
||||
if (leveltime & 1)
|
||||
mobj->flags2 |= MF2_DONTDRAW;
|
||||
else
|
||||
mobj->flags2 &= ~MF2_DONTDRAW;
|
||||
|
||||
if (mobj->target->player->kartstuff[k_bootimer] >= (1*TICRATE/2) && mobj->target->player->kartstuff[k_bootimer] <= bootime-(1*TICRATE/2))
|
||||
{
|
||||
if (mobj->target->player == &players[secondarydisplayplayer])
|
||||
mobj->eflags |= MFE_DRAWONLYFORP2;
|
||||
else if (mobj->target->player == &players[thirddisplayplayer] && splitscreen > 1)
|
||||
mobj->eflags |= MFE_DRAWONLYFORP3;
|
||||
else if (mobj->target->player == &players[fourthdisplayplayer] && splitscreen > 2)
|
||||
mobj->eflags |= MFE_DRAWONLYFORP4;
|
||||
else
|
||||
mobj->eflags |= MFE_DRAWONLYFORP1;
|
||||
}
|
||||
else
|
||||
mobj->eflags &= ~(MFE_DRAWONLYFORP1|MFE_DRAWONLYFORP2|MFE_DRAWONLYFORP3|MFE_DRAWONLYFORP4);
|
||||
}
|
||||
else
|
||||
mobj->flags2 |= MF2_DONTDRAW;
|
||||
{
|
||||
if (mobj->target->player == &players[displayplayer]
|
||||
|| (mobj->target->player != &players[displayplayer]
|
||||
&& (mobj->target->player->kartstuff[k_bootimer] < (1*TICRATE/2) || mobj->target->player->kartstuff[k_bootimer] > bootime-(1*TICRATE/2))))
|
||||
{
|
||||
if (leveltime & 1)
|
||||
mobj->flags2 |= MF2_DONTDRAW;
|
||||
else
|
||||
mobj->flags2 &= ~MF2_DONTDRAW;
|
||||
}
|
||||
else
|
||||
mobj->flags2 |= MF2_DONTDRAW;
|
||||
}
|
||||
}
|
||||
else if (mobj->target->player->kartstuff[k_bootimer] == 0)
|
||||
{
|
||||
mobj->flags2 &= ~MF2_DONTDRAW;
|
||||
mobj->eflags &= ~(MFE_DRAWONLYFORP1|MFE_DRAWONLYFORP2|MFE_DRAWONLYFORP3|MFE_DRAWONLYFORP4);
|
||||
}
|
||||
|
||||
// Actor's distance from its Target, or Radius.
|
||||
|
@ -6791,7 +6830,7 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
}
|
||||
break;
|
||||
case MT_BATTLEBALLOON:
|
||||
if (mobj->health > 0 && mobj->target && mobj->target->player && mobj->target->player->mo
|
||||
if (mobj->health > 0 && mobj->target && mobj->target->player
|
||||
&& mobj->target->player->health > 0 && !mobj->target->player->spectator)
|
||||
{
|
||||
fixed_t rad = 32*mobj->target->scale;
|
||||
|
@ -6822,6 +6861,26 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
offz = mobj->target->height / 5;
|
||||
}
|
||||
|
||||
if (mobj->target->eflags & MFE_DRAWONLYFORP1) // groooooaann...
|
||||
mobj->eflags |= MFE_DRAWONLYFORP1;
|
||||
else
|
||||
mobj->eflags &= ~MFE_DRAWONLYFORP1;
|
||||
|
||||
if (mobj->target->eflags & MFE_DRAWONLYFORP2)
|
||||
mobj->eflags |= MFE_DRAWONLYFORP2;
|
||||
else
|
||||
mobj->eflags &= ~MFE_DRAWONLYFORP2;
|
||||
|
||||
if (mobj->target->eflags & MFE_DRAWONLYFORP3)
|
||||
mobj->eflags |= MFE_DRAWONLYFORP3;
|
||||
else
|
||||
mobj->eflags &= ~MFE_DRAWONLYFORP3;
|
||||
|
||||
if (mobj->target->eflags & MFE_DRAWONLYFORP4)
|
||||
mobj->eflags |= MFE_DRAWONLYFORP4;
|
||||
else
|
||||
mobj->eflags &= ~MFE_DRAWONLYFORP4;
|
||||
|
||||
if (mobj->target->flags2 & MF2_DONTDRAW)
|
||||
mobj->flags2 |= MF2_DONTDRAW;
|
||||
else
|
||||
|
@ -6931,6 +6990,9 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
else if (mobj->target->player->kartstuff[k_banana]) P_SetMobjState(mobj, S_PLAYERARROW_BANANA);
|
||||
else if (mobj->target->player->kartstuff[k_greenshell]) P_SetMobjState(mobj, S_PLAYERARROW_GREENSHELL);
|
||||
else if (mobj->target->player->kartstuff[k_mushroom]) P_SetMobjState(mobj, S_PLAYERARROW_MUSHROOM);
|
||||
else if (mobj->target->player->kartstuff[k_mushroom]
|
||||
&& mobj->target->player->kartstuff[k_mushroomtimer] > 1
|
||||
&& !(leveltime & 1)) P_SetMobjState(mobj, S_PLAYERARROW_EMPTY); // S_INVISIBLE
|
||||
else P_SetMobjState(mobj, S_PLAYERARROW); // S_INVISIBLE
|
||||
|
||||
scale += FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x,
|
||||
|
|
|
@ -239,6 +239,11 @@ typedef enum
|
|||
MFE_SPRUNG = 1<<8,
|
||||
// Platform movement
|
||||
MFE_APPLYPMOMZ = 1<<9,
|
||||
// SRB2Kart: Splitscreen sprite display; very wasteful but I couldn't think of another way to do it...
|
||||
MFE_DRAWONLYFORP1 = 1<<10,
|
||||
MFE_DRAWONLYFORP2 = 1<<11,
|
||||
MFE_DRAWONLYFORP3 = 1<<12,
|
||||
MFE_DRAWONLYFORP4 = 1<<13,
|
||||
// free: to and including 1<<15
|
||||
} mobjeflag_t;
|
||||
|
||||
|
|
|
@ -3003,6 +3003,10 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
comeback = cv_kartcomeback.value;
|
||||
}
|
||||
|
||||
lightningcooldown = 0;
|
||||
blueshellincoming = 0;
|
||||
blueshellplayer = 0;
|
||||
|
||||
// clear special respawning que
|
||||
iquehead = iquetail = 0;
|
||||
|
||||
|
|
10
src/r_bsp.c
10
src/r_bsp.c
|
@ -855,7 +855,7 @@ static void R_AddPolyObjects(subsector_t *sub)
|
|||
|
||||
drawseg_t *firstseg;
|
||||
|
||||
static void R_Subsector(size_t num)
|
||||
static void R_Subsector(size_t num, UINT8 ssplayer)
|
||||
{
|
||||
INT32 count, floorlightlevel, ceilinglightlevel, light;
|
||||
seg_t *line;
|
||||
|
@ -1213,7 +1213,7 @@ static void R_Subsector(size_t num)
|
|||
// Either you must pass the fake sector and handle validcount here, on the
|
||||
// real sector, or you must account for the lighting in some other way,
|
||||
// like passing it as an argument.
|
||||
R_AddSprites(sub->sector, (floorlightlevel+ceilinglightlevel)/2);
|
||||
R_AddSprites(sub->sector, (floorlightlevel+ceilinglightlevel)/2, ssplayer);
|
||||
|
||||
firstseg = NULL;
|
||||
|
||||
|
@ -1419,7 +1419,7 @@ INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside)
|
|||
//
|
||||
// killough 5/2/98: reformatted, removed tail recursion
|
||||
|
||||
void R_RenderBSPNode(INT32 bspnum)
|
||||
void R_RenderBSPNode(INT32 bspnum, UINT8 ssplayer)
|
||||
{
|
||||
node_t *bsp;
|
||||
INT32 side;
|
||||
|
@ -1430,7 +1430,7 @@ void R_RenderBSPNode(INT32 bspnum)
|
|||
// Decide which side the view point is on.
|
||||
side = R_PointOnSide(viewx, viewy, bsp);
|
||||
// Recursively divide front space.
|
||||
R_RenderBSPNode(bsp->children[side]);
|
||||
R_RenderBSPNode(bsp->children[side], ssplayer);
|
||||
|
||||
// Possibly divide back space.
|
||||
|
||||
|
@ -1448,5 +1448,5 @@ void R_RenderBSPNode(INT32 bspnum)
|
|||
portalcullsector = NULL;
|
||||
}
|
||||
|
||||
R_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR);
|
||||
R_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR, ssplayer);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ extern INT32 doorclosed;
|
|||
void R_ClearClipSegs(void);
|
||||
void R_PortalClearClipSegs(INT32 start, INT32 end);
|
||||
void R_ClearDrawSegs(void);
|
||||
void R_RenderBSPNode(INT32 bspnum);
|
||||
void R_RenderBSPNode(INT32 bspnum, UINT8 ssplayer);
|
||||
void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2);
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
|
|
18
src/r_main.c
18
src/r_main.c
|
@ -1335,6 +1335,18 @@ void R_RenderPlayerView(player_t *player)
|
|||
{
|
||||
portal_pair *portal;
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
||||
UINT8 ssplayer;
|
||||
|
||||
if (player == &players[secondarydisplayplayer] && splitscreen)
|
||||
ssplayer = 2;
|
||||
else if (player == &players[thirddisplayplayer] && splitscreen > 1)
|
||||
ssplayer = 3;
|
||||
else if (player == &players[fourthdisplayplayer] && splitscreen > 2)
|
||||
ssplayer = 4;
|
||||
else if (splitscreen)
|
||||
ssplayer = 1;
|
||||
else
|
||||
ssplayer = 0;
|
||||
|
||||
if (cv_homremoval.value && player == &players[displayplayer]) // if this is display player 1
|
||||
{
|
||||
|
@ -1371,7 +1383,7 @@ void R_RenderPlayerView(player_t *player)
|
|||
R_ClearVisibleFloorSplats();
|
||||
#endif
|
||||
|
||||
R_RenderBSPNode((INT32)numnodes - 1);
|
||||
R_RenderBSPNode((INT32)numnodes - 1, ssplayer);
|
||||
R_ClipSprites();
|
||||
R_DrawPlanes();
|
||||
#ifdef FLOORSPLATS
|
||||
|
@ -1404,7 +1416,7 @@ void R_RenderPlayerView(player_t *player)
|
|||
mytotal = 0;
|
||||
ProfZeroTimer();
|
||||
#endif
|
||||
R_RenderBSPNode((INT32)numnodes - 1);
|
||||
R_RenderBSPNode((INT32)numnodes - 1, ssplayer);
|
||||
R_ClipSprites();
|
||||
#ifdef TIMING
|
||||
RDMSR(0x10, &mycount);
|
||||
|
@ -1429,7 +1441,7 @@ void R_RenderPlayerView(player_t *player)
|
|||
|
||||
validcount++;
|
||||
|
||||
R_RenderBSPNode((INT32)numnodes - 1);
|
||||
R_RenderBSPNode((INT32)numnodes - 1, ssplayer);
|
||||
R_ClipSprites();
|
||||
//R_DrawPlanes();
|
||||
//R_DrawMasked();
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "d_netfil.h" // blargh. for nameonly().
|
||||
#include "m_cheat.h" // objectplace
|
||||
#include "k_kart.h" // SRB2kart
|
||||
#include "p_local.h" // stplyr
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_md2.h"
|
||||
#endif
|
||||
|
@ -1675,7 +1676,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
|||
// R_AddSprites
|
||||
// During BSP traversal, this adds sprites by sector.
|
||||
//
|
||||
void R_AddSprites(sector_t *sec, INT32 lightlevel)
|
||||
void R_AddSprites(sector_t *sec, INT32 lightlevel, UINT8 ssplayer)
|
||||
{
|
||||
mobj_t *thing;
|
||||
precipmobj_t *precipthing; // Tails 08-25-2002
|
||||
|
@ -1718,6 +1719,25 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
|
|||
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
|
||||
continue;
|
||||
|
||||
if (splitscreen)
|
||||
{
|
||||
if (thing->eflags & MFE_DRAWONLYFORP1)
|
||||
if (ssplayer != 1)
|
||||
continue;
|
||||
|
||||
if (thing->eflags & MFE_DRAWONLYFORP2)
|
||||
if (ssplayer != 2)
|
||||
continue;
|
||||
|
||||
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
|
||||
if (ssplayer != 3)
|
||||
continue;
|
||||
|
||||
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
|
||||
if (ssplayer != 4)
|
||||
continue;
|
||||
}
|
||||
|
||||
approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
|
||||
|
||||
if (approx_dist <= limit_dist)
|
||||
|
@ -1728,8 +1748,31 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel)
|
|||
{
|
||||
// Draw everything in sector, no checks
|
||||
for (thing = sec->thinglist; thing; thing = thing->snext)
|
||||
if (!(thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW))
|
||||
R_ProjectSprite(thing);
|
||||
{
|
||||
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
|
||||
continue;
|
||||
|
||||
if (splitscreen)
|
||||
{
|
||||
if (thing->eflags & MFE_DRAWONLYFORP1)
|
||||
if (ssplayer != 1)
|
||||
continue;
|
||||
|
||||
if (thing->eflags & MFE_DRAWONLYFORP2)
|
||||
if (ssplayer != 2)
|
||||
continue;
|
||||
|
||||
if (thing->eflags & MFE_DRAWONLYFORP3 && splitscreen > 1)
|
||||
if (ssplayer != 3)
|
||||
continue;
|
||||
|
||||
if (thing->eflags & MFE_DRAWONLYFORP4 && splitscreen > 2)
|
||||
if (ssplayer != 4)
|
||||
continue;
|
||||
}
|
||||
|
||||
R_ProjectSprite(thing);
|
||||
}
|
||||
}
|
||||
|
||||
// Someone seriously wants infinite draw distance for precipitation?
|
||||
|
|
|
@ -55,7 +55,7 @@ void R_DelSpriteDefs(UINT16 wadnum);
|
|||
#endif
|
||||
|
||||
//SoM: 6/5/2000: Light sprites correctly!
|
||||
void R_AddSprites(sector_t *sec, INT32 lightlevel);
|
||||
void R_AddSprites(sector_t *sec, INT32 lightlevel, UINT8 ssplayer);
|
||||
void R_InitSprites(void);
|
||||
void R_ClearSprites(void);
|
||||
void R_ClipSprites(void);
|
||||
|
|
Loading…
Reference in a new issue