This commit is contained in:
Rachael Alexanderson 2017-04-09 11:53:40 -04:00
commit 00531cda49
4 changed files with 400 additions and 229 deletions

View File

@ -1003,12 +1003,12 @@ void gl_RenderModel(GLSprite * spr)
}
// Added MDL_USEACTORPITCH and MDL_USEACTORROLL flags processing.
// If both flags MDL_USEACTORPITCH and MDL_PITCHFROMMOMENTUM are set, the pitch sums up the actor pitch and the momentum vector pitch.
// If both flags MDL_USEACTORPITCH and MDL_PITCHFROMMOMENTUM are set, the pitch sums up the actor pitch and the velocity vector pitch.
if (smf->flags & MDL_USEACTORPITCH)
{
double d = spr->actor->Angles.Pitch.Degrees;
if (smf->flags & MDL_BADROTATION) pitch -= d;
else pitch += d;
if (smf->flags & MDL_BADROTATION) pitch += d;
else pitch -= d;
}
if(smf->flags & MDL_USEACTORROLL) roll += spr->actor->Angles.Roll.Degrees;

View File

@ -2385,6 +2385,7 @@ void P_DeathThink (player_t *player)
int dir;
DAngle delta;
player->Uncrouch();
player->TickPSprites();
player->onground = (player->mo->Z() <= player->mo->floorz);
@ -2524,28 +2525,12 @@ void P_CrouchMove(player_t * player, int direction)
//----------------------------------------------------------------------------
//
// PROC P_PlayerThink
// PROC P_CheckFOV
//
//----------------------------------------------------------------------------
void P_PlayerThink (player_t *player)
void P_CheckFOV(player_t *player)
{
ticcmd_t *cmd;
if (player->mo == NULL)
{
I_Error ("No player %td start\n", player - players + 1);
}
if (debugfile && !(player->cheats & CF_PREDICTING))
{
fprintf (debugfile, "tic %d for pl %d: (%f, %f, %f, %f) b:%02x p:%d y:%d f:%d s:%d u:%d\n",
gametic, (int)(player-players), player->mo->X(), player->mo->Y(), player->mo->Z(),
player->mo->Angles.Yaw.Degrees, player->cmd.ucmd.buttons,
player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove,
player->cmd.ucmd.sidemove, player->cmd.ucmd.upmove);
}
// [RH] Zoom the player's FOV
float desired = player->DesiredFOV;
// Adjust FOV using on the currently held weapon.
@ -2559,7 +2544,7 @@ void P_PlayerThink (player_t *player)
}
if (player->FOV != desired)
{
if (fabsf (player->FOV - desired) < 7.f)
if (fabsf(player->FOV - desired) < 7.f)
{
player->FOV = desired;
}
@ -2576,13 +2561,16 @@ void P_PlayerThink (player_t *player)
}
}
}
if (player->inventorytics)
{
player->inventorytics--;
}
// Don't interpolate the view for more than one tic
player->cheats &= ~CF_INTERPVIEW;
}
//----------------------------------------------------------------------------
//
// PROC P_CheckCheats
//
//----------------------------------------------------------------------------
void P_CheckCheats(player_t *player)
{
// No-clip cheat
if ((player->cheats & (CF_NOCLIP | CF_NOCLIP2)) == CF_NOCLIP2)
{ // No noclip2 without noclip
@ -2604,20 +2592,18 @@ void P_PlayerThink (player_t *player)
{
player->mo->flags &= ~MF_NOGRAVITY;
}
cmd = &player->cmd;
}
// Make unmodified copies for ACS's GetPlayerInput.
player->original_oldbuttons = player->original_cmd.buttons;
player->original_cmd = cmd->ucmd;
if (player->mo->flags & MF_JUSTATTACKED)
{ // Chainsaw/Gauntlets attack auto forward motion
cmd->ucmd.yaw = 0;
cmd->ucmd.forwardmove = 0xc800/2;
cmd->ucmd.sidemove = 0;
player->mo->flags &= ~MF_JUSTATTACKED;
}
//----------------------------------------------------------------------------
//
// PROC P_CheckFrozen
//
//----------------------------------------------------------------------------
bool P_CheckFrozen(player_t *player)
{
auto cmd = &player->cmd;
bool totallyfrozen = P_IsPlayerTotallyFrozen(player);
// [RH] Being totally frozen zeros out most input parameters.
@ -2645,8 +2631,17 @@ void P_PlayerThink (player_t *player)
cmd->ucmd.sidemove = 0;
cmd->ucmd.upmove = 0;
}
return totallyfrozen;
}
// Handle crouching
//----------------------------------------------------------------------------
//
// PROC P_CheckCrouch
//
//----------------------------------------------------------------------------
void P_CheckCrouch(player_t *player, bool totallyfrozen)
{
if (player->cmd.ucmd.buttons & BT_JUMP)
{
player->cmd.ucmd.buttons &= ~BT_CROUCH;
@ -2682,7 +2677,16 @@ void P_PlayerThink (player_t *player)
}
player->crouchoffset = -(player->mo->ViewHeight) * (1 - player->crouchfactor);
}
//----------------------------------------------------------------------------
//
// PROC P_CheckMusicChange
//
//----------------------------------------------------------------------------
void P_CheckMusicChange(player_t *player)
{
// MUSINFO stuff
if (player->MUSINFOtics >= 0 && player->MUSINFOactor != NULL)
{
@ -2707,26 +2711,16 @@ void P_PlayerThink (player_t *player)
DPrintf(DMSG_NOTIFY, "MUSINFO change for player %d to %d\n", (int)(player - players), player->MUSINFOactor->args[0]);
}
}
}
if (player->playerstate == PST_DEAD)
{
player->Uncrouch();
P_DeathThink (player);
return;
}
if (player->jumpTics != 0)
{
player->jumpTics--;
if (player->onground && player->jumpTics < -18)
{
player->jumpTics = 0;
}
}
if (player->morphTics && !(player->cheats & CF_PREDICTING))
{
player->mo->MorphPlayerThink ();
}
//----------------------------------------------------------------------------
//
// PROC P_CheckPitch
//
//----------------------------------------------------------------------------
void P_CheckPitch(player_t *player)
{
// [RH] Look up/down stuff
if (!level.IsFreelookAllowed())
{
@ -2738,7 +2732,7 @@ void P_PlayerThink (player_t *player)
// which translates to about half a screen height up and (more than)
// one full screen height down from straight ahead when view panning
// is used.
int clook = cmd->ucmd.pitch;
int clook = player->cmd.ucmd.pitch;
if (clook != 0)
{
if (clook == -32768)
@ -2768,24 +2762,18 @@ void P_PlayerThink (player_t *player)
}
}
}
}
// [RH] Check for fast turn around
if (cmd->ucmd.buttons & BT_TURN180 && !(player->oldbuttons & BT_TURN180))
{
player->turnticks = TURN180_TICKS;
}
// Handle movement
if (player->mo->reactiontime)
{ // Player is frozen
player->mo->reactiontime--;
}
else
{
P_MovePlayer (player);
//----------------------------------------------------------------------------
//
// PROC P_CheckJump
//
//----------------------------------------------------------------------------
void P_CheckJump(player_t *player)
{
// [RH] check for jump
if (cmd->ucmd.buttons & BT_JUMP)
if (player->cmd.ucmd.buttons & BT_JUMP)
{
if (player->crouchoffset != 0)
{
@ -2824,6 +2812,17 @@ void P_PlayerThink (player_t *player)
S_Sound(player->mo, CHAN_BODY, "*jump", 1, ATTN_NORM);
}
}
}
//----------------------------------------------------------------------------
//
// PROC P_CheckMoveUpDown
//
//----------------------------------------------------------------------------
void P_CheckMoveUpDown(player_t *player)
{
auto cmd = &player->cmd;
if (cmd->ucmd.upmove == -32768)
{ // Only land if in the air
@ -2846,27 +2845,32 @@ void P_PlayerThink (player_t *player)
player->mo->flags |= MF_NOGRAVITY;
if ((player->mo->Vel.Z <= -39) && !(player->cheats & CF_PREDICTING))
{ // Stop falling scream
S_StopSound (player->mo, CHAN_VOICE);
S_StopSound(player->mo, CHAN_VOICE);
}
}
}
else if (cmd->ucmd.upmove > 0 && !(player->cheats & CF_PREDICTING))
{
AInventory *fly = player->mo->FindInventory (NAME_ArtiFly);
AInventory *fly = player->mo->FindInventory(NAME_ArtiFly);
if (fly != NULL)
{
player->mo->UseInventory (fly);
}
player->mo->UseInventory(fly);
}
}
}
}
P_CalcHeight (player);
if (!(player->cheats & CF_PREDICTING))
{
P_PlayerOnSpecial3DFloor (player);
P_PlayerInSpecialSector (player);
//----------------------------------------------------------------------------
//
// PROC P_CheckEnviroment
//
//----------------------------------------------------------------------------
void P_CheckEnvironment(player_t *player)
{
P_PlayerOnSpecial3DFloor(player);
P_PlayerInSpecialSector(player);
if (!player->mo->isAbove(player->mo->Sector->floorplane.ZatPoint(player->mo)) ||
player->mo->waterlevel)
@ -2878,14 +2882,24 @@ void P_PlayerThink (player_t *player)
player->mo->Vel.Z >= -player->mo->FallingScreamMaxSpeed && !player->morphTics &&
player->mo->waterlevel == 0)
{
int id = S_FindSkinnedSound (player->mo, "*falling");
if (id != 0 && !S_IsActorPlayingSomething (player->mo, CHAN_VOICE, id))
int id = S_FindSkinnedSound(player->mo, "*falling");
if (id != 0 && !S_IsActorPlayingSomething(player->mo, CHAN_VOICE, id))
{
S_Sound (player->mo, CHAN_VOICE, id, 1, ATTN_NORM);
S_Sound(player->mo, CHAN_VOICE, id, 1, ATTN_NORM);
}
}
}
//----------------------------------------------------------------------------
//
// PROC P_CheckUse
//
//----------------------------------------------------------------------------
void P_CheckUse(player_t *player)
{
// check for use
if (cmd->ucmd.buttons & BT_USE)
if (player->cmd.ucmd.buttons & BT_USE)
{
if (!player->usedown)
{
@ -2900,6 +2914,16 @@ void P_PlayerThink (player_t *player)
{
player->usedown = false;
}
}
//----------------------------------------------------------------------------
//
// PROC P_CheckUndoMorph
//
//----------------------------------------------------------------------------
void P_CheckUndoMorph(player_t *player)
{
// Morph counter
if (player->morphTics)
{
@ -2909,9 +2933,185 @@ void P_PlayerThink (player_t *player)
}
if (!--player->morphTics)
{ // Attempt to undo the chicken/pig
P_UndoPlayerMorph (player, player, MORPH_UNDOBYTIMEOUT);
P_UndoPlayerMorph(player, player, MORPH_UNDOBYTIMEOUT);
}
}
}
//----------------------------------------------------------------------------
//
// PROC P_CheckPoison
//
//----------------------------------------------------------------------------
void P_CheckPoison(player_t *player)
{
if (player->poisoncount && !(level.time & 15))
{
player->poisoncount -= 5;
if (player->poisoncount < 0)
{
player->poisoncount = 0;
}
P_PoisonDamage(player, player->poisoner, 1, true);
}
}
//----------------------------------------------------------------------------
//
// PROC P_CheckDegeneration
//
//----------------------------------------------------------------------------
void P_CheckDegeneration(player_t *player)
{
// Apply degeneration.
if (dmflags2 & DF2_YES_DEGENERATION)
{
int maxhealth = player->mo->GetMaxHealth(true);
if ((level.time % TICRATE) == 0 && player->health > maxhealth)
{
if (player->health - 5 < maxhealth)
player->health = maxhealth;
else
player->health--;
player->mo->health = player->health;
}
}
}
//----------------------------------------------------------------------------
//
// PROC P_CheckAirSupply
//
//----------------------------------------------------------------------------
void P_CheckAirSupply(player_t *player)
{
// Handle air supply
//if (level.airsupply > 0)
{
if (player->mo->waterlevel < 3 ||
(player->mo->flags2 & MF2_INVULNERABLE) ||
(player->cheats & (CF_GODMODE | CF_NOCLIP2)) ||
(player->cheats & CF_GODMODE2))
{
player->mo->ResetAirSupply();
}
else if (player->air_finished <= level.time && !(level.time & 31))
{
P_DamageMobj(player->mo, NULL, NULL, 2 + ((level.time - player->air_finished) / TICRATE), NAME_Drowning);
}
}
}
//----------------------------------------------------------------------------
//
// PROC P_HandleMovement
//
//----------------------------------------------------------------------------
void P_HandleMovement(player_t *player)
{
// [RH] Check for fast turn around
if (player->cmd.ucmd.buttons & BT_TURN180 && !(player->oldbuttons & BT_TURN180))
{
player->turnticks = TURN180_TICKS;
}
// Handle movement
if (player->mo->reactiontime)
{ // Player is frozen
player->mo->reactiontime--;
}
else
{
P_MovePlayer(player);
P_CheckJump(player);
P_CheckMoveUpDown(player);
}
}
//----------------------------------------------------------------------------
//
// PROC P_PlayerThink
//
//----------------------------------------------------------------------------
void P_PlayerThink (player_t *player)
{
ticcmd_t *cmd = &player->cmd;
if (player->mo == NULL)
{
I_Error ("No player %td start\n", player - players + 1);
}
if (debugfile && !(player->cheats & CF_PREDICTING))
{
fprintf (debugfile, "tic %d for pl %d: (%f, %f, %f, %f) b:%02x p:%d y:%d f:%d s:%d u:%d\n",
gametic, (int)(player-players), player->mo->X(), player->mo->Y(), player->mo->Z(),
player->mo->Angles.Yaw.Degrees, player->cmd.ucmd.buttons,
player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove,
player->cmd.ucmd.sidemove, player->cmd.ucmd.upmove);
}
// Make unmodified copies for ACS's GetPlayerInput.
player->original_oldbuttons = player->original_cmd.buttons;
player->original_cmd = cmd->ucmd;
// Don't interpolate the view for more than one tic
player->cheats &= ~CF_INTERPVIEW;
P_CheckFOV(player);
if (player->inventorytics)
{
player->inventorytics--;
}
P_CheckCheats(player);
if (player->mo->flags & MF_JUSTATTACKED)
{ // Chainsaw/Gauntlets attack auto forward motion
cmd->ucmd.yaw = 0;
cmd->ucmd.forwardmove = 0xc800/2;
cmd->ucmd.sidemove = 0;
player->mo->flags &= ~MF_JUSTATTACKED;
}
bool totallyfrozen = P_CheckFrozen(player);
// Handle crouching
P_CheckCrouch(player, totallyfrozen);
P_CheckMusicChange(player);
if (player->playerstate == PST_DEAD)
{
P_DeathThink (player);
return;
}
if (player->jumpTics != 0)
{
player->jumpTics--;
if (player->onground && player->jumpTics < -18)
{
player->jumpTics = 0;
}
}
if (player->morphTics && !(player->cheats & CF_PREDICTING))
{
player->mo->MorphPlayerThink ();
}
P_CheckPitch(player);
P_HandleMovement(player);
P_CalcHeight (player);
if (!(player->cheats & CF_PREDICTING))
{
P_CheckEnvironment(player);
P_CheckUse(player);
P_CheckUndoMorph(player);
// Cycle psprites
player->TickPSprites();
@ -2929,46 +3129,9 @@ void P_PlayerThink (player_t *player)
P_DamageMobj (player->mo, NULL, NULL, 5, player->hazardtype);
}
if (player->poisoncount && !(level.time & 15))
{
player->poisoncount -= 5;
if (player->poisoncount < 0)
{
player->poisoncount = 0;
}
P_PoisonDamage (player, player->poisoner, 1, true);
}
// Apply degeneration.
if (dmflags2 & DF2_YES_DEGENERATION)
{
int maxhealth = player->mo->GetMaxHealth(true);
if ((level.time % TICRATE) == 0 && player->health > maxhealth)
{
if (player->health - 5 < maxhealth)
player->health = maxhealth;
else
player->health--;
player->mo->health = player->health;
}
}
// Handle air supply
//if (level.airsupply > 0)
{
if (player->mo->waterlevel < 3 ||
(player->mo->flags2 & MF2_INVULNERABLE) ||
(player->cheats & (CF_GODMODE | CF_NOCLIP2)) ||
(player->cheats & CF_GODMODE2))
{
player->mo->ResetAirSupply ();
}
else if (player->air_finished <= level.time && !(level.time & 31))
{
P_DamageMobj (player->mo, NULL, NULL, 2 + ((level.time-player->air_finished)/TICRATE), NAME_Drowning);
}
}
P_CheckPoison(player);
P_CheckDegeneration(player);
P_CheckAirSupply(player);
}
}

View File

@ -130,18 +130,26 @@ class Weapon : StateProvider native
{
player.mo.PlayAttacking2 ();
}
Weapon weapon = player.ReadyWeapon;
state flashstate = null;
if (flashlabel == null)
{
if (player.ReadyWeapon.bAltFire)
if (weapon.bAltFire)
{
flashlabel = 'AltFlash';
flashstate = weapon.FindState('AltFlash');
}
if (flashlabel == null)
if (flashstate == null)
{
flashlabel = 'Flash';
flashstate = weapon.FindState('Flash');
}
}
player.SetPsprite(PSP_FLASH, player.ReadyWeapon.FindState(flashlabel));
else
{
flashstate = weapon.FindState(flashlabel);
}
player.SetPsprite(PSP_FLASH, flashstate);
}
//---------------------------------------------------------------------------

View File

@ -144,7 +144,7 @@ class PlayerPawn : Actor native
if (mod == 'Telefrag') return "$OB_MPTELEFRAG";
String message;
if (inflictor != NULL)
if (inflictor != NULL && inflictor != self)
{
message = inflictor.GetObituary(victim, inflictor, mod, playerattack);
}