- Added Hexen Flechette pitch fix.

- Added new SetGlobalFogParameters action special to modify the global fog settings at run time:
  SetGlobalFogParameters(FOGP_DENSITY, value);
  SetGlobalFogParameters(FOGP_OUTSIDEDENSITY, value);
  SetGlobalFogParameters(FOGP_SKYFOG, value);

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@687 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
Christoph Oelckers 2009-12-29 23:20:51 +00:00
parent 5d47fecd76
commit c3da1a887f
7 changed files with 62 additions and 13 deletions

View file

@ -139,6 +139,7 @@ DEFINE_SPECIAL(Teleport_NoStop, 154, 2, 3, 3)
// Although ZDoom doesn't support them it's better to have them defined so that
// WADs using them somewhere can at least be started without aborting due
// to an error message.
DEFINE_SPECIAL(SetGlobalFogParameter, 157, 2, 2, 2)
DEFINE_SPECIAL(FS_Execute, 158, 1, 4, 4)
DEFINE_SPECIAL(Sector_SetPlaneReflection, 159, 3, 3, 3)
DEFINE_SPECIAL(Sector_Set3DFloor, 160, -1, -1, 5)

View file

@ -104,21 +104,38 @@ bool AArtiPoisonBag3::Use (bool pickup)
{
AActor *mo;
mo = Spawn ("ThrowingBomb", Owner->x, Owner->y,
mo = Spawn("ThrowingBomb", Owner->x, Owner->y,
Owner->z-Owner->floorclip+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0), ALLOW_REPLACE);
if (mo)
{
angle_t pitch = (angle_t)Owner->pitch >> ANGLETOFINESHIFT;
mo->angle = Owner->angle + (((pr_poisonbag()&7) - 4) << 24);
/* Original flight code from Hexen
* mo->momz = 4*FRACUNIT+((player->lookdir)<<(FRACBITS-4));
* mo->z += player->lookdir<<(FRACBITS-4);
* P_ThrustMobj(mo, mo->angle, mo->info->speed);
* mo->momx += player->mo->momx>>1;
* mo->momy += player->mo->momy>>1;
*/
// When looking straight ahead, it uses a z velocity of 4 while the xy velocity
// is as set by the projectile. To accomodate this with a proper trajectory, we
// aim the projectile ~20 degrees higher than we're looking at and increase the
// speed we fire at accordingly.
angle_t orgpitch = angle_t(-Owner->pitch) >> ANGLETOFINESHIFT;
angle_t modpitch = angle_t(0xDC00000 - Owner->pitch) >> ANGLETOFINESHIFT;
angle_t angle = mo->angle >> ANGLETOFINESHIFT;
fixed_t speed = FLOAT2FIXED(sqrt((double)mo->Speed*mo->Speed + (4.0*65536*4*65536)));
fixed_t xyscale = FixedMul(speed, finecosine[modpitch]);
mo->velz = FixedMul(speed, finesine[modpitch]);
mo->velx = FixedMul(xyscale, finecosine[angle]) + (Owner->velx >> 1);
mo->vely = FixedMul(xyscale, finesine[angle]) + (Owner->vely >> 1);
mo->z += FixedMul(mo->Speed, finesine[orgpitch]);
mo->angle = Owner->angle+(((pr_poisonbag()&7)-4)<<24);
mo->velz = 4*FRACUNIT + 2*finesine[pitch];
mo->z += 2*finesine[pitch];
P_ThrustMobj (mo, mo->angle, mo->Speed);
mo->velx += Owner->velx >> 1;
mo->vely += Owner->vely >> 1;
mo->target = Owner;
mo->tics -= pr_poisonbag()&3;
P_CheckMissileSpawn (mo);
P_CheckMissileSpawn(mo);
return true;
}
return false;

View file

@ -155,6 +155,29 @@ static int LS_Sector_SetPlaneReflection (line_t *ln, AActor *it, bool backSide,
return true;
}
static int LS_SetGlobalFogParameter (line_t *ln, AActor *it, bool backSide,
int arg0, int arg1, int arg2, int arg3, int arg4)
{
// SetGlobalFogParameter (type, value)
switch(arg0)
{
case 0:
fogdensity = arg1>>1;
return true;
case 1:
outsidefogdensity = arg1>>1;
return true;
case 2:
skyfog = arg1;
return true;
default:
return false;
}
}
//==========================================================================
//
@ -442,6 +465,7 @@ void sector_t::SetDirty(bool dolines, bool dovertices)
void gl_InitData()
{
LineSpecials[157]=LS_SetGlobalFogParameter;
LineSpecials[159]=LS_Sector_SetPlaneReflection;
gl_InitModels();
AdjustSpriteOffsets();

View file

@ -53,9 +53,9 @@
// externally settable lighting properties
static float distfogtable[2][256]; // light to fog conversion table for black fog
static int fogdensity;
static PalEntry outsidefogcolor;
static int outsidefogdensity;
int fogdensity;
int outsidefogdensity;
int skyfog;
CUSTOM_CVAR (Int, gl_light_ambient, 20, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)

View file

@ -48,6 +48,9 @@ __forceinline void gl_Desaturate(int gray, int ired, int igreen, int iblue, BYTE
void gl_ModifyColor(BYTE & red, BYTE & green, BYTE & blue, int cm);
extern int fogdensity;
extern int outsidefogdensity;
extern int skyfog;
#endif

View file

@ -380,6 +380,10 @@ void OpenGLFrameBuffer::StateChanged(AActor *actor)
void OpenGLFrameBuffer::StartSerialize(FArchive &arc)
{
gl_DeleteAllAttachedLights();
if (SaveVersion >= 2058)
{
arc << fogdensity << outsidefogdensity << skyfog;
}
}
void OpenGLFrameBuffer::EndSerialize(FArchive &arc)

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the
// updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "2056"
#define ZD_SVN_REVISION_NUMBER 2056
#define ZD_SVN_REVISION_STRING "2058"
#define ZD_SVN_REVISION_NUMBER 2058