mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 12:11:25 +00:00
- Added A_ZoomFactor. This lets weapons scale their player's FOV. Each weapon
maintains its own FOV scale independent from any other weapons the player may have. - Fixed: When parsing DECORATE functions that were not exported, the parser crashed after giving you the warning. SVN r1688 (trunk)
This commit is contained in:
parent
f32b95d3cc
commit
ed0d804792
6 changed files with 78 additions and 29 deletions
|
@ -1,4 +1,11 @@
|
|||
June 27, 2009
|
||||
June 30, 2009
|
||||
- Added A_ZoomFactor. This lets weapons scale their player's FOV. Each weapon
|
||||
maintains its own FOV scale independent from any other weapons the player
|
||||
may have.
|
||||
- Fixed: When parsing DECORATE functions that were not exported, the parser
|
||||
crashed after giving you the warning.
|
||||
|
||||
June 27, 2009
|
||||
- Fixed some improper preprocessor lines in autostart/autozend.cpp.
|
||||
- Added XInput support. For the benefit of people compiling with MinGW,
|
||||
the CMakeLists.txt checks for xinput.h and disables it if it cannot
|
||||
|
|
|
@ -264,6 +264,7 @@ public:
|
|||
TObjPtr<AAmmo> Ammo1, Ammo2;
|
||||
TObjPtr<AWeapon> SisterWeapon;
|
||||
bool GivenAsMorphWeapon;
|
||||
float FOVScale;
|
||||
|
||||
bool bAltFire; // Set when this weapon's alternate fire is used.
|
||||
|
||||
|
|
|
@ -59,6 +59,10 @@ void AWeapon::Serialize (FArchive &arc)
|
|||
<< Ammo1 << Ammo2 << SisterWeapon << GivenAsMorphWeapon
|
||||
<< bAltFire
|
||||
<< ReloadCounter;
|
||||
if (SaveVersion >= 1688)
|
||||
{
|
||||
arc << FOVScale;
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -1690,3 +1694,27 @@ const PClass *Net_ReadWeapon(BYTE **stream)
|
|||
}
|
||||
return Weapons_ntoh[index];
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_ZoomFactor
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AWeapon, A_ZoomFactor)
|
||||
{
|
||||
ACTION_PARAM_START(2);
|
||||
ACTION_PARAM_FLOAT(zoom, 0);
|
||||
ACTION_PARAM_INT(flags, 1);
|
||||
|
||||
if (self->player != NULL && self->player->ReadyWeapon != NULL)
|
||||
{
|
||||
zoom = 1 / clamp(zoom, 0.1f, 50.f);
|
||||
self->player->ReadyWeapon->FOVScale = zoom;
|
||||
if (flags & 1)
|
||||
{
|
||||
// Make the zoom instant.
|
||||
self->player->FOV = self->player->DesiredFOV * zoom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1996,16 +1996,24 @@ void P_PlayerThink (player_t *player)
|
|||
}
|
||||
|
||||
// [RH] Zoom the player's FOV
|
||||
if (player->FOV != player->DesiredFOV)
|
||||
float desired = player->DesiredFOV;
|
||||
// Adjust FOV using on the currently held weapon.
|
||||
if (player->playerstate != PST_DEAD && // No adjustment while dead.
|
||||
player->ReadyWeapon != NULL && // No adjustment if no weapon.
|
||||
player->ReadyWeapon->FOVScale != 0) // No adjustment if the adjustment is zero.
|
||||
{
|
||||
if (fabsf (player->FOV - player->DesiredFOV) < 7.f)
|
||||
desired *= player->ReadyWeapon->FOVScale;
|
||||
}
|
||||
if (player->FOV != desired)
|
||||
{
|
||||
player->FOV = player->DesiredFOV;
|
||||
if (fabsf (player->FOV - desired) < 7.f)
|
||||
{
|
||||
player->FOV = desired;
|
||||
}
|
||||
else
|
||||
{
|
||||
float zoom = MAX(7.f, fabsf (player->FOV - player->DesiredFOV) * 0.025f);
|
||||
if (player->FOV > player->DesiredFOV)
|
||||
float zoom = MAX(7.f, fabsf(player->FOV - desired) * 0.025f);
|
||||
if (player->FOV > desired)
|
||||
{
|
||||
player->FOV = player->FOV - zoom;
|
||||
}
|
||||
|
|
|
@ -857,6 +857,8 @@ static void ParseActionDef (FScanner &sc, PClass *cls)
|
|||
}
|
||||
}
|
||||
sc.MustGetToken(';');
|
||||
if (afd != NULL)
|
||||
{
|
||||
PSymbolActionFunction *sym = new PSymbolActionFunction(funcname);
|
||||
sym->Arguments = args;
|
||||
sym->Function = afd->Function;
|
||||
|
@ -884,6 +886,7 @@ static void ParseActionDef (FScanner &sc, PClass *cls)
|
|||
FScriptPosition::ErrorCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -306,7 +306,6 @@ ACTOR PuzzleItem : Inventory native
|
|||
|
||||
Actor Weapon : Inventory native
|
||||
{
|
||||
|
||||
Inventory.PickupSound "misc/w_pkup"
|
||||
Weapon.DefaultKickback
|
||||
States
|
||||
|
@ -315,6 +314,9 @@ Actor Weapon : Inventory native
|
|||
SHTG E 0 A_Light0
|
||||
Stop
|
||||
}
|
||||
|
||||
action native A_ZoomFactor(float scale = 1, int flags = 0);
|
||||
const int ZOOM_INSTANT = 1;
|
||||
}
|
||||
|
||||
ACTOR WeaponGiver : Weapon native
|
||||
|
|
Loading…
Reference in a new issue