- added NeuralStunner's player.userange submission, but changed it to use the value directly from the PlayerPawn data.

- bumped savegame version for addition of APlayerPawn::userange.
This commit is contained in:
Christoph Oelckers 2013-07-22 22:37:50 +02:00
parent db562142f0
commit 83bd8ba1b8
6 changed files with 32 additions and 7 deletions

View file

@ -140,6 +140,7 @@ public:
int SpawnMask; int SpawnMask;
FNameNoInit MorphWeapon; FNameNoInit MorphWeapon;
fixed_t AttackZOffset; // attack height, relative to player center fixed_t AttackZOffset; // attack height, relative to player center
fixed_t UseRange; // [NS] Distance at which player can +use
const PClass *FlechetteType; const PClass *FlechetteType;
// [CW] Fades for when you are being damaged. // [CW] Fades for when you are being damaged.

View file

@ -4359,14 +4359,17 @@ bool P_NoWayTraverse (AActor *usething, fixed_t endx, fixed_t endy)
void P_UseLines (player_t *player) void P_UseLines (player_t *player)
{ {
angle_t angle; angle_t angle;
fixed_t x1, y1; fixed_t x1, y1, usedist;
bool foundline; bool foundline;
foundline = false; foundline = false;
angle = player->mo->angle >> ANGLETOFINESHIFT; angle = player->mo->angle >> ANGLETOFINESHIFT;
x1 = player->mo->x + (USERANGE>>FRACBITS)*finecosine[angle]; usedist = player->mo->UseRange;
y1 = player->mo->y + (USERANGE>>FRACBITS)*finesine[angle];
// [NS] Now queries the Player's UseRange.
x1 = player->mo->x + FixedMul(usedist, finecosine[angle]);
y1 = player->mo->y + FixedMul(usedist, finesine[angle]);
// old code: // old code:
// //
@ -4398,13 +4401,20 @@ void P_UseLines (player_t *player)
bool P_UsePuzzleItem (AActor *PuzzleItemUser, int PuzzleItemType) bool P_UsePuzzleItem (AActor *PuzzleItemUser, int PuzzleItemType)
{ {
int angle; int angle;
fixed_t x1, y1, x2, y2; fixed_t x1, y1, x2, y2, usedist;
angle = PuzzleItemUser->angle>>ANGLETOFINESHIFT; angle = PuzzleItemUser->angle>>ANGLETOFINESHIFT;
x1 = PuzzleItemUser->x; x1 = PuzzleItemUser->x;
y1 = PuzzleItemUser->y; y1 = PuzzleItemUser->y;
x2 = x1+(USERANGE>>FRACBITS)*finecosine[angle];
y2 = y1+(USERANGE>>FRACBITS)*finesine[angle]; // [NS] If it's a Player, get their UseRange.
if (PuzzleItemUser->player)
usedist = PuzzleItemUser->player->mo->UseRange;
else
usedist = USERANGE;
x2 = x1 + FixedMul(usedist, finecosine[angle]);
y2 = y1 + FixedMul(usedist, finesine[angle]);
FPathTraverse it(x1, y1, x2, y2, PT_ADDLINES|PT_ADDTHINGS); FPathTraverse it(x1, y1, x2, y2, PT_ADDLINES|PT_ADDTHINGS);
intercept_t *in; intercept_t *in;

View file

@ -474,6 +474,10 @@ void APlayerPawn::Serialize (FArchive &arc)
{ {
arc << GruntSpeed << FallingScreamMinSpeed << FallingScreamMaxSpeed; arc << GruntSpeed << FallingScreamMinSpeed << FallingScreamMaxSpeed;
} }
if (SaveVersion >= 4502)
{
arc << UseRange;
}
} }
//=========================================================================== //===========================================================================

View file

@ -2410,6 +2410,15 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, viewheight, F, PlayerPawn)
defaults->ViewHeight = z; defaults->ViewHeight = z;
} }
//==========================================================================
//
//==========================================================================
DEFINE_CLASS_PROPERTY_PREFIX(player, userange, F, PlayerPawn)
{
PROP_FIXED_PARM(z, 0);
defaults->UseRange = z;
}
//========================================================================== //==========================================================================
// //
//========================================================================== //==========================================================================

View file

@ -76,7 +76,7 @@ const char *GetVersionString();
// Use 4500 as the base git save version, since it's higher than the // Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got. // SVN revision ever got.
#define SAVEVER 4501 #define SAVEVER 4502
#define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY2(x) #x
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)

View file

@ -24,6 +24,7 @@ Actor PlayerPawn : Actor native
Player.GruntSpeed 12 Player.GruntSpeed 12
Player.FallingScreamSpeed 35,40 Player.FallingScreamSpeed 35,40
Player.ViewHeight 41 Player.ViewHeight 41
Player.UseRange 64
Player.ForwardMove 1,1 Player.ForwardMove 1,1
Player.SideMove 1,1 Player.SideMove 1,1
Player.ColorRange 0,0 Player.ColorRange 0,0