Revert "massive cleanup player related dead code"
This reverts commit 890a5810ae.
This commit is contained in:
1 parent
dd6a1ffca2
commit
ae63763490
23 files changed
+1015
-304
No files matched your search
+48
-46
@@ -42,26 +42,25 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
|
||||
if (tails->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
|
||||
{
|
||||
dist = P_AproxDistance(tails->x-sonic->x, tails->y-sonic->y);
|
||||
|
||||
if (sonic->player->cmd.buttons & BT_DRIFT && sonic->player->pflags & (PF_JUMPED|PF_MACESPIN|PF_ITEMHANG))
|
||||
cmd->buttons |= BT_DRIFT;
|
||||
|
||||
if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
|
||||
{
|
||||
cmd->forwardmove = sonic->player->cmd.forwardmove;
|
||||
cmd->angleturn = abs((signed)(tails->angle - sonic->angle)) >> TICCMD_REDUCE;
|
||||
if (sonic->angle < tails->angle)
|
||||
cmd->angleturn = -cmd->angleturn;
|
||||
}
|
||||
else if (dist > FixedMul(512*FRACUNIT, tails->scale))
|
||||
} else if (dist > FixedMul(512*FRACUNIT, tails->scale))
|
||||
cmd->buttons |= BT_DRIFT;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Gather data about the environment
|
||||
dist = P_AproxDistance(tails->x-sonic->x, tails->y-sonic->y);
|
||||
angle = R_PointToAngle2(tails->x, tails->y, sonic->x, sonic->y);
|
||||
if (tails->player->pflags & PF_STARTDASH)
|
||||
angle = sonic->angle;
|
||||
else
|
||||
angle = R_PointToAngle2(tails->x, tails->y, sonic->x, sonic->y);
|
||||
|
||||
// Decide which direction to turn
|
||||
angle = (tails->angle - angle);
|
||||
@@ -92,6 +91,11 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
|
||||
jump = true;
|
||||
}
|
||||
|
||||
// Decide when to spin
|
||||
if (sonic->player->pflags & PF_STARTDASH
|
||||
&& (tails->player->pflags & PF_STARTDASH || (P_AproxDistance(tails->momx, tails->momy) < 2*FRACUNIT && !forward)))
|
||||
spin = true;
|
||||
|
||||
// Turn the virtual keypresses into ticcmd_t.
|
||||
B_KeysToTiccmd(tails, cmd, forward, backward, left, right, false, false, jump, spin);
|
||||
|
||||
@@ -129,35 +133,41 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
|
||||
void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward, boolean left, boolean right, boolean strafeleft, boolean straferight, boolean jump, boolean spin)
|
||||
{
|
||||
// Turn the virtual keypresses into ticcmd_t.
|
||||
if (twodlevel || mo->flags2 & MF2_TWOD)
|
||||
{
|
||||
// In standard 2D mode, interpret "forward" as "the way you're facing" and everything else as "the way you're not facing"
|
||||
if (left || right)
|
||||
backward = true;
|
||||
left = right = false;
|
||||
|
||||
if (forward)
|
||||
{
|
||||
if (mo->angle < ANGLE_90 || mo->angle > ANGLE_270)
|
||||
right = true;
|
||||
else
|
||||
left = true;
|
||||
if (twodlevel || mo->flags2 & MF2_TWOD) {
|
||||
if (players[consoleplayer].climbing
|
||||
|| mo->player->pflags & PF_GLIDING) {
|
||||
// Don't mess with bot inputs during these unhandled movement conditions.
|
||||
// The normal AI doesn't use abilities, so custom AI should be sending us exactly what it wants anyway.
|
||||
if (forward)
|
||||
cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
if (backward)
|
||||
cmd->forwardmove -= MAXPLMOVE<<FRACBITS >> TICCMD_REDUCE;
|
||||
if (left || strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
if (right || straferight)
|
||||
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
} else {
|
||||
// In standard 2D mode, interpret "forward" as "the way you're facing" and everything else as "the way you're not facing"
|
||||
if (left || right)
|
||||
backward = true;
|
||||
left = right = false;
|
||||
if (forward) {
|
||||
if (mo->angle < ANGLE_90 || mo->angle > ANGLE_270)
|
||||
right = true;
|
||||
else
|
||||
left = true;
|
||||
} else if (backward) {
|
||||
if (mo->angle < ANGLE_90 || mo->angle > ANGLE_270)
|
||||
left = true;
|
||||
else
|
||||
right = true;
|
||||
}
|
||||
if (left || strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
if (right || straferight)
|
||||
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
}
|
||||
else if (backward)
|
||||
{
|
||||
if (mo->angle < ANGLE_90 || mo->angle > ANGLE_270)
|
||||
left = true;
|
||||
else
|
||||
right = true;
|
||||
}
|
||||
|
||||
if (left || strafeleft)
|
||||
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
if (right || straferight)
|
||||
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (forward)
|
||||
cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
if (backward)
|
||||
@@ -171,7 +181,6 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
|
||||
if (straferight)
|
||||
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
|
||||
}
|
||||
|
||||
if (jump)
|
||||
cmd->buttons |= BT_DRIFT;
|
||||
if (spin)
|
||||
@@ -195,7 +204,7 @@ boolean B_CheckRespawn(player_t *player)
|
||||
|
||||
// Check if Sonic is busy first.
|
||||
// If he's doing any of these things, he probably doesn't want to see us.
|
||||
if (sonic->player->pflags & (PF_ROPEHANG|PF_CARRIED|PF_SLIDING|PF_ITEMHANG|PF_MACESPIN)
|
||||
if (sonic->player->pflags & (PF_ROPEHANG|PF_GLIDING|PF_CARRIED|PF_SLIDING|PF_ITEMHANG|PF_MACESPIN|PF_NIGHTSMODE)
|
||||
|| (sonic->player->panim != PA_IDLE && sonic->player->panim != PA_WALK))
|
||||
return false;
|
||||
|
||||
@@ -204,8 +213,7 @@ boolean B_CheckRespawn(player_t *player)
|
||||
return false;
|
||||
|
||||
// If you're dead, wait a few seconds to respawn.
|
||||
if (player->playerstate == PST_DEAD)
|
||||
{
|
||||
if (player->playerstate == PST_DEAD) {
|
||||
if (player->deadtimer > 4*TICRATE)
|
||||
return true;
|
||||
return false;
|
||||
@@ -233,17 +241,12 @@ void B_RespawnBot(INT32 playernum)
|
||||
|
||||
x = sonic->x;
|
||||
y = sonic->y;
|
||||
|
||||
if (sonic->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
if (sonic->eflags & MFE_VERTICALFLIP) {
|
||||
tails->eflags |= MFE_VERTICALFLIP;
|
||||
|
||||
z = sonic->z - FixedMul(512*FRACUNIT,sonic->scale);
|
||||
if (z < sonic->floorz)
|
||||
z = sonic->floorz;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
z = sonic->z + sonic->height + FixedMul(512*FRACUNIT,sonic->scale);
|
||||
if (z > sonic->ceilingz - sonic->height)
|
||||
z = sonic->ceilingz - sonic->height;
|
||||
@@ -255,7 +258,6 @@ void B_RespawnBot(INT32 playernum)
|
||||
tails->flags2 |= MF2_TWOD;
|
||||
if (sonic->eflags & MFE_UNDERWATER)
|
||||
tails->eflags |= MFE_UNDERWATER;
|
||||
|
||||
player->powers[pw_underwater] = sonic->player->powers[pw_underwater];
|
||||
player->powers[pw_spacetime] = sonic->player->powers[pw_spacetime];
|
||||
player->powers[pw_gravityboots] = sonic->player->powers[pw_gravityboots];
|
||||
|
||||
+58
-30
@@ -552,7 +552,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
||||
rsp->panim = (UINT8)players[i].panim; //panim_t
|
||||
|
||||
rsp->aiming = (angle_t)LONG(players[i].aiming);
|
||||
rsp->currentweapon = 0;
|
||||
rsp->currentweapon = LONG(players[i].currentweapon);
|
||||
rsp->ringweapons = LONG(players[i].ringweapons);
|
||||
|
||||
for (j = 0; j < NUMPOWERS; ++j)
|
||||
@@ -566,38 +566,36 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
||||
rsp->health = 0; // resynched with mo health
|
||||
rsp->lives = players[i].lives;
|
||||
rsp->continues = players[i].continues;
|
||||
rsp->scoreadd = 0;
|
||||
rsp->xtralife = 0;
|
||||
rsp->pity = 0;
|
||||
rsp->scoreadd = players[i].scoreadd;
|
||||
rsp->xtralife = players[i].xtralife;
|
||||
rsp->pity = players[i].pity;
|
||||
|
||||
rsp->skincolor = players[i].skincolor;
|
||||
rsp->skin = LONG(players[i].skin);
|
||||
|
||||
// Just in case Lua does something like
|
||||
// modify these at runtime
|
||||
// SRB2kart
|
||||
rsp->kartspeed = (UINT8)players[i].kartspeed;
|
||||
rsp->kartweight = (UINT8)players[i].kartweight;
|
||||
//
|
||||
|
||||
rsp->charflags = 0;
|
||||
rsp->charflags = (UINT32)LONG(players[i].charflags);
|
||||
|
||||
rsp->speed = (fixed_t)LONG(players[i].speed);
|
||||
rsp->jumping = 0;
|
||||
rsp->secondjump = 0;
|
||||
rsp->fly1 = 0;
|
||||
rsp->glidetime = 0;
|
||||
rsp->climbing = 0;
|
||||
rsp->jumping = players[i].jumping;
|
||||
rsp->secondjump = players[i].secondjump;
|
||||
rsp->fly1 = players[i].fly1;
|
||||
rsp->glidetime = (tic_t)LONG(players[i].glidetime);
|
||||
rsp->climbing = players[i].climbing;
|
||||
rsp->deadtimer = players[i].deadtimer;
|
||||
rsp->exiting = (tic_t)LONG(players[i].exiting);
|
||||
rsp->homing = 0;
|
||||
rsp->skidtime = 0;
|
||||
rsp->homing = players[i].homing;
|
||||
rsp->skidtime = (tic_t)LONG(players[i].skidtime);
|
||||
rsp->cmomx = (fixed_t)LONG(players[i].cmomx);
|
||||
rsp->cmomy = (fixed_t)LONG(players[i].cmomy);
|
||||
rsp->rmomx = (fixed_t)LONG(players[i].rmomx);
|
||||
rsp->rmomy = (fixed_t)LONG(players[i].rmomy);
|
||||
|
||||
rsp->weapondelay = 0;
|
||||
rsp->weapondelay = LONG(players[i].weapondelay);
|
||||
rsp->tossdelay = LONG(players[i].tossdelay);
|
||||
|
||||
rsp->starpostx = SHORT(players[i].starpostx);
|
||||
@@ -607,27 +605,27 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
||||
rsp->starposttime = (tic_t)LONG(players[i].starposttime);
|
||||
rsp->starpostangle = (angle_t)LONG(players[i].starpostangle);
|
||||
|
||||
rsp->maxlink = 0;
|
||||
rsp->dashspeed = 0;
|
||||
rsp->dashtime = 0;
|
||||
rsp->angle_pos = 0;
|
||||
rsp->old_angle_pos = 0;
|
||||
rsp->maxlink = LONG(players[i].maxlink);
|
||||
rsp->dashspeed = (fixed_t)LONG(players[i].dashspeed);
|
||||
rsp->dashtime = LONG(players[i].dashtime);
|
||||
rsp->angle_pos = (angle_t)LONG(players[i].angle_pos);
|
||||
rsp->old_angle_pos = (angle_t)LONG(players[i].old_angle_pos);
|
||||
rsp->bumpertime = (tic_t)LONG(players[i].bumpertime);
|
||||
rsp->flyangle = LONG(players[i].flyangle);
|
||||
rsp->drilltimer = 0;
|
||||
rsp->drilltimer = (tic_t)LONG(players[i].drilltimer);
|
||||
rsp->linkcount = LONG(players[i].linkcount);
|
||||
rsp->linktimer = (tic_t)LONG(players[i].linktimer);
|
||||
rsp->anotherflyangle = 0;
|
||||
rsp->anotherflyangle = LONG(players[i].anotherflyangle);
|
||||
rsp->nightstime = (tic_t)LONG(players[i].nightstime);
|
||||
rsp->drillmeter = 0;
|
||||
rsp->drilldelay = 0;
|
||||
rsp->bonustime = false;
|
||||
rsp->drillmeter = LONG(players[i].drillmeter);
|
||||
rsp->drilldelay = players[i].drilldelay;
|
||||
rsp->bonustime = players[i].bonustime;
|
||||
rsp->mare = players[i].mare;
|
||||
rsp->lastsidehit = 0;
|
||||
rsp->lastlinehit = 0;
|
||||
rsp->lastsidehit = SHORT(players[i].lastsidehit);
|
||||
rsp->lastlinehit = SHORT(players[i].lastlinehit);
|
||||
|
||||
rsp->losstime = 0;
|
||||
rsp->timeshit = 0;
|
||||
rsp->losstime = (tic_t)LONG(players[i].losstime);
|
||||
rsp->timeshit = players[i].timeshit;
|
||||
rsp->onconveyor = LONG(players[i].onconveyor);
|
||||
|
||||
rsp->jointime = (tic_t)LONG(players[i].jointime);
|
||||
@@ -683,6 +681,7 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||
players[i].panim = (UINT8)rsp->panim; //panim_t
|
||||
|
||||
players[i].aiming = (angle_t)LONG(rsp->aiming);
|
||||
players[i].currentweapon = LONG(rsp->currentweapon);
|
||||
players[i].ringweapons = LONG(rsp->ringweapons);
|
||||
|
||||
for (j = 0; j < NUMPOWERS; ++j)
|
||||
@@ -696,23 +695,35 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||
players[i].health = rsp->health;
|
||||
players[i].lives = rsp->lives;
|
||||
players[i].continues = rsp->continues;
|
||||
players[i].scoreadd = rsp->scoreadd;
|
||||
players[i].xtralife = rsp->xtralife;
|
||||
players[i].pity = rsp->pity;
|
||||
|
||||
players[i].skincolor = rsp->skincolor;
|
||||
players[i].skin = LONG(rsp->skin);
|
||||
|
||||
// Just in case Lua does something like
|
||||
// modify these at runtime
|
||||
players[i].kartspeed = (UINT8)rsp->kartspeed;
|
||||
players[i].kartweight = (UINT8)rsp->kartweight;
|
||||
|
||||
players[i].charflags = (UINT32)LONG(rsp->charflags);
|
||||
|
||||
players[i].speed = (fixed_t)LONG(rsp->speed);
|
||||
players[i].jumping = rsp->jumping;
|
||||
players[i].secondjump = rsp->secondjump;
|
||||
players[i].fly1 = rsp->fly1;
|
||||
players[i].glidetime = (tic_t)LONG(rsp->glidetime);
|
||||
players[i].climbing = rsp->climbing;
|
||||
players[i].deadtimer = rsp->deadtimer;
|
||||
players[i].exiting = (tic_t)LONG(rsp->exiting);
|
||||
players[i].homing = rsp->homing;
|
||||
players[i].skidtime = (tic_t)LONG(rsp->skidtime);
|
||||
players[i].cmomx = (fixed_t)LONG(rsp->cmomx);
|
||||
players[i].cmomy = (fixed_t)LONG(rsp->cmomy);
|
||||
players[i].rmomx = (fixed_t)LONG(rsp->rmomx);
|
||||
players[i].rmomy = (fixed_t)LONG(rsp->rmomy);
|
||||
|
||||
players[i].weapondelay = LONG(rsp->weapondelay);
|
||||
players[i].tossdelay = LONG(rsp->tossdelay);
|
||||
|
||||
players[i].starpostx = SHORT(rsp->starpostx);
|
||||
@@ -722,13 +733,27 @@ static void resynch_read_player(resynch_pak *rsp)
|
||||
players[i].starposttime = (tic_t)LONG(rsp->starposttime);
|
||||
players[i].starpostangle = (angle_t)LONG(rsp->starpostangle);
|
||||
|
||||
players[i].maxlink = LONG(rsp->maxlink);
|
||||
players[i].dashspeed = (fixed_t)LONG(rsp->dashspeed);
|
||||
players[i].dashtime = LONG(rsp->dashtime);
|
||||
players[i].angle_pos = (angle_t)LONG(rsp->angle_pos);
|
||||
players[i].old_angle_pos = (angle_t)LONG(rsp->old_angle_pos);
|
||||
players[i].bumpertime = (tic_t)LONG(rsp->bumpertime);
|
||||
players[i].flyangle = LONG(rsp->flyangle);
|
||||
players[i].drilltimer = (tic_t)LONG(rsp->drilltimer);
|
||||
players[i].linkcount = LONG(rsp->linkcount);
|
||||
players[i].linktimer = (tic_t)LONG(rsp->linktimer);
|
||||
players[i].anotherflyangle = LONG(rsp->anotherflyangle);
|
||||
players[i].nightstime = (tic_t)LONG(rsp->nightstime);
|
||||
players[i].drillmeter = LONG(rsp->drillmeter);
|
||||
players[i].drilldelay = rsp->drilldelay;
|
||||
players[i].bonustime = rsp->bonustime;
|
||||
players[i].mare = rsp->mare;
|
||||
players[i].lastsidehit = SHORT(rsp->lastsidehit);
|
||||
players[i].lastlinehit = SHORT(rsp->lastlinehit);
|
||||
|
||||
players[i].losstime = (tic_t)LONG(rsp->losstime);
|
||||
players[i].timeshit = rsp->timeshit;
|
||||
players[i].onconveyor = LONG(rsp->onconveyor);
|
||||
|
||||
players[i].jointime = (tic_t)LONG(rsp->jointime);
|
||||
@@ -3330,6 +3355,9 @@ void CL_ClearPlayer(INT32 playernum)
|
||||
{
|
||||
if (players[playernum].mo)
|
||||
{
|
||||
// Don't leave a NiGHTS ghost!
|
||||
if (UNLIKELY((players[playernum].pflags & PF_NIGHTSMODE) && players[playernum].mo->tracer))
|
||||
P_RemoveMobj(players[playernum].mo->tracer);
|
||||
P_RemoveMobj(players[playernum].mo);
|
||||
}
|
||||
|
||||
|
||||
@@ -3459,10 +3459,12 @@ static void Got_Teamchange(const UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
players[playernum].spectator = true;
|
||||
players[playernum].pflags &= ~PF_TAGIT;
|
||||
players[playernum].pflags &= ~PF_TAGGED;
|
||||
}
|
||||
else if (NetPacket.packet.newteam != 3) // .newteam == 1 or 2.
|
||||
{
|
||||
players[playernum].pflags |= PF_WANTSTOJOIN; //players[playernum].spectator = false;
|
||||
players[playernum].pflags &= ~PF_TAGGED;//Just in case.
|
||||
|
||||
if (NetPacket.packet.newteam == 1) //Make the player IT.
|
||||
players[playernum].pflags |= PF_TAGIT;
|
||||
|
||||
+47
-4
@@ -397,6 +397,8 @@ typedef struct player_s
|
||||
/// \todo Remove this. We don't need a second health definition for players.
|
||||
INT32 health;
|
||||
|
||||
SINT8 pity; // i pity the fool.
|
||||
INT32 currentweapon; // current weapon selected.
|
||||
INT32 ringweapons; // weapons currently obtained.
|
||||
|
||||
// Power ups. invinc and invis are tic counters.
|
||||
@@ -432,20 +434,37 @@ typedef struct player_s
|
||||
boolean skinlocal; // determines if localskin is a skin already loaded in the server
|
||||
|
||||
UINT32 score; // player score
|
||||
fixed_t dashspeed; // dashing speed
|
||||
INT32 dashtime; // tics dashing, used for rev sound
|
||||
|
||||
// SRB2kart
|
||||
UINT8 kartspeed; // Kart speed stat between 1 and 9
|
||||
UINT8 kartweight; // Kart weight stat between 1 and 9
|
||||
//
|
||||
|
||||
UINT32 charflags; // Extra abilities/settings for skins (combinable stuff)
|
||||
// See SF_ flags
|
||||
SINT8 lives;
|
||||
SINT8 continues; // continues that player has acquired
|
||||
|
||||
fixed_t speed; // Player's speed (distance formula of MOMX and MOMY values)
|
||||
SINT8 xtralife; // Ring Extra Life counter
|
||||
UINT8 gotcontinue; // Got continue from this stage?
|
||||
|
||||
fixed_t speed; // Player's speed (distance formula of MOMX and MOMY values)
|
||||
UINT8 jumping; // Jump counter
|
||||
UINT8 secondjump;
|
||||
|
||||
UINT8 fly1; // Tails flying
|
||||
UINT8 scoreadd; // Used for multiple enemy attack bonus
|
||||
tic_t glidetime; // Glide counter for thrust
|
||||
UINT8 climbing; // Climbing on the wall
|
||||
INT32 deadtimer; // End game if game over lasts too long
|
||||
tic_t exiting; // Exitlevel timer
|
||||
|
||||
UINT8 homing; // Are you homing?
|
||||
|
||||
tic_t skidtime; // Skid timer
|
||||
|
||||
////////////////////////////
|
||||
// Conveyor Belt Movement //
|
||||
////////////////////////////
|
||||
@@ -457,6 +476,7 @@ typedef struct player_s
|
||||
/////////////////////
|
||||
// Race Mode Stuff //
|
||||
/////////////////////
|
||||
INT16 numboxes; // Number of item boxes obtained for Race Mode
|
||||
INT16 totalring; // Total number of rings obtained for Race Mode
|
||||
tic_t realtime; // integer replacement for leveltime
|
||||
tic_t laptime[LAP__MAX];
|
||||
@@ -468,6 +488,7 @@ typedef struct player_s
|
||||
INT32 ctfteam; // 0 == Spectator, 1 == Red, 2 == Blue
|
||||
UINT16 gotflag; // 1 == Red, 2 == Blue Do you have the flag?
|
||||
|
||||
INT32 weapondelay; // Delay (if any) to fire the weapon again
|
||||
INT32 tossdelay; // Delay (if any) to toss a flag/emeralds again
|
||||
|
||||
// Starpost information
|
||||
@@ -481,18 +502,40 @@ typedef struct player_s
|
||||
/////////////////
|
||||
// NiGHTS Stuff//
|
||||
/////////////////
|
||||
angle_t angle_pos;
|
||||
angle_t old_angle_pos;
|
||||
|
||||
mobj_t *axis1;
|
||||
mobj_t *axis2;
|
||||
tic_t bumpertime; // Currently being bounced by MT_NIGHTSBUMPER
|
||||
INT32 flyangle;
|
||||
|
||||
tic_t drilltimer;
|
||||
INT32 linkcount;
|
||||
tic_t linktimer;
|
||||
|
||||
INT32 anotherflyangle;
|
||||
tic_t nightstime; // How long you can fly as NiGHTS.
|
||||
|
||||
INT32 drillmeter;
|
||||
UINT8 drilldelay;
|
||||
boolean bonustime; // Capsule destroyed, now it's bonus time!
|
||||
mobj_t *capsule; // Go inside the capsule
|
||||
UINT8 mare; // Current mare
|
||||
|
||||
// Statistical purposes.
|
||||
tic_t marebegunat; // Leveltime when mare begun
|
||||
tic_t startedtime; // Time which you started this mare with.
|
||||
tic_t finishedtime; // Time it took you to finish the mare (used for display)
|
||||
INT16 finishedrings; // The rings you had left upon finishing the mare
|
||||
UINT32 marescore; // SRB2Kart: Battle score
|
||||
UINT32 lastmarescore; // score for the last mare
|
||||
UINT8 lastmare; // previous mare
|
||||
INT32 maxlink; // maximum link obtained
|
||||
UINT8 texttimer; // nights_texttime should not be local
|
||||
UINT8 textvar; // which line of NiGHTS text to show -- let's not use cheap hacks
|
||||
|
||||
INT16 lastsidehit, lastlinehit;
|
||||
|
||||
tic_t losstime;
|
||||
UINT8 timeshit; // That's TIMES HIT, not TIME SHIT, you doofus!
|
||||
|
||||
INT32 onconveyor; // You are on a conveyor belt if nonzero
|
||||
|
||||
|
||||
@@ -178,6 +178,8 @@ extern cutscene_t *cutscenes[128];
|
||||
extern INT16 nextmapoverride;
|
||||
extern boolean skipstats;
|
||||
|
||||
extern UINT32 totalrings; // Total # of rings in a level
|
||||
|
||||
// Fun extra stuff
|
||||
extern INT16 lastmap; // Last level you were at (returning from special stages).
|
||||
extern mobj_t *redflag, *blueflag; // Pointers to physical flags
|
||||
|
||||
+17
-1
@@ -715,6 +715,13 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
|
||||
if (!(demoflags & DF_GHOST))
|
||||
return; // No ghost data to write.
|
||||
|
||||
if (ghost->player && ghost->player->pflags & PF_NIGHTSMODE && ghost->tracer)
|
||||
{
|
||||
// We're talking about the NiGHTS thing, not the normal platforming thing!
|
||||
ziptic |= GZT_NIGHTS;
|
||||
ghost = ghost->tracer;
|
||||
}
|
||||
|
||||
ziptic_p = demobuf.p++; // the ziptic, written at the end of this function
|
||||
|
||||
#define MAXMOM (0x7FFF<<8)
|
||||
@@ -929,6 +936,7 @@ void G_ConsGhostTic(INT32 playernum)
|
||||
fixed_t px,py,pz,gx,gy,gz;
|
||||
mobj_t *testmo;
|
||||
fixed_t syncleeway;
|
||||
boolean nightsfail = false;
|
||||
|
||||
if (!(demoflags & DF_GHOST))
|
||||
return; // No ghost data to use.
|
||||
@@ -968,6 +976,14 @@ void G_ConsGhostTic(INT32 playernum)
|
||||
if (ziptic & GZT_SPRITE)
|
||||
demobuf.p++;
|
||||
|
||||
if (ziptic & GZT_NIGHTS)
|
||||
{
|
||||
if (!testmo || !testmo->player || !(testmo->player->pflags & PF_NIGHTSMODE) || !testmo->tracer)
|
||||
nightsfail = true;
|
||||
else
|
||||
testmo = testmo->tracer;
|
||||
}
|
||||
|
||||
if (ziptic & GZT_EXTRA)
|
||||
{ // But wait, there's more!
|
||||
ziptic = READUINT8(demobuf.p);
|
||||
@@ -1050,7 +1066,7 @@ void G_ConsGhostTic(INT32 playernum)
|
||||
gy = oldghost[playernum].y;
|
||||
gz = oldghost[playernum].z;
|
||||
|
||||
if (abs(px-gx) > syncleeway || abs(py-gy) > syncleeway || abs(pz-gz) > syncleeway)
|
||||
if (nightsfail || abs(px-gx) > syncleeway || abs(py-gy) > syncleeway || abs(pz-gz) > syncleeway)
|
||||
{
|
||||
ghostext[playernum].desyncframes++;
|
||||
|
||||
|
||||
+12
-2
@@ -111,6 +111,7 @@ INT32 displayplayers[MAXSPLITSCREENPLAYERS] = {}; // view being displayed
|
||||
|
||||
tic_t gametic = 0;
|
||||
tic_t levelstarttic = 0; // gametic at level start
|
||||
UINT32 totalrings = 0; // for intermission
|
||||
INT16 lastmap = 0; // last level you were at (returning from special stages)
|
||||
tic_t timeinmap = 0; // Ticker for time spent in level (used for levelcard display)
|
||||
|
||||
@@ -2105,6 +2106,7 @@ void G_PlayerReborn(INT32 player)
|
||||
UINT8 kartspeed;
|
||||
UINT8 kartweight;
|
||||
//
|
||||
INT32 charflags;
|
||||
INT32 pflags;
|
||||
INT32 ctfteam;
|
||||
INT32 starposttime;
|
||||
@@ -2114,6 +2116,7 @@ void G_PlayerReborn(INT32 player)
|
||||
INT32 starpostnum;
|
||||
INT32 starpostangle;
|
||||
INT32 exiting;
|
||||
INT16 numboxes;
|
||||
INT16 totalring;
|
||||
UINT8 laps;
|
||||
UINT8 mare;
|
||||
@@ -2125,6 +2128,7 @@ void G_PlayerReborn(INT32 player)
|
||||
UINT8 splitscreenindex;
|
||||
boolean spectator;
|
||||
INT16 bot;
|
||||
SINT8 pity;
|
||||
|
||||
// SRB2kart
|
||||
INT32 starpostwp;
|
||||
@@ -2158,12 +2162,13 @@ void G_PlayerReborn(INT32 player)
|
||||
jointime = players[player].jointime;
|
||||
splitscreenindex = players[player].splitscreenindex;
|
||||
spectator = players[player].spectator;
|
||||
pflags = (players[player].pflags & (PF_TIMEOVER|PF_FLIPCAM|PF_TAGIT|PF_ANALOGMODE|PF_WANTSTOJOIN));
|
||||
pflags = (players[player].pflags & (PF_TIMEOVER|PF_FLIPCAM|PF_TAGIT|PF_TAGGED|PF_ANALOGMODE|PF_WANTSTOJOIN));
|
||||
|
||||
// As long as we're not in multiplayer, carry over cheatcodes from map to map
|
||||
if (!(netgame || multiplayer))
|
||||
pflags |= (players[player].pflags & (PF_GODMODE|PF_NOCLIP|PF_INVIS));
|
||||
|
||||
numboxes = players[player].numboxes;
|
||||
laps = players[player].laps;
|
||||
totalring = players[player].totalring;
|
||||
|
||||
@@ -2175,6 +2180,7 @@ void G_PlayerReborn(INT32 player)
|
||||
kartspeed = players[player].kartspeed;
|
||||
kartweight = players[player].kartweight;
|
||||
//
|
||||
charflags = players[player].charflags;
|
||||
|
||||
starposttime = players[player].starposttime;
|
||||
starpostx = players[player].starpostx;
|
||||
@@ -2186,6 +2192,7 @@ void G_PlayerReborn(INT32 player)
|
||||
|
||||
mare = players[player].mare;
|
||||
bot = players[player].bot;
|
||||
pity = players[player].pity;
|
||||
|
||||
// SRB2kart
|
||||
if (leveltime <= starttime || spectator == true)
|
||||
@@ -2274,6 +2281,7 @@ void G_PlayerReborn(INT32 player)
|
||||
p->kartspeed = kartspeed;
|
||||
p->kartweight = kartweight;
|
||||
//
|
||||
p->charflags = charflags;
|
||||
|
||||
p->starposttime = starposttime;
|
||||
p->starpostx = starpostx;
|
||||
@@ -2283,6 +2291,7 @@ void G_PlayerReborn(INT32 player)
|
||||
p->starpostangle = starpostangle;
|
||||
p->exiting = exiting;
|
||||
|
||||
p->numboxes = numboxes;
|
||||
p->laps = laps;
|
||||
p->totalring = totalring;
|
||||
|
||||
@@ -2294,6 +2303,7 @@ void G_PlayerReborn(INT32 player)
|
||||
p->mare = mare;
|
||||
if (bot)
|
||||
p->bot = 1; // reset to AI-controlled
|
||||
p->pity = pity;
|
||||
|
||||
// SRB2kart
|
||||
p->kartstuff[k_starpostwp] = starpostwp; // TODO: get these out of kartstuff, it causes desync
|
||||
@@ -4024,7 +4034,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
|
||||
players[i].awayviewmobj = NULL;
|
||||
|
||||
// The latter two should clear by themselves, but just in case
|
||||
players[i].pflags &= ~(PF_TAGIT|PF_FULLSTASIS);
|
||||
players[i].pflags &= ~(PF_TAGIT|PF_TAGGED|PF_FULLSTASIS);
|
||||
|
||||
// Clear cheatcodes too, just in case.
|
||||
players[i].pflags &= ~(PF_GODMODE|PF_NOCLIP|PF_INVIS);
|
||||
|
||||
@@ -871,6 +871,7 @@ static int lib_pResetScore(lua_State *L)
|
||||
NOHUD
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
P_ResetScore(player);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ int player_aiming_setter(lua_State *L);
|
||||
int player_powers_noset(lua_State *L);
|
||||
int player_kartstuff_noset(lua_State *L);
|
||||
int player_skincolor_setter(lua_State *L);
|
||||
int player_axis_setter(lua_State *L);
|
||||
int player_capsule_setter(lua_State *L);
|
||||
int player_awayviewmobj_setter(lua_State *L);
|
||||
int player_awayviewtics_setter(lua_State *L);
|
||||
int player_bot_noset(lua_State *L);
|
||||
@@ -64,6 +66,8 @@ static const udata_field_t player_fields[] = {
|
||||
FIELD(player_t, viewheight, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
FIELD(player_t, aiming, udatalib_getter_angle, player_aiming_setter),
|
||||
FIELD(player_t, health, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, pity, udatalib_getter_sint8, udatalib_setter_sint8),
|
||||
FIELD(player_t, currentweapon, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, ringweapons, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, powers, udatalib_getter_powers, player_powers_noset),
|
||||
FIELD(player_t, kartstuff, udatalib_getter_kartstuff, player_kartstuff_noset),
|
||||
@@ -75,22 +79,37 @@ static const udata_field_t player_fields[] = {
|
||||
FIELD(player_t, skincolor, udatalib_getter_uint8, player_skincolor_setter),
|
||||
FIELD(player_t, localskin, player_localskin_getter, player_localskin_setter),
|
||||
FIELD(player_t, score, udatalib_getter_uint32, udatalib_setter_uint32),
|
||||
FIELD(player_t, dashspeed, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
FIELD(player_t, dashtime, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, kartspeed, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, kartweight, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, charflags, udatalib_getter_uint32, udatalib_setter_uint32),
|
||||
FIELD(player_t, lives, udatalib_getter_sint8, udatalib_setter_sint8),
|
||||
FIELD(player_t, continues, udatalib_getter_sint8, udatalib_setter_sint8),
|
||||
FIELD(player_t, xtralife, udatalib_getter_sint8, udatalib_setter_sint8),
|
||||
FIELD(player_t, gotcontinue, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, speed, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
FIELD(player_t, jumping, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(player_t, secondjump, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, fly1, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, scoreadd, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, glidetime, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, climbing, udatalib_getter_uint8, udatalib_setter_sint8), // For whatever reason, original setter casted to INT32...
|
||||
FIELD(player_t, deadtimer, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, exiting, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, homing, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, skidtime, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, cmomx, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
FIELD(player_t, cmomy, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
FIELD(player_t, rmomx, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
FIELD(player_t, rmomy, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
FIELD(player_t, numboxes, udatalib_getter_int16, udatalib_setter_int16),
|
||||
FIELD(player_t, totalring, udatalib_getter_int16, udatalib_setter_int16),
|
||||
FIELD(player_t, realtime, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, laps, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, ctfteam, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, gotflag, udatalib_getter_uint16, udatalib_setter_uint16),
|
||||
FIELD(player_t, weapondelay, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, tossdelay, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, starpostx, udatalib_getter_int16, udatalib_setter_int16),
|
||||
FIELD(player_t, starposty, udatalib_getter_int16, udatalib_setter_int16),
|
||||
@@ -98,13 +117,36 @@ static const udata_field_t player_fields[] = {
|
||||
FIELD(player_t, starpostnum, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, starposttime, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, starpostangle, udatalib_getter_angle, udatalib_setter_angle),
|
||||
FIELD(player_t, angle_pos, udatalib_getter_angle, udatalib_setter_angle),
|
||||
FIELD(player_t, old_angle_pos, udatalib_getter_angle, udatalib_setter_angle),
|
||||
FIELD(player_t, axis1, udatalib_getter_mobj, player_axis_setter),
|
||||
FIELD(player_t, axis2, udatalib_getter_mobj, player_axis_setter),
|
||||
FIELD(player_t, bumpertime, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, flyangle, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, drilltimer, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, linkcount, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, linktimer, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, anotherflyangle, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, nightstime, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, drillmeter, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, drilldelay, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, bonustime, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(player_t, capsule, udatalib_getter_mobj, player_capsule_setter),
|
||||
FIELD(player_t, mare, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, marebegunat, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, startedtime, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, finishedtime, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, finishedrings, udatalib_getter_int16, udatalib_setter_int16),
|
||||
FIELD(player_t, marescore, udatalib_getter_uint32, udatalib_setter_uint32),
|
||||
FIELD(player_t, lastmarescore, udatalib_getter_uint32, udatalib_setter_uint32),
|
||||
FIELD(player_t, lastmare, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, maxlink, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, texttimer, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, textvar, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, lastsidehit, udatalib_getter_int16, udatalib_setter_int16),
|
||||
FIELD(player_t, lastlinehit, udatalib_getter_int16, udatalib_setter_int16),
|
||||
FIELD(player_t, losstime, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, timeshit, udatalib_getter_uint8, udatalib_setter_uint8), // Haha, time shit, funni
|
||||
FIELD(player_t, onconveyor, udatalib_getter_int32, udatalib_setter_int32),
|
||||
FIELD(player_t, awayviewmobj, udatalib_getter_mobj, player_awayviewmobj_setter),
|
||||
FIELD(player_t, awayviewtics, udatalib_getter_int32, player_awayviewtics_setter),
|
||||
@@ -270,6 +312,29 @@ int player_localskin_setter(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int player_axis_setter(lua_State *L)
|
||||
{
|
||||
mobj_t **axis;
|
||||
|
||||
UDATALIB_GETFIELD(mobj_t*, axis);
|
||||
|
||||
P_SetTarget(axis, *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int player_capsule_setter(lua_State *L)
|
||||
{
|
||||
player_t *plr = GETPLAYER();
|
||||
|
||||
mobj_t *mo = NULL;
|
||||
if (!lua_isnil(L, 2))
|
||||
mo = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
P_SetTarget(&plr->capsule, mo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Probably can do same thing as with axis1 and axis2
|
||||
int player_awayviewmobj_setter(lua_State *L)
|
||||
{
|
||||
|
||||
+18
-8
@@ -773,6 +773,9 @@ boolean OP_FreezeObjectplace(void)
|
||||
if (!objectplacing)
|
||||
return false;
|
||||
|
||||
if ((maptol & TOL_NIGHTS) && (players[consoleplayer].pflags & PF_NIGHTSMODE))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -791,6 +794,7 @@ void OP_NightsObjectplace(player_t *player)
|
||||
mapthing_t *mt;
|
||||
|
||||
player->nightstime = 3*TICRATE;
|
||||
player->drillmeter = TICRATE;
|
||||
|
||||
if (player->pflags & PF_ATTACKDOWN)
|
||||
{
|
||||
@@ -805,7 +809,7 @@ void OP_NightsObjectplace(player_t *player)
|
||||
// This places a hoop!
|
||||
if (cmd->buttons & BT_ATTACK)
|
||||
{
|
||||
UINT16 angle = 0;
|
||||
UINT16 angle = (UINT16)(player->anotherflyangle % 360);
|
||||
INT16 temp = (INT16)FixedInt(AngleFixed(player->mo->angle)); // Traditional 2D Angle
|
||||
sector_t *sec = player->mo->subsector->sector;
|
||||
fixed_t fheight = P_GetSectorFloorZAt(sec, (player->mo->x & 0xFFFF0000), (player->mo->y & 0xFFFF0000));
|
||||
@@ -817,7 +821,10 @@ void OP_NightsObjectplace(player_t *player)
|
||||
// Tilt
|
||||
mt->angle = (INT16)FixedInt(FixedDiv(angle*FRACUNIT, 360*(FRACUNIT/256)));
|
||||
|
||||
temp -= 90;
|
||||
if (player->anotherflyangle < 90 || player->anotherflyangle > 270)
|
||||
temp -= 90;
|
||||
else
|
||||
temp += 90;
|
||||
temp %= 360;
|
||||
|
||||
mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS);
|
||||
@@ -859,14 +866,14 @@ void OP_NightsObjectplace(player_t *player)
|
||||
CONS_Alert(CONS_WARNING, "Set op_mapthingnum first!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!OP_HeightOkay(player, false))
|
||||
return;
|
||||
|
||||
angle = 0;
|
||||
|
||||
if (!(player->mo->target->flags2 & MF2_AMBUSH))
|
||||
if (player->mo->target->flags2 & MF2_AMBUSH)
|
||||
angle = (UINT16)player->anotherflyangle;
|
||||
else
|
||||
{
|
||||
angle = (UINT16)((360-player->anotherflyangle) % 360);
|
||||
if (angle > 90 && angle < 270)
|
||||
{
|
||||
angle += 180;
|
||||
@@ -900,7 +907,7 @@ void OP_ObjectplaceMovement(player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
|
||||
if (netgame)
|
||||
if (!player->climbing && (netgame || (player->pflags & PF_SPINNING)))
|
||||
player->mo->angle = (cmd->angleturn << TICCMD_REDUCE);
|
||||
|
||||
ticruned++;
|
||||
@@ -1050,6 +1057,9 @@ void Command_ObjectPlace_f(void)
|
||||
{
|
||||
objectplacing = true;
|
||||
|
||||
if ((players[0].pflags & PF_NIGHTSMODE))
|
||||
return;
|
||||
|
||||
if (!COM_CheckParm("-silent"))
|
||||
{
|
||||
HU_SetCEchoFlags(V_RETURN8|V_MONOSPACE);
|
||||
@@ -1118,7 +1128,7 @@ void Command_ObjectPlace_f(void)
|
||||
|
||||
// Don't touch the NiGHTS Objectplace stuff.
|
||||
// ... or if the mo mysteriously vanished.
|
||||
if (!players[0].mo)
|
||||
if (!players[0].mo || (players[0].pflags & PF_NIGHTSMODE))
|
||||
return;
|
||||
|
||||
// If still in dummy state, get out of it.
|
||||
|
||||
+4
-1
@@ -5063,7 +5063,7 @@ void A_CrawlaCommanderThink(void *thing)
|
||||
if (actor->target->player && actor->health > 1)
|
||||
{
|
||||
if (dist < FixedMul(128*FRACUNIT, actor->scale)
|
||||
&& (actor->target->player->pflags & PF_JUMPED))
|
||||
&& ((actor->target->player->pflags & PF_JUMPED) || (actor->target->player->pflags & PF_SPINNING)))
|
||||
{
|
||||
// Auugh! He's trying to kill you! Strafe! STRAAAAFFEEE!!
|
||||
if (actor->target->momx || actor->target->momy)
|
||||
@@ -5537,6 +5537,7 @@ void A_RecyclePowers(void *thing)
|
||||
|
||||
UINT16 powers[MAXPLAYERS][NUMPOWERS];
|
||||
INT32 weapons[MAXPLAYERS];
|
||||
INT32 weaponheld[MAXPLAYERS];
|
||||
|
||||
if (LUA_CallAction(A_RECYCLEPOWERS, actor))
|
||||
return;
|
||||
@@ -5563,6 +5564,7 @@ void A_RecyclePowers(void *thing)
|
||||
powers[i][k] = players[i].powers[k];
|
||||
//1.1: ring weapons too
|
||||
weapons[i] = players[i].ringweapons;
|
||||
weaponheld[i] = players[i].currentweapon;
|
||||
|
||||
j++;
|
||||
}
|
||||
@@ -5610,6 +5612,7 @@ void A_RecyclePowers(void *thing)
|
||||
|
||||
//1.1: weapon rings too
|
||||
players[recv_pl].ringweapons = weapons[send_pl];
|
||||
players[recv_pl].currentweapon = weaponheld[send_pl];
|
||||
|
||||
P_SpawnShieldOrb(&players[recv_pl]);
|
||||
if (P_IsLocalPlayer(&players[recv_pl]))
|
||||
|
||||
+1
-1
@@ -2256,7 +2256,7 @@ void T_RaiseSector(levelspecthink_t *raise)
|
||||
continue;
|
||||
|
||||
// Option to require spindashing.
|
||||
if (raise->vars[1])
|
||||
if (raise->vars[1] && !(thing->player->pflags & PF_STARTDASH))
|
||||
continue;
|
||||
|
||||
if (!(thing->z == P_GetSpecialTopZ(thing, raise->sector, sector)))
|
||||
|
||||
+209
-58
@@ -111,19 +111,35 @@ void P_DoNightsScore(player_t *player)
|
||||
player = &players[consoleplayer];
|
||||
|
||||
// Individual link counts
|
||||
++player->linkcount;
|
||||
|
||||
if (++player->linkcount > player->maxlink)
|
||||
player->maxlink = player->linkcount;
|
||||
player->linktimer = 2*TICRATE;
|
||||
|
||||
if (player->linkcount < 10)
|
||||
{
|
||||
P_AddPlayerScore(player, player->linkcount*10);
|
||||
P_SetMobjState(dummymo, dummymo->info->spawnstate+player->linkcount-1);
|
||||
if (player->bonustime)
|
||||
{
|
||||
P_AddPlayerScore(player, player->linkcount*20);
|
||||
P_SetMobjState(dummymo, dummymo->info->xdeathstate+player->linkcount-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
P_AddPlayerScore(player, player->linkcount*10);
|
||||
P_SetMobjState(dummymo, dummymo->info->spawnstate+player->linkcount-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
P_AddPlayerScore(player, 100);
|
||||
P_SetMobjState(dummymo, dummymo->info->spawnstate+9);
|
||||
if (player->bonustime)
|
||||
{
|
||||
P_AddPlayerScore(player, 200);
|
||||
P_SetMobjState(dummymo, dummymo->info->xdeathstate+9);
|
||||
}
|
||||
else
|
||||
{
|
||||
P_AddPlayerScore(player, 100);
|
||||
P_SetMobjState(dummymo, dummymo->info->spawnstate+9);
|
||||
}
|
||||
}
|
||||
|
||||
// Hoops are the only things that should add to your drill meter
|
||||
@@ -815,37 +831,50 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
{
|
||||
S_StartSound(toucher, special->info->seesound);
|
||||
|
||||
// More like a spring
|
||||
angle_t fa;
|
||||
fixed_t xspeed, yspeed;
|
||||
const fixed_t speed = FixedMul(FixedDiv(special->info->speed*FRACUNIT,75*FRACUNIT), FixedSqrt(FixedMul(toucher->scale,special->scale)));
|
||||
if (UNLIKELY(player->pflags & PF_NIGHTSMODE))
|
||||
{
|
||||
player->bumpertime = TICRATE/2;
|
||||
if (special->threshold > 0)
|
||||
player->flyangle = (special->threshold*30)-1;
|
||||
else
|
||||
player->flyangle = special->threshold;
|
||||
|
||||
player->bumpertime = TICRATE/2;
|
||||
player->speed = FixedMul(special->info->speed, special->scale);
|
||||
toucher->z = special->z+(special->height/4);
|
||||
}
|
||||
else // More like a spring
|
||||
{
|
||||
angle_t fa;
|
||||
fixed_t xspeed, yspeed;
|
||||
const fixed_t speed = FixedMul(FixedDiv(special->info->speed*FRACUNIT,75*FRACUNIT), FixedSqrt(FixedMul(toucher->scale,special->scale)));
|
||||
|
||||
P_UnsetThingPosition(toucher);
|
||||
toucher->x = special->x;
|
||||
toucher->y = special->y;
|
||||
P_SetThingPosition(toucher);
|
||||
toucher->z = special->z+(special->height/4);
|
||||
player->bumpertime = TICRATE/2;
|
||||
|
||||
if (special->threshold > 0)
|
||||
fa = (FixedAngle(((special->threshold*30)-1)*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK;
|
||||
else
|
||||
fa = 0;
|
||||
P_UnsetThingPosition(toucher);
|
||||
toucher->x = special->x;
|
||||
toucher->y = special->y;
|
||||
P_SetThingPosition(toucher);
|
||||
toucher->z = special->z+(special->height/4);
|
||||
|
||||
xspeed = FixedMul(FINECOSINE(fa),speed);
|
||||
yspeed = FixedMul(FINESINE(fa),speed);
|
||||
if (special->threshold > 0)
|
||||
fa = (FixedAngle(((special->threshold*30)-1)*FRACUNIT)>>ANGLETOFINESHIFT) & FINEMASK;
|
||||
else
|
||||
fa = 0;
|
||||
|
||||
P_InstaThrust(toucher, special->angle, xspeed/10);
|
||||
toucher->momz = yspeed/11;
|
||||
xspeed = FixedMul(FINECOSINE(fa),speed);
|
||||
yspeed = FixedMul(FINESINE(fa),speed);
|
||||
|
||||
toucher->angle = special->angle;
|
||||
P_InstaThrust(toucher, special->angle, xspeed/10);
|
||||
toucher->momz = yspeed/11;
|
||||
|
||||
P_ForceLocalAngle(player, toucher->angle);
|
||||
toucher->angle = special->angle;
|
||||
|
||||
P_ResetPlayer(player);
|
||||
P_ForceLocalAngle(player, toucher->angle);
|
||||
|
||||
P_SetPlayerMobjState(toucher, S_KART_STND1); // SRB2kart - was S_PLAY_FALL1
|
||||
P_ResetPlayer(player);
|
||||
|
||||
P_SetPlayerMobjState(toucher, S_KART_STND1); // SRB2kart - was S_PLAY_FALL1
|
||||
}
|
||||
}
|
||||
return;
|
||||
case MT_NIGHTSWING:
|
||||
@@ -881,6 +910,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
P_DoNightsScore(player);
|
||||
|
||||
// Hoops are the only things that should add to the drill meter
|
||||
// Also, one tic's worth of drill is too much.
|
||||
if (player->bot)
|
||||
players[consoleplayer].drillmeter += TICRATE/2;
|
||||
else
|
||||
player->drillmeter += TICRATE/2;
|
||||
|
||||
// Play hoop sound -- pick one depending on the current link.
|
||||
if (player->linkcount <= 5)
|
||||
S_StartSound(toucher, sfx_hoop1);
|
||||
@@ -888,7 +924,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
S_StartSound(toucher, sfx_hoop2);
|
||||
else
|
||||
S_StartSound(toucher, sfx_hoop3);
|
||||
|
||||
return;
|
||||
|
||||
// ***** //
|
||||
@@ -1019,6 +1054,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
toucher->momx = P_ReturnThrustX(special, angle, touchspeed);
|
||||
toucher->momy = P_ReturnThrustY(special, angle, touchspeed);
|
||||
toucher->momz = -toucher->momz;
|
||||
if (player->pflags & PF_GLIDING)
|
||||
{
|
||||
player->pflags &= ~(PF_GLIDING|PF_JUMPED);
|
||||
P_SetPlayerMobjState(toucher, S_KART_STND1); // SRB2kart - was S_PLAY_FALL1
|
||||
}
|
||||
|
||||
// Play a bounce sound?
|
||||
S_StartSound(toucher, special->info->painsound);
|
||||
@@ -1081,12 +1121,17 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
toucher->momx = P_ReturnThrustX(special, special->angle, touchspeed);
|
||||
toucher->momy = P_ReturnThrustY(special, special->angle, touchspeed);
|
||||
toucher->momz = -toucher->momz;
|
||||
if (player->pflags & PF_GLIDING)
|
||||
{
|
||||
player->pflags &= ~(PF_GLIDING|PF_JUMPED);
|
||||
P_SetPlayerMobjState(toucher, S_KART_STND1); // SRB2kart - was S_PLAY_FALL1
|
||||
}
|
||||
|
||||
// Play a bounce sound?
|
||||
S_StartSound(toucher, special->info->painsound);
|
||||
return;
|
||||
}
|
||||
else if ((player->pflags & PF_JUMPED)
|
||||
else if (UNLIKELY((player->pflags & PF_NIGHTSMODE) && (player->pflags & PF_DRILLING)) || (player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|
||||
|| player->powers[pw_invulnerability] || player->powers[pw_super]) // Do you possess the ability to subdue the object?
|
||||
{
|
||||
// Shatter the shield!
|
||||
@@ -1535,7 +1580,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
if (target->flags & MF_MONITOR || target->type == MT_RANDOMITEM)
|
||||
{
|
||||
P_SetTarget(&target->target, source);
|
||||
|
||||
source->player->numboxes++;
|
||||
if (cv_itemrespawn.value && (netgame || multiplayer))
|
||||
{
|
||||
target->fuse = cv_itemrespawntime.value*TICRATE + 2; // Random box generation
|
||||
@@ -1949,7 +1994,68 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
Graue 12-22-2003 */
|
||||
}
|
||||
|
||||
static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage)
|
||||
static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
tic_t oldnightstime = player->nightstime;
|
||||
|
||||
if (!player->powers[pw_flashing]
|
||||
&& !(player->pflags & PF_GODMODE))
|
||||
{
|
||||
angle_t fa;
|
||||
|
||||
player->angle_pos = player->old_angle_pos;
|
||||
player->speed /= 5;
|
||||
player->flyangle += 180; // Shuffle's BETTERNIGHTSMOVEMENT?
|
||||
player->flyangle %= 360;
|
||||
|
||||
if (G_RaceGametype())
|
||||
player->drillmeter -= 5*20;
|
||||
else
|
||||
{
|
||||
if (source && source->player)
|
||||
{
|
||||
if (player->nightstime > 20*TICRATE)
|
||||
player->nightstime -= 20*TICRATE;
|
||||
else
|
||||
player->nightstime = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->nightstime > 5*TICRATE)
|
||||
player->nightstime -= 5*TICRATE;
|
||||
else
|
||||
player->nightstime = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (player->pflags & PF_TRANSFERTOCLOSEST)
|
||||
{
|
||||
target->momx = -target->momx;
|
||||
target->momy = -target->momy;
|
||||
}
|
||||
else
|
||||
{
|
||||
fa = player->old_angle_pos>>ANGLETOFINESHIFT;
|
||||
|
||||
target->momx = FixedMul(FINECOSINE(fa),target->target->radius);
|
||||
target->momy = FixedMul(FINESINE(fa),target->target->radius);
|
||||
}
|
||||
|
||||
player->powers[pw_flashing] = K_GetKartFlashing(player);
|
||||
P_SetMobjState(target->tracer, S_NIGHTSHURT1);
|
||||
S_StartSound(target, sfx_nghurt);
|
||||
|
||||
if (oldnightstime > 10*TICRATE
|
||||
&& player->nightstime < 10*TICRATE)
|
||||
{
|
||||
//S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH
|
||||
S_ChangeMusicInternal("drown",false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
(void)damage; //unused parm
|
||||
@@ -2017,13 +2123,14 @@ static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, IN
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage)
|
||||
static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
|
||||
// Tag handling
|
||||
if (G_TagGametype())
|
||||
return P_TagDamage(target, inflictor, source, damage);
|
||||
|
||||
if (G_GametypeHasTeams()) // CTF + Team Match
|
||||
else if (G_GametypeHasTeams()) // CTF + Team Match
|
||||
{
|
||||
// Don't allow players on the same team to hurt one another,
|
||||
// unless cv_friendlyfire is on.
|
||||
@@ -2042,12 +2149,17 @@ static boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *sou
|
||||
}
|
||||
}
|
||||
|
||||
// Add pity.
|
||||
if (!player->powers[pw_flashing] && !player->powers[pw_invulnerability] && !player->powers[pw_super]
|
||||
&& source->player->score > player->score)
|
||||
player->pity++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void P_KillPlayer(player_t *player, mobj_t *source)
|
||||
{
|
||||
player->pflags &= ~(PF_CARRIED|PF_SLIDING|PF_ITEMHANG|PF_MACESPIN|PF_ROPEHANG);
|
||||
player->pflags &= ~(PF_CARRIED|PF_SLIDING|PF_ITEMHANG|PF_MACESPIN|PF_ROPEHANG|PF_NIGHTSMODE);
|
||||
|
||||
// Burst weapons and emeralds in Match/CTF only
|
||||
if (source && (G_BattleGametype()))
|
||||
@@ -2274,10 +2386,29 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
if (player->exiting)
|
||||
return false;
|
||||
|
||||
if (UNLIKELY(maptol & TOL_NIGHTS))
|
||||
if (UNLIKELY(!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS)))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (UNLIKELY(player->pflags & PF_NIGHTSMODE)) // NiGHTS damage handling
|
||||
{
|
||||
if (!force)
|
||||
{
|
||||
if (source == target)
|
||||
return false; // Don't hit yourself with your own paraloop, baka
|
||||
if (source && source->player && !cv_friendlyfire.value
|
||||
&& (gametype == GT_COOP
|
||||
|| (G_GametypeHasTeams() && target->player->ctfteam == source->player->ctfteam)))
|
||||
return false; // Don't run eachother over in special stages and team games and such
|
||||
}
|
||||
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage))
|
||||
return true;
|
||||
|
||||
P_NiGHTSDamage(target, source); // -5s :(
|
||||
return true;
|
||||
}
|
||||
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage))
|
||||
return true;
|
||||
|
||||
@@ -2463,7 +2594,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
|
||||
if (player->mo->health <= 1)
|
||||
num_rings = 5;
|
||||
|
||||
if (num_rings > 32)
|
||||
if (num_rings > 32 && !(player->pflags & PF_NIGHTSFALL))
|
||||
num_rings = 32;
|
||||
|
||||
if (player->powers[pw_emeralds])
|
||||
@@ -2496,35 +2627,55 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
|
||||
// Angle offset by player angle, then slightly offset by amount of rings
|
||||
fa = ((i*FINEANGLES/16) + (player->mo->angle>>ANGLETOFINESHIFT) - ((num_rings-1)*FINEANGLES/32)) & FINEMASK;
|
||||
|
||||
fixed_t momxy, momz; // base horizonal/vertical thrusts
|
||||
|
||||
if (i > 15)
|
||||
// Make rings spill out around the player in 16 directions like SA, but spill like Sonic 2.
|
||||
// Technically a non-SA way of spilling rings. They just so happen to be a little similar.
|
||||
if (player->pflags & PF_NIGHTSFALL)
|
||||
{
|
||||
momxy = 3*FRACUNIT;
|
||||
momz = 4*FRACUNIT;
|
||||
ns = FixedMul(((i*FRACUNIT)/16)+2*FRACUNIT, mo->scale);
|
||||
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
||||
|
||||
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
P_SetObjectMomZ(mo, 8*FRACUNIT, false);
|
||||
mo->fuse = 20*TICRATE; // Adjust fuse for NiGHTS
|
||||
}
|
||||
else
|
||||
{
|
||||
momxy = 28*FRACUNIT;
|
||||
momz = 3*FRACUNIT;
|
||||
fixed_t momxy, momz; // base horizonal/vertical thrusts
|
||||
|
||||
if (i > 15)
|
||||
{
|
||||
momxy = 3*FRACUNIT;
|
||||
momz = 4*FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
momxy = 28*FRACUNIT;
|
||||
momz = 3*FRACUNIT;
|
||||
}
|
||||
|
||||
ns = FixedMul(momxy, mo->scale);
|
||||
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
||||
|
||||
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
ns = momz;
|
||||
P_SetObjectMomZ(mo, ns, false);
|
||||
|
||||
if (i & 1)
|
||||
P_SetObjectMomZ(mo, ns, true);
|
||||
}
|
||||
|
||||
ns = FixedMul(momxy, mo->scale);
|
||||
mo->momx = FixedMul(FINECOSINE(fa),ns);
|
||||
|
||||
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
|
||||
mo->momy = FixedMul(FINESINE(fa),ns);
|
||||
|
||||
ns = momz;
|
||||
P_SetObjectMomZ(mo, ns, false);
|
||||
|
||||
if (i & 1)
|
||||
P_SetObjectMomZ(mo, ns, true);
|
||||
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
mo->momz *= -1;
|
||||
}
|
||||
|
||||
player->losstime += 10*TICRATE;
|
||||
|
||||
if (P_IsObjectOnGround(player->mo))
|
||||
player->pflags &= ~PF_NIGHTSFALL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -213,6 +213,7 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings);
|
||||
void P_GivePlayerLives(player_t *player, INT32 numlives);
|
||||
UINT8 P_GetNextEmerald(void);
|
||||
void P_GiveEmerald(boolean spawnObj);
|
||||
void P_ResetScore(player_t *player);
|
||||
boolean P_AutoPause(void);
|
||||
|
||||
void P_DoJumpShield(player_t *player);
|
||||
|
||||
+15
-1
@@ -140,6 +140,12 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||
if (object->player && object->player->spectator)
|
||||
return false;
|
||||
|
||||
if (UNLIKELY(object->player && (object->player->pflags & PF_NIGHTSMODE)))
|
||||
{
|
||||
/*Someone want to make these work like bumpers?*/
|
||||
return false;
|
||||
}
|
||||
|
||||
object->standingslope = NULL; // Okay, now we can't return - no launching off at silly angles for you.
|
||||
|
||||
object->eflags |= MFE_SPRUNG; // apply this flag asap!
|
||||
@@ -221,6 +227,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||
}
|
||||
}
|
||||
|
||||
//pflags = object->player->pflags & (PF_JUMPED|PF_SPINNING|PF_THOKKED); // I still need these.
|
||||
P_ResetPlayer(object->player);
|
||||
}
|
||||
return true;
|
||||
@@ -259,6 +266,8 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
||||
break;
|
||||
if (flipval*object->momz >= FixedMul(speed, spring->scale)) // if object's already moving faster than your best, don't bother
|
||||
break;
|
||||
if (p && (p->climbing || p->pflags & PF_GLIDING)) // doesn't affect Knux when he's using his abilities!
|
||||
break;
|
||||
|
||||
object->momz += flipval*FixedMul(speed/4, spring->scale);
|
||||
|
||||
@@ -344,6 +353,11 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE)) || (thing->flags & MF_NOCLIPTHING))
|
||||
return true;
|
||||
|
||||
// Don't collide with your buddies while NiGHTS-flying.
|
||||
if (UNLIKELY(tmthing->player && thing->player && (maptol & TOL_NIGHTS)
|
||||
&& ((tmthing->player->pflags & PF_NIGHTSMODE) || (thing->player->pflags & PF_NIGHTSMODE))))
|
||||
return true;
|
||||
|
||||
blockdist = thing->radius + tmthing->radius;
|
||||
|
||||
if (abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist)
|
||||
@@ -1379,7 +1393,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
&& thing->z + thing->height + FixedMul(FRACUNIT, thing->scale) >= tmthing->z)
|
||||
{
|
||||
if (thing->flags & MF_MONITOR
|
||||
&& tmthing->player->pflags & PF_JUMPED)
|
||||
&& tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING))
|
||||
{
|
||||
SINT8 flipval = P_MobjFlip(thing); // Save this value in case monitor gets removed.
|
||||
fixed_t *momz = &tmthing->momz; // tmthing gets changed by P_DamageMobj, so we need a new pointer?! X_x;;
|
||||
|
||||
+145
-16
@@ -971,6 +971,11 @@ static void P_PlayerFlip(mobj_t *mo)
|
||||
camera[i].z += FixedMul(20*FRACUNIT, mo->scale);
|
||||
}
|
||||
}
|
||||
else if (UNLIKELY(mo->player->pflags & PF_NIGHTSMODE)) // NiGHTS doesn't use flipcam
|
||||
{
|
||||
if (mo->tracer)
|
||||
mo->tracer->eflags ^= MFE_VERTICALFLIP;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1038,15 +1043,16 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
|
||||
|
||||
if (mo->player)
|
||||
{
|
||||
if (UNLIKELY(mo->player->climbing || (mo->player->pflags & PF_NIGHTSMODE)))
|
||||
return 0;
|
||||
|
||||
if (!(mo->flags2 & MF2_OBJECTFLIP) != !(mo->player->powers[pw_gravityboots])) // negated to turn numeric into bool - would be double negated, but not needed if both would be
|
||||
{
|
||||
gravityadd = -gravityadd;
|
||||
mo->eflags ^= MFE_VERTICALFLIP;
|
||||
}
|
||||
|
||||
if (wasflip == !(mo->eflags & MFE_VERTICALFLIP)) // note!! == ! is not equivalent to != here - turns numeric into bool this way
|
||||
P_PlayerFlip(mo);
|
||||
|
||||
if (mo->player->kartstuff[k_pogospring])
|
||||
gravityadd = (5*gravityadd)/2;
|
||||
}
|
||||
@@ -1209,9 +1215,16 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
||||
|
||||
if (player) // valid only if player avatar
|
||||
{
|
||||
if (abs(player->rmomx) < mo->scale
|
||||
// spinning friction
|
||||
if (player->pflags & PF_SPINNING && (player->rmomx || player->rmomy) && !(player->pflags & PF_STARTDASH))
|
||||
{
|
||||
const fixed_t ns = FixedDiv(549*ORIG_FRICTION, 500*FRACUNIT); //const fixed_t ns = FixedDiv(549*FRICTION,500*FRACUNIT);
|
||||
mo->momx = FixedMul(mo->momx, ns);
|
||||
mo->momy = FixedMul(mo->momy, ns);
|
||||
}
|
||||
else if (abs(player->rmomx) < mo->scale
|
||||
&& abs(player->rmomy) < mo->scale
|
||||
&& (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove)
|
||||
&& (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))
|
||||
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
|
||||
)
|
||||
{
|
||||
@@ -1649,6 +1662,42 @@ void P_XYMovement(mobj_t *mo)
|
||||
// Check the gravity status.
|
||||
P_CheckGravity(mo, false);
|
||||
|
||||
if (UNLIKELY(player && !moved && player->pflags & PF_NIGHTSMODE && mo->target))
|
||||
{
|
||||
angle_t fa;
|
||||
|
||||
P_UnsetThingPosition(mo);
|
||||
player->angle_pos = player->old_angle_pos;
|
||||
player->speed = FixedMul(player->speed, 4*FRACUNIT/5);
|
||||
|
||||
if (player->flyangle >= 0 && player->flyangle < 90)
|
||||
player->flyangle = 135;
|
||||
else if (player->flyangle >= 90 && player->flyangle < 180)
|
||||
player->flyangle = 45;
|
||||
else if (player->flyangle >= 180 && player->flyangle < 270)
|
||||
player->flyangle = 315;
|
||||
else
|
||||
player->flyangle = 225;
|
||||
|
||||
player->flyangle %= 360;
|
||||
|
||||
if (player->pflags & PF_TRANSFERTOCLOSEST)
|
||||
{
|
||||
mo->x -= mo->momx;
|
||||
mo->y -= mo->momy;
|
||||
}
|
||||
else
|
||||
{
|
||||
fa = player->old_angle_pos>>ANGLETOFINESHIFT;
|
||||
|
||||
mo->x = mo->target->x + FixedMul(FINECOSINE(fa),mo->target->radius);
|
||||
mo->y = mo->target->y + FixedMul(FINESINE(fa),mo->target->radius);
|
||||
}
|
||||
|
||||
mo->momx = mo->momy = 0;
|
||||
P_SetThingPosition(mo);
|
||||
}
|
||||
|
||||
if (mo->flags & MF_NOCLIPHEIGHT)
|
||||
return; // no frictions for objects that can pass through floors
|
||||
|
||||
@@ -1663,6 +1712,12 @@ void P_XYMovement(mobj_t *mo)
|
||||
if (mo->flags & MF_MISSILE || mo->flags2 & MF2_SKULLFLY || mo->type == MT_SHELL || mo->type == MT_VULTURE)
|
||||
return; // no friction for missiles ever
|
||||
|
||||
if (player && player->homing) // no friction for homing
|
||||
return;
|
||||
|
||||
if (UNLIKELY(player && player->pflags & PF_NIGHTSMODE))
|
||||
return; // no friction for NiGHTS players
|
||||
|
||||
if ((mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED)
|
||||
&& (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)) // Special exception for tumbleweeds on slopes
|
||||
return;
|
||||
@@ -2426,6 +2481,20 @@ static void P_PlayerZMovement(mobj_t *mo)
|
||||
else
|
||||
mo->z = mo->floorz;
|
||||
|
||||
if (UNLIKELY(mo->player->pflags & PF_NIGHTSMODE))
|
||||
{
|
||||
// bounce off floor if you were flying towards it
|
||||
if ((mo->eflags & MFE_VERTICALFLIP && mo->player->flyangle > 0 && mo->player->flyangle < 180)
|
||||
|| (!(mo->eflags & MFE_VERTICALFLIP) && mo->player->flyangle > 180 && mo->player->flyangle <= 359))
|
||||
{
|
||||
if (mo->player->flyangle < 90 || mo->player->flyangle >= 270)
|
||||
mo->player->flyangle += P_MobjFlip(mo)*90;
|
||||
else
|
||||
mo->player->flyangle -= P_MobjFlip(mo)*90;
|
||||
mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5);
|
||||
}
|
||||
goto nightsdone;
|
||||
}
|
||||
// Get up if you fell.
|
||||
if ((mo->state == &states[mo->info->painstate] || mo->state == &states[S_KART_SPIN])
|
||||
&& mo->player->kartstuff[k_spinouttimer] == 0 && mo->player->kartstuff[k_squishedtimer] == 0) // SRB2kart
|
||||
@@ -2533,17 +2602,34 @@ static void P_PlayerZMovement(mobj_t *mo)
|
||||
|
||||
if (mo->health)
|
||||
{
|
||||
if ((mo->player->pflags & PF_JUMPED || ((mo->player->pflags & PF_USEDOWN) != PF_USEDOWN)
|
||||
if (mo->player->pflags & PF_GLIDING) // ground gliding
|
||||
{
|
||||
mo->player->skidtime = TICRATE;
|
||||
mo->tics = -1;
|
||||
}
|
||||
else if ((mo->player->pflags & PF_JUMPED || (mo->player->pflags & (PF_SPINNING|PF_USEDOWN)) != (PF_SPINNING|PF_USEDOWN)
|
||||
|| mo->player->powers[pw_tailsfly]) && (mo->player->kartstuff[k_spinouttimer] == 0)) // SRB2kart
|
||||
{
|
||||
K_KartMoveAnimation(mo->player);
|
||||
}
|
||||
|
||||
mo->player->pflags &= ~PF_JUMPED;
|
||||
if (mo->player->pflags & PF_JUMPED)
|
||||
mo->player->pflags &= ~PF_SPINNING;
|
||||
else if (!(mo->player->pflags & PF_USEDOWN))
|
||||
mo->player->pflags &= ~PF_SPINNING;
|
||||
|
||||
if (!(mo->player->pflags & PF_GLIDING))
|
||||
mo->player->pflags &= ~PF_JUMPED;
|
||||
mo->player->pflags &= ~PF_THOKKED;
|
||||
mo->player->jumping = 0;
|
||||
mo->player->secondjump = 0;
|
||||
mo->player->glidetime = 0;
|
||||
mo->player->climbing = 0;
|
||||
mo->player->powers[pw_tailsfly] = 0;
|
||||
}
|
||||
}
|
||||
if (!(mo->player->pflags & PF_SPINNING))
|
||||
mo->player->pflags &= ~PF_STARTDASH;
|
||||
|
||||
if (tmfloorthing && (tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR)
|
||||
|| tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER))
|
||||
@@ -2575,6 +2661,8 @@ static void P_PlayerZMovement(mobj_t *mo)
|
||||
P_CheckGravity(mo, true);
|
||||
}
|
||||
|
||||
nightsdone:
|
||||
|
||||
if (((mo->eflags & MFE_VERTICALFLIP && mo->z < mo->floorz) || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z + mo->height > mo->ceilingz))
|
||||
&& !(mo->flags & MF_NOCLIPHEIGHT))
|
||||
{
|
||||
@@ -2583,6 +2671,21 @@ static void P_PlayerZMovement(mobj_t *mo)
|
||||
else
|
||||
mo->z = mo->ceilingz - mo->height;
|
||||
|
||||
if (UNLIKELY(mo->player->pflags & PF_NIGHTSMODE))
|
||||
{
|
||||
// bounce off ceiling if you were flying towards it
|
||||
if ((mo->eflags & MFE_VERTICALFLIP && mo->player->flyangle > 180 && mo->player->flyangle <= 359)
|
||||
|| (!(mo->eflags & MFE_VERTICALFLIP) && mo->player->flyangle > 0 && mo->player->flyangle < 180))
|
||||
{
|
||||
if (mo->player->flyangle < 90 || mo->player->flyangle >= 270)
|
||||
mo->player->flyangle -= P_MobjFlip(mo)*90;
|
||||
else
|
||||
mo->player->flyangle += P_MobjFlip(mo)*90;
|
||||
mo->player->flyangle %= 360;
|
||||
mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for "Mario" blocks to hit and bounce them
|
||||
if (P_MobjFlip(mo)*mo->momz > 0)
|
||||
{
|
||||
@@ -2616,7 +2719,8 @@ static void P_PlayerZMovement(mobj_t *mo)
|
||||
if (UNLIKELY(mariomode))
|
||||
S_StartSound(mo, sfx_mario1);
|
||||
|
||||
mo->momz = 0;
|
||||
if (!mo->player->climbing)
|
||||
mo->momz = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3243,7 +3347,7 @@ void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
|
||||
player_flipcam = cv_flipcam[pnum].value;
|
||||
}
|
||||
|
||||
const boolean flipcam = (player_flipcam && (player->mo->eflags & MFE_VERTICALFLIP));
|
||||
const boolean flipcam = (player_flipcam && player->mo->eflags & MFE_VERTICALFLIP && LIKELY(!(player->pflags & PF_NIGHTSMODE)));
|
||||
UINT8 postimgtype = 0;
|
||||
|
||||
if (encoremode)
|
||||
@@ -3528,10 +3632,14 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (LIKELY(!(mobj->player->pflags & PF_NIGHTSMODE))) // "jumping" is used for drilling
|
||||
mobj->player->jumping = 0;
|
||||
|
||||
mobj->player->pflags &= ~PF_JUMPED;
|
||||
|
||||
if (mobj->player->powers[pw_tailsfly])
|
||||
if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly])
|
||||
{
|
||||
mobj->player->secondjump = 0;
|
||||
mobj->player->powers[pw_tailsfly] = 0;
|
||||
P_SetPlayerMobjState(mobj, S_KART_WALK1); // SRB2kart - was S_PLAY_RUN1
|
||||
}
|
||||
@@ -4955,7 +5063,7 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
||||
if ((!mobj->target || !(mobj->target->flags & MF_SHOOTABLE)))
|
||||
{
|
||||
P_BossTargetPlayer(mobj, false);
|
||||
if (mobj->target && !P_IsObjectOnGround(mobj->target))
|
||||
if (mobj->target && (!P_IsObjectOnGround(mobj->target) || mobj->target->player->pflags & PF_SPINNING))
|
||||
P_SetTarget(&mobj->target, NULL); // Wait for them to hit the ground first
|
||||
|
||||
if (!mobj->target) // Still no target, aww.
|
||||
@@ -5336,7 +5444,7 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
||||
mobj->angle -= InvAngle(angle)/8;
|
||||
|
||||
// Check if we're being attacked
|
||||
if (!(mobj->target->player->pflags & PF_JUMPED
|
||||
if (!(mobj->target->player->pflags & (PF_JUMPED|PF_SPINNING)
|
||||
|| mobj->target->player->powers[pw_tailsfly]
|
||||
|| mobj->target->player->powers[pw_invulnerability]
|
||||
|| mobj->target->player->powers[pw_super]))
|
||||
@@ -5645,6 +5753,7 @@ void P_SetScale(mobj_t *mobj, fixed_t newscale)
|
||||
{
|
||||
G_GhostAddScale((INT32) (player - players), newscale);
|
||||
player->viewheight = FixedMul(FixedDiv(player->viewheight, oldscale), newscale); // Nonono don't calculate viewheight elsewhere, this is the best place for it!
|
||||
player->dashspeed = FixedMul(FixedDiv(player->dashspeed, oldscale), newscale); // Prevents the player from having to re-charge up spindash if the player grew in size
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8584,9 +8693,17 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
||||
|
||||
if (mobj->tracer && mobj->tracer->player)
|
||||
{
|
||||
mobj->flags &= ~MF_NOGRAVITY;
|
||||
mobj->flags2 &= ~MF2_DONTDRAW;
|
||||
P_SetMobjState(mobj, S_NIGHTSDRONE1);
|
||||
if (LIKELY(!(mobj->tracer->player->pflags & PF_NIGHTSMODE)))
|
||||
{
|
||||
mobj->flags &= ~MF_NOGRAVITY;
|
||||
mobj->flags2 &= ~MF2_DONTDRAW;
|
||||
P_SetMobjState(mobj, S_NIGHTSDRONE1);
|
||||
}
|
||||
else if (!mobj->tracer->player->bonustime)
|
||||
{
|
||||
mobj->flags &= ~MF_NOGRAVITY;
|
||||
P_SetMobjState(mobj, S_NIGHTSDRONE1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -8600,8 +8717,18 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
||||
P_SetTarget(&mobj->target, NULL);
|
||||
}
|
||||
|
||||
// Not NiGHTS
|
||||
mobj->flags2 &= ~MF2_DONTDRAW;
|
||||
if (UNLIKELY(mobj->tracer->player->pflags & PF_NIGHTSMODE))
|
||||
{
|
||||
if (mobj->tracer->player->bonustime)
|
||||
{
|
||||
P_SetMobjState(mobj, S_NIGHTSDRONE_SPARKLING1);
|
||||
mobj->flags |= MF_NOGRAVITY;
|
||||
}
|
||||
else
|
||||
mobj->flags2 |= MF2_DONTDRAW;
|
||||
}
|
||||
else // Not NiGHTS
|
||||
mobj->flags2 &= ~MF2_DONTDRAW;
|
||||
}
|
||||
|
||||
mobj->angle += ANG10;
|
||||
@@ -10730,6 +10857,7 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
mobj->health = p->health;
|
||||
p->playerstate = PST_LIVE;
|
||||
|
||||
p->bonustime = false;
|
||||
p->realtime = leveltime;
|
||||
|
||||
//awayview stuff
|
||||
@@ -10836,6 +10964,7 @@ void P_AfterPlayerSpawn(INT32 playernum)
|
||||
p->viewz = p->mo->z + p->viewheight;
|
||||
|
||||
P_SetPlayerMobjState(p->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND
|
||||
p->pflags &= ~PF_SPINNING;
|
||||
|
||||
if (playernum == consoleplayer)
|
||||
{
|
||||
|
||||
+9
-5
@@ -1026,9 +1026,7 @@ static void Polyobj_pushThing(polyobj_t *po, line_t *line, mobj_t *mo)
|
||||
//
|
||||
static void Polyobj_slideThing(mobj_t *mo, fixed_t dx, fixed_t dy)
|
||||
{
|
||||
// Do something similar to conveyor movement. -Red
|
||||
if (mo->player)
|
||||
{
|
||||
if (mo->player) { // Do something similar to conveyor movement. -Red
|
||||
mo->player->cmomx += dx;
|
||||
mo->player->cmomy += dy;
|
||||
|
||||
@@ -1038,12 +1036,18 @@ static void Polyobj_slideThing(mobj_t *mo, fixed_t dx, fixed_t dy)
|
||||
mo->player->cmomx -= dx;
|
||||
mo->player->cmomy -= dy;
|
||||
|
||||
if (mo->player->pflags & PF_SPINNING && (mo->player->rmomx || mo->player->rmomy) && !(mo->player->pflags & PF_STARTDASH)) {
|
||||
#define SPINMULT 5184 // Consider this a substitute for properly calculating FRACUNIT-friction. I'm tired. -Red
|
||||
dx = FixedMul(dx, SPINMULT);
|
||||
dy = FixedMul(dy, SPINMULT);
|
||||
#undef SPINMULT
|
||||
}
|
||||
|
||||
mo->momx += dx;
|
||||
mo->momy += dy;
|
||||
|
||||
mo->player->onconveyor = 1;
|
||||
}
|
||||
else
|
||||
} else
|
||||
P_TryMove(mo, mo->x+dx, mo->y+dy, true);
|
||||
}
|
||||
|
||||
|
||||
+107
-82
@@ -137,9 +137,8 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending)
|
||||
WRITEINT32(save->p, player->awayviewtics);
|
||||
WRITEINT32(save->p, player->health);
|
||||
|
||||
WRITESINT8(save->p, 0); //player->pity
|
||||
WRITEINT32(save->p, 0); //player->currentweapon
|
||||
|
||||
WRITESINT8(save->p, player->pity);
|
||||
WRITEINT32(save->p, player->currentweapon);
|
||||
WRITEINT32(save->p, player->ringweapons);
|
||||
|
||||
for (j = 0; j < NUMPOWERS; j++)
|
||||
@@ -164,23 +163,23 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending)
|
||||
}
|
||||
|
||||
WRITEUINT32(save->p, player->score);
|
||||
WRITEFIXED(save->p, 0); //player->dashspeed
|
||||
WRITEINT32(save->p, 0); //player->dashtime
|
||||
WRITEFIXED(save->p, player->dashspeed);
|
||||
WRITEINT32(save->p, player->dashtime);
|
||||
WRITESINT8(save->p, player->lives);
|
||||
WRITESINT8(save->p, player->continues);
|
||||
WRITESINT8(save->p, 0); //player->xtralife
|
||||
WRITEUINT8(save->p, 0); //player->gotcontinue
|
||||
WRITESINT8(save->p, player->xtralife);
|
||||
WRITEUINT8(save->p, player->gotcontinue);
|
||||
WRITEFIXED(save->p, player->speed);
|
||||
WRITEUINT8(save->p, 0); //player->jumping
|
||||
WRITEUINT8(save->p, 0); //player->secondjump
|
||||
WRITEUINT8(save->p, 0); //player->fly1
|
||||
WRITEUINT8(save->p, 0); //player->scoreadd
|
||||
WRITEUINT32(save->p, 0); //player->glidetime
|
||||
WRITEUINT8(save->p, 0); //player->climbing
|
||||
WRITEUINT8(save->p, player->jumping);
|
||||
WRITEUINT8(save->p, player->secondjump);
|
||||
WRITEUINT8(save->p, player->fly1);
|
||||
WRITEUINT8(save->p, player->scoreadd);
|
||||
WRITEUINT32(save->p, player->glidetime);
|
||||
WRITEUINT8(save->p, player->climbing);
|
||||
WRITEINT32(save->p, player->deadtimer);
|
||||
WRITEUINT32(save->p, player->exiting);
|
||||
WRITEUINT8(save->p, 0); //player->homing
|
||||
WRITEUINT32(save->p, 0); //player->skidtime
|
||||
WRITEUINT8(save->p, player->homing);
|
||||
WRITEUINT32(save->p, player->skidtime);
|
||||
|
||||
////////////////////////////
|
||||
// Conveyor Belt Movement //
|
||||
@@ -193,7 +192,7 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending)
|
||||
/////////////////////
|
||||
// Race Mode Stuff //
|
||||
/////////////////////
|
||||
WRITEINT16(save->p, 0); //player->numboxes
|
||||
WRITEINT16(save->p, player->numboxes);
|
||||
WRITEINT16(save->p, player->totalring);
|
||||
WRITEUINT32(save->p, player->realtime);
|
||||
WRITEUINT8(save->p, player->laps);
|
||||
@@ -204,7 +203,7 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending)
|
||||
WRITEINT32(save->p, player->ctfteam);
|
||||
WRITEUINT16(save->p, player->gotflag);
|
||||
|
||||
WRITEINT32(save->p, 0); //player->weapondelay
|
||||
WRITEINT32(save->p, player->weapondelay);
|
||||
WRITEINT32(save->p, player->tossdelay);
|
||||
|
||||
WRITEUINT32(save->p, player->starposttime);
|
||||
@@ -214,43 +213,50 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending)
|
||||
WRITEINT32(save->p, player->starpostnum);
|
||||
WRITEANGLE(save->p, player->starpostangle);
|
||||
|
||||
WRITEANGLE(save->p, 0); //player->angle_pos
|
||||
WRITEANGLE(save->p, 0); //player->old_angle_pos
|
||||
WRITEANGLE(save->p, player->angle_pos);
|
||||
WRITEANGLE(save->p, player->old_angle_pos);
|
||||
|
||||
WRITEINT32(save->p, player->flyangle);
|
||||
WRITEUINT32(save->p, 0); //player->drilltimer
|
||||
WRITEUINT32(save->p, player->drilltimer);
|
||||
WRITEINT32(save->p, player->linkcount);
|
||||
WRITEUINT32(save->p, player->linktimer);
|
||||
WRITEINT32(save->p, 0); //player->anotherflyangle
|
||||
WRITEINT32(save->p, player->anotherflyangle);
|
||||
WRITEUINT32(save->p, player->nightstime);
|
||||
WRITEUINT32(save->p, player->bumpertime);
|
||||
WRITEINT32(save->p, 0); //player->drillmeter
|
||||
WRITEUINT8(save->p, 0); //player->drilldelay
|
||||
WRITEUINT8(save->p, 0); // player->bonustime
|
||||
WRITEINT32(save->p, player->drillmeter);
|
||||
WRITEUINT8(save->p, player->drilldelay);
|
||||
WRITEUINT8(save->p, player->bonustime);
|
||||
WRITEUINT8(save->p, player->mare);
|
||||
|
||||
WRITEUINT32(save->p, 0); // player->marebegunat
|
||||
WRITEUINT32(save->p, 0); // player->startedtime
|
||||
WRITEUINT32(save->p, 0); // player->finishedtime
|
||||
WRITEINT16(save->p, 0); // player->finishedrings
|
||||
|
||||
WRITEUINT32(save->p, player->marebegunat);
|
||||
WRITEUINT32(save->p, player->startedtime);
|
||||
WRITEUINT32(save->p, player->finishedtime);
|
||||
WRITEINT16(save->p, player->finishedrings);
|
||||
WRITEUINT32(save->p, player->marescore);
|
||||
WRITEUINT32(save->p, player->lastmarescore);
|
||||
WRITEUINT8(save->p, player->lastmare);
|
||||
WRITEINT32(save->p, player->maxlink);
|
||||
WRITEUINT8(save->p, player->texttimer);
|
||||
WRITEUINT8(save->p, player->textvar);
|
||||
|
||||
WRITEUINT32(save->p,0); // player->lastmarescore
|
||||
WRITEUINT8(save->p, 0); // player->lastmare
|
||||
WRITEINT32(save->p, 0); // player->maxlink
|
||||
WRITEUINT8(save->p, 0); // player->texttimer
|
||||
WRITEUINT8(save->p, 0); // player->textvar
|
||||
if (player->capsule)
|
||||
flags |= CAPSULE;
|
||||
|
||||
if (player->awayviewmobj)
|
||||
flags |= AWAYVIEW;
|
||||
|
||||
WRITEINT16(save->p, 0); //player->lastsidehit
|
||||
WRITEINT16(save->p, 0); //player->lastlinehit
|
||||
if (player->axis1)
|
||||
flags |= FIRSTAXIS;
|
||||
|
||||
WRITEUINT32(save->p, 0); // player->losstime
|
||||
if (player->axis2)
|
||||
flags |= SECONDAXIS;
|
||||
|
||||
WRITEUINT8(save->p, 0); //player->timeshit
|
||||
WRITEINT16(save->p, player->lastsidehit);
|
||||
WRITEINT16(save->p, player->lastlinehit);
|
||||
|
||||
WRITEUINT32(save->p, player->losstime);
|
||||
|
||||
WRITEUINT8(save->p, player->timeshit);
|
||||
|
||||
WRITEINT32(save->p, player->onconveyor);
|
||||
|
||||
@@ -264,11 +270,19 @@ static void P_NetArchivePlayers(savebuffer_t *save, boolean resending)
|
||||
|
||||
WRITEUINT16(save->p, flags);
|
||||
|
||||
if (flags & CAPSULE)
|
||||
WRITEUINT32(save->p, player->capsule->mobjnum);
|
||||
|
||||
if (flags & FIRSTAXIS)
|
||||
WRITEUINT32(save->p, player->axis1->mobjnum);
|
||||
|
||||
if (flags & SECONDAXIS)
|
||||
WRITEUINT32(save->p, player->axis2->mobjnum);
|
||||
|
||||
if (flags & AWAYVIEW)
|
||||
WRITEUINT32(save->p, player->awayviewmobj->mobjnum);
|
||||
|
||||
WRITEUINT32(save->p, 0); // player->charflags
|
||||
|
||||
WRITEUINT32(save->p, player->charflags);
|
||||
// SRB2kart
|
||||
WRITEUINT8(save->p, player->kartspeed);
|
||||
WRITEUINT8(save->p, player->kartweight);
|
||||
@@ -316,9 +330,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean reloading)
|
||||
player->awayviewtics = READINT32(save->p);
|
||||
player->health = READINT32(save->p);
|
||||
|
||||
save->p += sizeof(SINT8); // player->pity
|
||||
save->p += sizeof(INT32); // player->currentweapon
|
||||
|
||||
player->pity = READSINT8(save->p);
|
||||
player->currentweapon = READINT32(save->p);
|
||||
player->ringweapons = READINT32(save->p);
|
||||
|
||||
for (j = 0; j < NUMPOWERS; j++)
|
||||
@@ -343,23 +356,23 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean reloading)
|
||||
}
|
||||
|
||||
player->score = READUINT32(save->p);
|
||||
save->p += sizeof(fixed_t); // player->dashspeed
|
||||
save->p += sizeof(INT32); // player->dashtime
|
||||
player->dashspeed = READFIXED(save->p); // dashing speed
|
||||
player->dashtime = READINT32(save->p); // dashing speed
|
||||
player->lives = READSINT8(save->p);
|
||||
player->continues = READSINT8(save->p); // continues that player has acquired
|
||||
save->p += sizeof(SINT8); // player->xtralife
|
||||
save->p += sizeof(UINT8); // player->gotcontinue
|
||||
player->xtralife = READSINT8(save->p); // Ring Extra Life counter
|
||||
player->gotcontinue = READUINT8(save->p); // got continue from stage
|
||||
player->speed = READFIXED(save->p); // Player's speed (distance formula of MOMX and MOMY values)
|
||||
save->p += sizeof(UINT8); // player->jumping
|
||||
save->p += sizeof(UINT8); // player->secondjump
|
||||
save->p += sizeof(UINT8); // player->fly1
|
||||
save->p += sizeof(UINT8); // player->scoreadd
|
||||
save->p += sizeof(UINT32); // player->glidetime
|
||||
save->p += sizeof(UINT8); // player->climbing
|
||||
player->jumping = READUINT8(save->p); // Jump counter
|
||||
player->secondjump = READUINT8(save->p);
|
||||
player->fly1 = READUINT8(save->p); // Tails flying
|
||||
player->scoreadd = READUINT8(save->p); // Used for multiple enemy attack bonus
|
||||
player->glidetime = READUINT32(save->p); // Glide counter for thrust
|
||||
player->climbing = READUINT8(save->p); // Climbing on the wall
|
||||
player->deadtimer = READINT32(save->p); // End game if game over lasts too long
|
||||
player->exiting = READUINT32(save->p); // Exitlevel timer
|
||||
save->p += sizeof(UINT8); // player->homing
|
||||
save->p += sizeof(UINT32); // player->skidtime
|
||||
player->homing = READUINT8(save->p); // Are you homing?
|
||||
player->skidtime = READUINT32(save->p); // Skid timer
|
||||
|
||||
////////////////////////////
|
||||
// Conveyor Belt Movement //
|
||||
@@ -372,7 +385,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean reloading)
|
||||
/////////////////////
|
||||
// Race Mode Stuff //
|
||||
/////////////////////
|
||||
save->p += sizeof(INT16); // player->numboxes
|
||||
player->numboxes = READINT16(save->p); // Number of item boxes obtained for Race Mode
|
||||
player->totalring = READINT16(save->p); // Total number of rings obtained for Race Mode
|
||||
player->realtime = READUINT32(save->p); // integer replacement for leveltime
|
||||
player->laps = READUINT8(save->p); // Number of laps (optional)
|
||||
@@ -383,7 +396,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean reloading)
|
||||
player->ctfteam = READINT32(save->p); // 1 == Red, 2 == Blue
|
||||
player->gotflag = READUINT16(save->p); // 1 == Red, 2 == Blue Do you have the flag?
|
||||
|
||||
save->p += sizeof(INT32); // player->weapondelay
|
||||
player->weapondelay = READINT32(save->p);
|
||||
player->tossdelay = READINT32(save->p);
|
||||
|
||||
player->starposttime = READUINT32(save->p);
|
||||
@@ -393,37 +406,38 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean reloading)
|
||||
player->starpostnum = READINT32(save->p);
|
||||
player->starpostangle = READANGLE(save->p);
|
||||
|
||||
save->p += sizeof(angle_t); // player->angle_pos
|
||||
save->p += sizeof(angle_t); // player->old_angle_pos
|
||||
player->angle_pos = READANGLE(save->p);
|
||||
player->old_angle_pos = READANGLE(save->p);
|
||||
|
||||
player->flyangle = READINT32(save->p);
|
||||
save->p += sizeof(UINT32); // player->drilltimer
|
||||
player->drilltimer = READUINT32(save->p);
|
||||
player->linkcount = READINT32(save->p);
|
||||
player->linktimer = READUINT32(save->p);
|
||||
save->p += sizeof(INT32); // player->anotherflyangle
|
||||
player->anotherflyangle = READINT32(save->p);
|
||||
player->nightstime = READUINT32(save->p);
|
||||
player->bumpertime = READUINT32(save->p);
|
||||
save->p += sizeof(INT32); // player->drillmeter
|
||||
save->p += sizeof(UINT8); // player->drilldelay
|
||||
save->p += sizeof(UINT8); // player->bonustime
|
||||
player->drillmeter = READINT32(save->p);
|
||||
player->drilldelay = READUINT8(save->p);
|
||||
player->bonustime = (boolean)READUINT8(save->p);
|
||||
player->mare = READUINT8(save->p);
|
||||
|
||||
save->p += sizeof(UINT32); // player->marebegunat
|
||||
save->p += sizeof(UINT32); // player->startedtime
|
||||
save->p += sizeof(UINT32); // player->finishedtime
|
||||
save->p += sizeof(INT16); // player->finishedrings
|
||||
|
||||
player->marebegunat = READUINT32(save->p);
|
||||
player->startedtime = READUINT32(save->p);
|
||||
player->finishedtime = READUINT32(save->p);
|
||||
player->finishedrings = READINT16(save->p);
|
||||
player->marescore = READUINT32(save->p);
|
||||
player->lastmarescore = READUINT32(save->p);
|
||||
player->lastmare = READUINT8(save->p);
|
||||
player->maxlink = READINT32(save->p);
|
||||
player->texttimer = READUINT8(save->p);
|
||||
player->textvar = READUINT8(save->p);
|
||||
|
||||
save->p += sizeof(UINT32); // player->lastmarescore
|
||||
save->p += sizeof(UINT8); // player->lastmare
|
||||
save->p += sizeof(INT32); // player->maxlink
|
||||
save->p += sizeof(UINT8); // player->texttimer
|
||||
save->p += sizeof(UINT8); // player->textvar
|
||||
save->p += sizeof(INT16); // player->lastsidehit
|
||||
save->p += sizeof(INT16); // player->lastlinehit
|
||||
save->p += sizeof(UINT32); // player->losstime
|
||||
save->p += sizeof(UINT8); // player->timeshit
|
||||
player->lastsidehit = READINT16(save->p);
|
||||
player->lastlinehit = READINT16(save->p);
|
||||
|
||||
player->losstime = READUINT32(save->p);
|
||||
|
||||
player->timeshit = READUINT8(save->p);
|
||||
|
||||
player->onconveyor = READINT32(save->p);
|
||||
|
||||
@@ -437,14 +451,22 @@ static void P_NetUnArchivePlayers(savebuffer_t *save, boolean reloading)
|
||||
|
||||
flags = READUINT16(save->p);
|
||||
|
||||
if (flags & CAPSULE)
|
||||
player->capsule = (mobj_t *)(size_t)READUINT32(save->p);
|
||||
|
||||
if (flags & FIRSTAXIS)
|
||||
player->axis1 = (mobj_t *)(size_t)READUINT32(save->p);
|
||||
|
||||
if (flags & SECONDAXIS)
|
||||
player->axis2 = (mobj_t *)(size_t)READUINT32(save->p);
|
||||
|
||||
if (flags & AWAYVIEW)
|
||||
player->awayviewmobj = (mobj_t *)(size_t)READUINT32(save->p);
|
||||
|
||||
player->viewheight = 32<<FRACBITS;
|
||||
|
||||
//SetPlayerSkinByNum(i, player->skin);
|
||||
save->p += sizeof(UINT32); // player->charflags
|
||||
|
||||
player->charflags = READUINT32(save->p);
|
||||
// SRB2kart
|
||||
player->kartspeed = READUINT8(save->p);
|
||||
player->kartweight = READUINT8(save->p);
|
||||
@@ -3189,6 +3211,9 @@ static void P_RelinkPointers(void)
|
||||
|
||||
if (player)
|
||||
{
|
||||
RELINK(player->capsule, "capsule");
|
||||
RELINK(player->axis1, "axis1");
|
||||
RELINK(player->axis2, "axis2");
|
||||
RELINK(player->awayviewmobj, "awayviewmobj");
|
||||
}
|
||||
#undef RELINK
|
||||
@@ -3363,7 +3388,7 @@ static void P_NetArchiveMisc(savebuffer_t *save, boolean resending)
|
||||
WRITEUINT8(save->p, encoremode);
|
||||
|
||||
WRITEUINT32(save->p, leveltime);
|
||||
WRITEUINT32(save->p, 0); // totalrings
|
||||
WRITEUINT32(save->p, totalrings);
|
||||
WRITEINT16(save->p, lastmap);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
@@ -3577,7 +3602,7 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(savebuffer_t *save, bool
|
||||
|
||||
// get the time
|
||||
leveltime = READUINT32(save->p);
|
||||
save->p += sizeof(UINT32); // totalrings
|
||||
totalrings = READUINT32(save->p);
|
||||
lastmap = READINT16(save->p);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
|
||||
+27
-4
@@ -2071,6 +2071,7 @@ static void P_LevelInitStuff(boolean reloadinggamestate)
|
||||
// circuit, race and competition stuff
|
||||
circuitmap = false;
|
||||
numstarposts = 0;
|
||||
totalrings = 0;
|
||||
|
||||
if (!reloadinggamestate)
|
||||
timeinmap = 0;
|
||||
@@ -2100,17 +2101,28 @@ static void P_LevelInitStuff(boolean reloadinggamestate)
|
||||
|
||||
player->driftsparkGrowTimer = 0;
|
||||
|
||||
player->deadtimer = player->totalring = player->laps = 0;
|
||||
player->gotcontinue = false;
|
||||
|
||||
player->xtralife = player->deadtimer = player->numboxes = player->totalring = player->laps = 0;
|
||||
player->health = 1;
|
||||
player->aiming = 0;
|
||||
player->pflags &= ~PF_TIMEOVER;
|
||||
|
||||
player->marescore = 0;
|
||||
player->losstime = 0;
|
||||
player->timeshit = 0;
|
||||
|
||||
player->marescore = player->lastmarescore = player->maxlink = 0;
|
||||
player->startedtime = player->finishedtime = player->finishedrings = 0;
|
||||
player->lastmare = player->marebegunat = 0;
|
||||
|
||||
// Don't show anything
|
||||
player->textvar = player->texttimer = 0;
|
||||
|
||||
player->linkcount = player->linktimer = 0;
|
||||
|
||||
player->flyangle = 0;
|
||||
player->flyangle = player->anotherflyangle = 0;
|
||||
player->nightstime = player->mare = 0;
|
||||
P_SetTarget(&player->capsule, NULL);
|
||||
player->drillmeter = 40*20;
|
||||
|
||||
player->exiting = 0;
|
||||
P_ResetPlayer(player);
|
||||
@@ -2118,6 +2130,12 @@ static void P_LevelInitStuff(boolean reloadinggamestate)
|
||||
player->spectatorreentry = 0; // SRB2Kart 1.4
|
||||
|
||||
player->mo = NULL;
|
||||
|
||||
// we must unset axis details too
|
||||
player->axis1 = player->axis2 = NULL;
|
||||
|
||||
// and this stupid flag as a result
|
||||
player->pflags &= ~PF_TRANSFERTOCLOSEST;
|
||||
}
|
||||
|
||||
// SRB2Kart: map load variables
|
||||
@@ -2547,6 +2565,11 @@ static void P_SetupPlayer(void)
|
||||
{
|
||||
if (playeringame[i])
|
||||
{
|
||||
players[i].pflags &= ~PF_NIGHTSMODE;
|
||||
|
||||
// Start players with pity shields if possible
|
||||
players[i].pity = -1;
|
||||
|
||||
if (!G_RaceGametype())
|
||||
{
|
||||
players[i].mo = NULL;
|
||||
|
||||
+19
-2
@@ -950,8 +950,8 @@ void P_ButteredSlope(mobj_t *mo)
|
||||
{
|
||||
const int zeedelta = abs(mo->standingslope->zdelta);
|
||||
|
||||
if (zeedelta < FRACUNIT/4)
|
||||
return; // Don't slide on non-steep slopes
|
||||
if (zeedelta < FRACUNIT/4 && !(mo->player->pflags & PF_SPINNING))
|
||||
return; // Don't slide on non-steep slopes unless spinning
|
||||
|
||||
if (zeedelta < FRACUNIT/2 && !(mo->player->rmomx || mo->player->rmomy))
|
||||
return; // Allow the player to stand still on slopes below a certain steepness
|
||||
@@ -959,6 +959,23 @@ void P_ButteredSlope(mobj_t *mo)
|
||||
|
||||
thrust = FINESINE(mo->standingslope->zangle>>ANGLETOFINESHIFT) * 15 / 16 * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1);
|
||||
|
||||
if (mo->player && (mo->player->pflags & PF_SPINNING))
|
||||
{
|
||||
fixed_t mult = 0;
|
||||
|
||||
if (mo->momx || mo->momy)
|
||||
{
|
||||
angle_t angle = R_PointToAngle2(0, 0, mo->momx, mo->momy) - mo->standingslope->xydirection;
|
||||
|
||||
if (P_MobjFlip(mo) * mo->standingslope->zdelta < 0)
|
||||
angle ^= ANGLE_180;
|
||||
|
||||
mult = FINECOSINE(angle >> ANGLETOFINESHIFT);
|
||||
}
|
||||
|
||||
thrust = FixedMul(thrust, FRACUNIT*2/3 + mult/8);
|
||||
}
|
||||
|
||||
if (mo->momx || mo->momy) // Slightly increase thrust based on the object's speed
|
||||
thrust = FixedMul(thrust, FRACUNIT+P_AproxDistance(mo->momx, mo->momy)/16);
|
||||
// This makes it harder to zigzag up steep slopes, as well as allows greater top speed when rolling down
|
||||
|
||||
+80
-26
@@ -3700,7 +3700,10 @@ DoneSection2:
|
||||
|
||||
P_SetTarget(&player->mo->tracer, waypoint);
|
||||
player->speed = speed;
|
||||
player->pflags &= ~PF_SPINNING; // SRB2kart 200117
|
||||
player->pflags &= ~PF_JUMPED;
|
||||
player->pflags &= ~PF_GLIDING;
|
||||
player->climbing = 0;
|
||||
|
||||
if (!(player->mo->state >= &states[S_KART_RUN1] && player->mo->state <= &states[S_KART_RUN2]))
|
||||
P_SetPlayerMobjState(player->mo, S_KART_RUN1);
|
||||
@@ -3770,6 +3773,7 @@ DoneSection2:
|
||||
|
||||
P_SetTarget(&player->mo->tracer, waypoint);
|
||||
player->speed = speed;
|
||||
player->pflags &= ~PF_SPINNING; // SRB2kart 200117
|
||||
player->pflags &= ~PF_JUMPED;
|
||||
|
||||
if (!(player->mo->state >= &states[S_KART_RUN1] && player->mo->state <= &states[S_KART_RUN2]))
|
||||
@@ -3816,6 +3820,9 @@ DoneSection2:
|
||||
|
||||
player->kartstuff[k_lapanimation] = 80;
|
||||
|
||||
if (UNLIKELY(player->pflags & PF_NIGHTSMODE))
|
||||
player->drillmeter += 48*20;
|
||||
|
||||
if (netgame && player->laps >= (UINT8)cv_numlaps.value)
|
||||
CON_LogMessage(va(M_GetText("%s has finished the race.\n"), player_names[player-players]));
|
||||
|
||||
@@ -4136,8 +4143,9 @@ DoneSection2:
|
||||
S_StartSound(player->mo, sfx_s3k4a);
|
||||
|
||||
player->pflags &= ~PF_JUMPED;
|
||||
player->pflags &= ~PF_GLIDING;
|
||||
player->pflags &= ~PF_SLIDING;
|
||||
|
||||
player->climbing = 0;
|
||||
P_SetThingPosition(player->mo);
|
||||
//P_SetPlayerMobjState(player->mo, S_PLAY_CARRY); // SRB2kart
|
||||
}
|
||||
@@ -5241,6 +5249,7 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate)
|
||||
|
||||
// Defaults in case levels don't have them set.
|
||||
sstimer = 90*TICRATE + 6;
|
||||
totalrings = 1;
|
||||
|
||||
CheckForBustableBlocks = CheckForBouncySector = CheckForQuicksand = CheckForMarioBlocks = CheckForFloatBob = CheckForReverseGravity = false;
|
||||
|
||||
@@ -5268,6 +5277,7 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate)
|
||||
{
|
||||
case 10: // Time for special stage
|
||||
sstimer = (sector->floorheight>>FRACBITS) * TICRATE + 6; // Time to finish
|
||||
totalrings = sector->ceilingheight>>FRACBITS; // Ring count for special stage
|
||||
break;
|
||||
|
||||
case 11: // Custom global gravity!
|
||||
@@ -6280,7 +6290,9 @@ static void P_DoScrollMove(mobj_t *thing, fixed_t dx, fixed_t dy, INT32 exclusiv
|
||||
}
|
||||
}
|
||||
|
||||
if (thing->friction != ORIG_FRICTION)
|
||||
if (thing->player && (thing->player->pflags & PF_SPINNING) && (thing->player->rmomx || thing->player->rmomy) && !(thing->player->pflags & PF_STARTDASH))
|
||||
fuckaj = FixedDiv(549*ORIG_FRICTION,500*FRACUNIT);
|
||||
else if (thing->friction != ORIG_FRICTION)
|
||||
fuckaj = thing->friction;
|
||||
|
||||
if (fuckaj)
|
||||
@@ -7019,7 +7031,7 @@ static inline boolean PIT_PushThing(mobj_t *thing)
|
||||
return false;
|
||||
|
||||
// Allow this to affect pushable objects at some point?
|
||||
if (thing->player && (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP))))
|
||||
if (thing->player && (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) || UNLIKELY(thing->player->pflags & PF_NIGHTSMODE)))
|
||||
{
|
||||
INT32 dist;
|
||||
INT32 speed;
|
||||
@@ -7050,14 +7062,75 @@ static inline boolean PIT_PushThing(mobj_t *thing)
|
||||
// Written with bits and pieces of P_HomingAttack
|
||||
if ((speed > 0) && (P_CheckSight(thing, tmpusher->source)))
|
||||
{
|
||||
// only push wrt Z if health & 1 (mapthing has ambush flag)
|
||||
if (tmpusher->source->health & 1)
|
||||
if (LIKELY(!(thing->player->pflags & PF_NIGHTSMODE)))
|
||||
{
|
||||
// only push wrt Z if health & 1 (mapthing has ambush flag)
|
||||
if (tmpusher->source->health & 1)
|
||||
{
|
||||
fixed_t tmpmomx, tmpmomy, tmpmomz;
|
||||
|
||||
tmpmomx = FixedMul(FixedDiv(sx - thing->x, dist), speed);
|
||||
tmpmomy = FixedMul(FixedDiv(sy - thing->y, dist), speed);
|
||||
tmpmomz = FixedMul(FixedDiv(sz - thing->z, dist), speed);
|
||||
if (tmpusher->source->type == MT_PUSH) // away!
|
||||
{
|
||||
tmpmomx *= -1;
|
||||
tmpmomy *= -1;
|
||||
tmpmomz *= -1;
|
||||
}
|
||||
|
||||
thing->momx += tmpmomx;
|
||||
thing->momy += tmpmomy;
|
||||
thing->momz += tmpmomz;
|
||||
|
||||
if (thing->player)
|
||||
{
|
||||
thing->player->cmomx += tmpmomx;
|
||||
thing->player->cmomy += tmpmomy;
|
||||
thing->player->cmomx = FixedMul(thing->player->cmomx, ORIG_FRICTION);
|
||||
thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
angle_t pushangle;
|
||||
|
||||
pushangle = R_PointToAngle2(thing->x, thing->y, sx, sy);
|
||||
if (tmpusher->source->type == MT_PUSH)
|
||||
pushangle += ANGLE_180; // away
|
||||
pushangle >>= ANGLETOFINESHIFT;
|
||||
thing->momx += FixedMul(speed, FINECOSINE(pushangle));
|
||||
thing->momy += FixedMul(speed, FINESINE(pushangle));
|
||||
|
||||
if (thing->player)
|
||||
{
|
||||
thing->player->cmomx += FixedMul(speed, FINECOSINE(pushangle));
|
||||
thing->player->cmomy += FixedMul(speed, FINESINE(pushangle));
|
||||
thing->player->cmomx = FixedMul(thing->player->cmomx, ORIG_FRICTION);
|
||||
thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//NiGHTS-specific handling.
|
||||
//By default, pushes and pulls only affect the Z-axis.
|
||||
//By having the ambush flag, it affects the X-axis.
|
||||
//By having the object special flag, it affects the Y-axis.
|
||||
fixed_t tmpmomx, tmpmomy, tmpmomz;
|
||||
|
||||
tmpmomx = FixedMul(FixedDiv(sx - thing->x, dist), speed);
|
||||
tmpmomy = FixedMul(FixedDiv(sy - thing->y, dist), speed);
|
||||
if (tmpusher->source->health & 1)
|
||||
tmpmomx = FixedMul(FixedDiv(sx - thing->x, dist), speed);
|
||||
else
|
||||
tmpmomx = 0;
|
||||
|
||||
if (tmpusher->source->health & 2)
|
||||
tmpmomy = FixedMul(FixedDiv(sy - thing->y, dist), speed);
|
||||
else
|
||||
tmpmomy = 0;
|
||||
|
||||
tmpmomz = FixedMul(FixedDiv(sz - thing->z, dist), speed);
|
||||
|
||||
if (tmpusher->source->type == MT_PUSH) // away!
|
||||
{
|
||||
tmpmomx *= -1;
|
||||
@@ -7077,25 +7150,6 @@ static inline boolean PIT_PushThing(mobj_t *thing)
|
||||
thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
angle_t pushangle;
|
||||
|
||||
pushangle = R_PointToAngle2(thing->x, thing->y, sx, sy);
|
||||
if (tmpusher->source->type == MT_PUSH)
|
||||
pushangle += ANGLE_180; // away
|
||||
pushangle >>= ANGLETOFINESHIFT;
|
||||
thing->momx += FixedMul(speed, FINECOSINE(pushangle));
|
||||
thing->momy += FixedMul(speed, FINESINE(pushangle));
|
||||
|
||||
if (thing->player)
|
||||
{
|
||||
thing->player->cmomx += FixedMul(speed, FINECOSINE(pushangle));
|
||||
thing->player->cmomy += FixedMul(speed, FINESINE(pushangle));
|
||||
thing->player->cmomx = FixedMul(thing->player->cmomx, ORIG_FRICTION);
|
||||
thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+126
-17
@@ -193,8 +193,8 @@ boolean P_PlayerMoving(INT32 pnum)
|
||||
&& (abs(p->rmomx) >= FixedMul(FRACUNIT/2, p->mo->scale)
|
||||
|| abs(p->rmomy) >= FixedMul(FRACUNIT/2, p->mo->scale)
|
||||
|| abs(p->mo->momz) >= FixedMul(FRACUNIT/2, p->mo->scale)
|
||||
|| p->powers[pw_tailsfly]
|
||||
|| (p->pflags & PF_JUMPED));
|
||||
|| p->climbing || p->powers[pw_tailsfly]
|
||||
|| (p->pflags & PF_JUMPED) || (p->pflags & PF_SPINNING));
|
||||
}
|
||||
|
||||
// P_GetNextEmerald
|
||||
@@ -246,6 +246,16 @@ void P_GiveEmerald(boolean spawnObj)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_ResetScore
|
||||
//
|
||||
// This is called when your chain is reset.
|
||||
void P_ResetScore(player_t *player)
|
||||
{
|
||||
// Formally a host for Chaos mode behavior
|
||||
player->scoreadd = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// P_FindLowestLap
|
||||
//
|
||||
@@ -388,6 +398,9 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
|
||||
P_ResetPlayer(player);
|
||||
P_SetPlayerMobjState(player->mo, player->mo->info->painstate);
|
||||
player->powers[pw_flashing] = K_GetKartFlashing(player);
|
||||
|
||||
if (player->timeshit != UINT8_MAX)
|
||||
++player->timeshit;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -396,9 +409,15 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
|
||||
// Useful when you want to kill everything the player is doing.
|
||||
void P_ResetPlayer(player_t *player)
|
||||
{
|
||||
player->pflags &= ~(PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN|PF_JUMPED|PF_THOKKED|PF_CARRIED);
|
||||
player->pflags &= ~(PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN|PF_SPINNING|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_CARRIED);
|
||||
player->jumping = 0;
|
||||
player->secondjump = 0;
|
||||
player->glidetime = 0;
|
||||
player->homing = 0;
|
||||
player->climbing = 0;
|
||||
player->powers[pw_tailsfly] = 0;
|
||||
player->onconveyor = 0;
|
||||
player->skidtime = 0;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -415,6 +434,8 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings)
|
||||
if (!player->mo)
|
||||
return;
|
||||
|
||||
//player->mo->health += num_rings;
|
||||
//player->health += num_rings;
|
||||
player->totalring += num_rings;
|
||||
|
||||
//{ SRB2kart - rings don't really do anything, but we don't want the player spilling them later.
|
||||
@@ -1404,14 +1425,16 @@ static void P_CheckBustableBlocks(player_t *player)
|
||||
{
|
||||
// If it's an FF_SPINBUST, you have to either be jumping, or coming down
|
||||
// onto the top from a spin.
|
||||
if (rover->flags & FF_SPINBUST && !(player->pflags & PF_JUMPED))
|
||||
if (rover->flags & FF_SPINBUST && ((!(player->pflags & PF_JUMPED) && !(player->pflags & PF_SPINNING)) || (player->pflags & PF_STARTDASH)))
|
||||
continue;
|
||||
|
||||
// if it's not an FF_SHATTER, you must be spinning (and not jumping)
|
||||
// or have Knuckles's abilities (or Super Sonic)
|
||||
// ...or are drilling in NiGHTS (or Metal Sonic)
|
||||
if (!(rover->flags & FF_SHATTER) && !(rover->flags & FF_SPINBUST)
|
||||
&& (!player->powers[pw_super]))
|
||||
&& !((player->pflags & PF_SPINNING) && !(player->pflags & PF_JUMPED))
|
||||
&& (!player->powers[pw_super])
|
||||
&& !(player->pflags & PF_DRILLING))
|
||||
continue;
|
||||
|
||||
topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
||||
@@ -1583,11 +1606,31 @@ static void P_CheckBouncySectors(player_t *player)
|
||||
player->mo->momx = momentum.x;
|
||||
player->mo->momy = momentum.y;
|
||||
player->mo->momz = momentum.z/2;
|
||||
|
||||
if (player->pflags & PF_SPINNING)
|
||||
{
|
||||
player->pflags &= ~PF_SPINNING;
|
||||
player->pflags |= PF_JUMPED;
|
||||
player->pflags |= PF_THOKKED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->momx = -FixedMul(player->mo->momx,linedist);
|
||||
player->mo->momy = -FixedMul(player->mo->momy,linedist);
|
||||
|
||||
if (player->pflags & PF_SPINNING)
|
||||
{
|
||||
player->pflags &= ~PF_SPINNING;
|
||||
player->pflags |= PF_JUMPED;
|
||||
player->pflags |= PF_THOKKED;
|
||||
}
|
||||
}
|
||||
|
||||
if ((player->pflags & PF_SPINNING) && player->speed < FixedMul(1<<FRACBITS, player->mo->scale) && player->mo->momz)
|
||||
{
|
||||
player->pflags &= ~PF_SPINNING;
|
||||
player->pflags |= PF_JUMPED;
|
||||
}
|
||||
|
||||
goto bouncydone;
|
||||
@@ -1699,7 +1742,7 @@ static void P_DoBubbleBreath(player_t *player)
|
||||
else
|
||||
zh = player->mo->z + FixedDiv(player->mo->height,5*(FRACUNIT/4));
|
||||
|
||||
if (!(player->mo->eflags & MFE_UNDERWATER) || player->spectator || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL))
|
||||
if (!(player->mo->eflags & MFE_UNDERWATER) || player->spectator || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)))
|
||||
return;
|
||||
|
||||
if (P_RandomChance(FRACUNIT/16))
|
||||
@@ -1779,7 +1822,10 @@ void P_DoJumpShield(player_t *player)
|
||||
|
||||
player->pflags &= ~PF_JUMPED;
|
||||
//P_DoJump(player, false);
|
||||
player->secondjump = 0;
|
||||
player->jumping = 0;
|
||||
player->pflags |= PF_THOKKED;
|
||||
player->pflags &= ~PF_SPINNING;
|
||||
//P_SetPlayerMobjState(player->mo, S_PLAY_FALL1);
|
||||
S_StartSound(player->mo, sfx_wdjump);
|
||||
}
|
||||
@@ -1868,7 +1914,7 @@ static void P_3dMovement(player_t *player)
|
||||
cmd->forwardmove = 50;
|
||||
}
|
||||
|
||||
if (!player->kartstuff[k_pogospring])
|
||||
if (!(player->pflags & PF_FORCESTRAFE) && !player->kartstuff[k_pogospring])
|
||||
cmd->sidemove = 0;
|
||||
|
||||
if (analogmove)
|
||||
@@ -2160,6 +2206,8 @@ static void P_MovePlayer(player_t *player)
|
||||
// Control relinquishing stuff!
|
||||
if (player->powers[pw_ingoop])
|
||||
player->pflags |= PF_FULLSTASIS;
|
||||
else if (player->pflags & PF_GLIDING && player->skidtime)
|
||||
player->pflags |= PF_FULLSTASIS;
|
||||
else if (player->powers[pw_nocontrol])
|
||||
{
|
||||
player->pflags |= PF_STASIS;
|
||||
@@ -2185,6 +2233,8 @@ static void P_MovePlayer(player_t *player)
|
||||
if (!(player->pflags & PF_TAGIT))
|
||||
{
|
||||
forcestasis = true;
|
||||
if (player->pflags & PF_TAGGED) // Already hit.
|
||||
player->powers[pw_flashing] = 5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2344,18 +2394,28 @@ static void P_MovePlayer(player_t *player)
|
||||
//////////////////
|
||||
|
||||
// Make sure you're not "jumping" on the ground
|
||||
if (onground && player->pflags & PF_JUMPED
|
||||
if (onground && player->pflags & PF_JUMPED && !(player->pflags & PF_GLIDING)
|
||||
&& P_MobjFlip(player->mo)*player->mo->momz < 0)
|
||||
{
|
||||
player->pflags &= ~PF_JUMPED;
|
||||
player->jumping = 0;
|
||||
player->secondjump = 0;
|
||||
player->pflags &= ~PF_THOKKED;
|
||||
P_SetPlayerMobjState(player->mo, S_KART_STND1); // SRB2kart - was S_PLAY_STND
|
||||
}
|
||||
|
||||
if (UNLIKELY(player->gotflag)) // If you can't glide, then why the heck would you be gliding?
|
||||
{
|
||||
player->pflags &= ~PF_GLIDING;
|
||||
player->glidetime = 0;
|
||||
player->climbing = 0;
|
||||
}
|
||||
|
||||
// If you're running fast enough, you can create splashes as you run in shallow water.
|
||||
if (((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height >= player->mo->watertop && player->mo->z <= player->mo->watertop)
|
||||
if (!player->climbing
|
||||
&& ((!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z + player->mo->height >= player->mo->watertop && player->mo->z <= player->mo->watertop)
|
||||
|| (player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height >= player->mo->waterbottom && player->mo->z <= player->mo->waterbottom))
|
||||
&& (player->speed > runspd)
|
||||
&& (player->speed > runspd || (player->pflags & PF_STARTDASH))
|
||||
&& leveltime % (TICRATE/7) == 0 && player->mo->momz == 0 && !(player->pflags & PF_SLIDING) && !player->spectator)
|
||||
{
|
||||
mobj_t *water = P_SpawnMobj(player->mo->x, player->mo->y,
|
||||
@@ -3467,7 +3527,7 @@ static boolean P_CheckNoclipCameraPosition(player_t *player, camera_t *thiscam,
|
||||
boolean cameranoclip;
|
||||
mobj_t *mo = player->mo;
|
||||
|
||||
cameranoclip = ((player->pflags & PF_NOCLIP)
|
||||
cameranoclip = ((player->pflags & (PF_NOCLIP|PF_NIGHTSMODE))
|
||||
|| (mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)) // Noclipping player camera noclips too!!
|
||||
|| (leveltime < introtime)); // Kart intro cam
|
||||
|
||||
@@ -4053,7 +4113,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
angle -= (angle - thiscam->pitch)/2;
|
||||
}
|
||||
|
||||
if (player->playerstate != PST_DEAD)
|
||||
if (player->playerstate != PST_DEAD && LIKELY(!((player->pflags & PF_NIGHTSMODE) && player->exiting)))
|
||||
angle += (focusaiming < ANGLE_180 ? focusaiming/2 : InvAngle(InvAngle(focusaiming)/2)); // overcomplicated version of '((signed)focusaiming)/2;'
|
||||
|
||||
if (!camstill && !timeover) // Keep the view still...
|
||||
@@ -4824,7 +4884,8 @@ void P_PlayerThink(player_t *player)
|
||||
}
|
||||
|
||||
// Even if not NiGHTS, pull in nearby objects when walking around as John Q. Elliot.
|
||||
if (UNLIKELY(maptol & TOL_NIGHTS && !objectplacing && !((netgame || multiplayer) && player->spectator)))
|
||||
if (UNLIKELY(!objectplacing && !((netgame || multiplayer) && player->spectator)
|
||||
&& maptol & TOL_NIGHTS && (!(player->pflags & PF_NIGHTSMODE) || player->powers[pw_nights_helper])))
|
||||
{
|
||||
thinker_t *th;
|
||||
mobj_t *mo2;
|
||||
@@ -4869,6 +4930,7 @@ void P_PlayerThink(player_t *player)
|
||||
{
|
||||
P_DoZoomTube(player);
|
||||
player->rmomx = player->rmomy = 0; // no actual momentum from your controls
|
||||
P_ResetScore(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4925,10 +4987,26 @@ void P_PlayerThink(player_t *player)
|
||||
#endif
|
||||
|
||||
// check for use
|
||||
if (cmd->buttons & BT_BRAKE)
|
||||
player->pflags |= PF_USEDOWN;
|
||||
else
|
||||
player->pflags &= ~PF_USEDOWN;
|
||||
if (LIKELY(!(player->pflags & PF_NIGHTSMODE)))
|
||||
{
|
||||
if (cmd->buttons & BT_BRAKE)
|
||||
player->pflags |= PF_USEDOWN;
|
||||
else
|
||||
player->pflags &= ~PF_USEDOWN;
|
||||
}
|
||||
else if (player->mo->tracer) // match tracer's position with yours when NiGHTS
|
||||
{
|
||||
P_UnsetThingPosition(player->mo->tracer);
|
||||
player->mo->tracer->x = player->mo->x;
|
||||
player->mo->tracer->y = player->mo->y;
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
player->mo->tracer->z = player->mo->z + player->mo->height - player->mo->tracer->height;
|
||||
else
|
||||
player->mo->tracer->z = player->mo->z;
|
||||
player->mo->tracer->floorz = player->mo->floorz;
|
||||
player->mo->tracer->ceilingz = player->mo->ceilingz;
|
||||
P_SetThingPosition(player->mo->tracer);
|
||||
}
|
||||
|
||||
// Counters, time dependent power ups.
|
||||
// Time Bonus & Ring Bonus count settings
|
||||
@@ -4985,9 +5063,34 @@ void P_PlayerThink(player_t *player)
|
||||
if (player->bumpertime)
|
||||
player->bumpertime--;
|
||||
|
||||
if (player->skidtime)
|
||||
player->skidtime--;
|
||||
|
||||
if (player->weapondelay)
|
||||
player->weapondelay--;
|
||||
|
||||
if (player->tossdelay)
|
||||
player->tossdelay--;
|
||||
|
||||
if (player->homing)
|
||||
player->homing--;
|
||||
|
||||
if (player->texttimer)
|
||||
{
|
||||
--player->texttimer;
|
||||
if (!player->texttimer && !player->exiting && player->textvar >= 4)
|
||||
{
|
||||
player->texttimer = 4*TICRATE;
|
||||
player->textvar = 2; // GET n RINGS!
|
||||
|
||||
if (player->capsule && player->capsule->health != player->capsule->spawnpoint->angle)
|
||||
player->textvar++; // GET n MORE RINGS!
|
||||
}
|
||||
}
|
||||
|
||||
if (player->losstime && !player->powers[pw_flashing])
|
||||
player->losstime--;
|
||||
|
||||
if (cv_squishdance.value && (cmd->buttons & BT_CUSTOM3))
|
||||
{
|
||||
player->squishdance.countdown++;
|
||||
@@ -5070,6 +5173,11 @@ void P_PlayerAfterThink(player_t *player)
|
||||
}
|
||||
}
|
||||
|
||||
if (UNLIKELY(player->pflags & PF_NIGHTSMODE))
|
||||
{
|
||||
player->powers[pw_gravityboots] = 0;
|
||||
}
|
||||
|
||||
if (player->pflags & PF_SLIDING)
|
||||
P_SetPlayerMobjState(player->mo, player->mo->info->painstate);
|
||||
|
||||
@@ -5082,6 +5190,7 @@ void P_PlayerAfterThink(player_t *player)
|
||||
player->mo->momz = (player->mo->tracer->z - (player->mo->height-player->mo->tracer->height/2) - player->mo->z)*2;
|
||||
P_MoveOrigin(player->mo, player->mo->tracer->x, player->mo->tracer->y, player->mo->tracer->z - (player->mo->height-player->mo->tracer->height/2));
|
||||
player->pflags |= PF_JUMPED;
|
||||
player->secondjump = 0;
|
||||
player->pflags &= ~PF_THOKKED;
|
||||
|
||||
if (cmd->forwardmove > 0)
|
||||
|
||||
@@ -338,6 +338,8 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
||||
if (player->mo)
|
||||
player->mo->skin = skin;
|
||||
|
||||
player->charflags = (UINT32)skin->flags;
|
||||
|
||||
// SRB2kart
|
||||
player->kartspeed = skin->kartspeed;
|
||||
player->kartweight = skin->kartweight;
|
||||
|
||||
Reference in new issue
Block a user