This commit is contained in:
Christoph Oelckers 2016-04-07 13:43:00 +02:00
commit 88542bed78
11 changed files with 99 additions and 75 deletions

View file

@ -2559,7 +2559,7 @@ void AM_rotatePoint (double *x, double *y)
double pivoty = m_y + m_h/2;
*x -= pivotx;
*y -= pivoty;
AM_rotate (x, y, -players[consoleplayer].camera->Angles.Yaw - 90.);
AM_rotate (x, y, -players[consoleplayer].camera->Angles.Yaw + 90.);
*x += pivotx;
*y += pivoty;
}
@ -2645,7 +2645,7 @@ void AM_drawPlayers ()
pt.y = pos.Y;
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{
angle = -90.;
angle = 90.;
AM_rotatePoint (&pt.x, &pt.y);
}
else
@ -2802,11 +2802,11 @@ void AM_drawThings ()
const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0);
frame = &SpriteFrames[spriteIndex];
DAngle angle = -t->Angles.Yaw + 270.;
DAngle angle = 270. -t->Angles.Yaw;
if (frame->Texture[0] != frame->Texture[1]) angle += 180. / 16;
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{
angle += players[consoleplayer].camera->Angles.Yaw + 90.;
angle += players[consoleplayer].camera->Angles.Yaw - 90.;
}
rotation = int((angle.Normalized360() * (16. / 360.)).Degrees);
@ -2830,7 +2830,7 @@ void AM_drawThings ()
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{
AM_rotatePoint (&p.x, &p.y);
angle += -players[consoleplayer].camera->Angles.Yaw - 90.;
angle += -players[consoleplayer].camera->Angles.Yaw + 90.;
}
color = AMColors[AMColors.ThingColor];

View file

@ -3737,6 +3737,8 @@ enum
APROP_StencilColor = 41,
APROP_Friction = 42,
APROP_DamageMultiplier=43,
APROP_MaxStepHeight = 44,
APROP_MaxDropOffHeight= 45,
};
// These are needed for ACS's APROP_RenderStyle
@ -3987,6 +3989,15 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
case APROP_Friction:
actor->Friction = ACSToDouble(value);
case APROP_MaxStepHeight:
actor->MaxStepHeight = ACSToDouble(value);
break;
case APROP_MaxDropOffHeight:
actor->MaxDropOffHeight = ACSToDouble(value);
break;
default:
// do nothing.
break;
@ -4087,6 +4098,8 @@ int DLevelScript::GetActorProperty (int tid, int property)
case APROP_NameTag: return GlobalACSStrings.AddString(actor->GetTag());
case APROP_StencilColor:return actor->fillcolor;
case APROP_Friction: return DoubleToACS(actor->Friction);
case APROP_MaxStepHeight: return DoubleToACS(actor->MaxStepHeight);
case APROP_MaxDropOffHeight: return DoubleToACS(actor->MaxDropOffHeight);
default: return 0;
}
@ -4133,6 +4146,8 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value)
case APROP_MeleeRange:
case APROP_ViewHeight:
case APROP_AttackZOffset:
case APROP_MaxStepHeight:
case APROP_MaxDropOffHeight:
case APROP_StencilColor:
return (GetActorProperty(tid, property) == value);

View file

@ -4689,7 +4689,7 @@ void P_AimCamera(AActor *t1, DVector3 &campos, sector_t *&CameraSector, bool &un
double pc = pitch.Cos();
vvec = { pc * angle.Cos(), pc * angle.Sin(), -pitch.Sin() };
vvec = { pc * angle.Cos(), pc * angle.Sin(), pitch.Sin() };
sz = t1->Top() - t1->Floorclip + clamp<double>(chase_height, -1000, 1000);
if (Trace(t1->PosAtZ(sz), t1->Sector, vvec, distance, 0, 0, NULL, trace) &&

View file

@ -5955,8 +5955,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, double x, double y, double z,
PClassActor *type, DAngle angle, FTranslatedLineTarget *pLineTarget, AActor **pMissileActor,
bool nofreeaim, bool noautoaim, int aimflags)
{
//static const double angdiff[3] = { -5.625, 5.625, 0 };
static const int angdiff[3] = { -(1<<26), 1<<26, 0 };
static const double angdiff[3] = { -5.625, 5.625, 0 };
DAngle an = angle;
DAngle pitch;
FTranslatedLineTarget scratch;

View file

@ -367,9 +367,10 @@ void P_DropWeapon (player_t *player)
//
//============================================================================
void P_BobWeapon (player_t *player, pspdef_t *psp, float *x, float *y)
void P_BobWeapon (player_t *player, pspdef_t *psp, float *x, float *y, double ticfrac)
{
static float curbob;
double xx[2], yy[2];
AWeapon *weapon;
float bobtarget;
@ -388,74 +389,79 @@ void P_BobWeapon (player_t *player, pspdef_t *psp, float *x, float *y)
float Rangex = weapon->BobRangeX;
float Rangey = weapon->BobRangeY;
// Bob the weapon based on movement speed.
FAngle angle = (BobSpeed * 35 / TICRATE*level.time) * (360.f / 8192.f);
// [RH] Smooth transitions between bobbing and not-bobbing frames.
// This also fixes the bug where you can "stick" a weapon off-center by
// shooting it when it's at the peak of its swing.
bobtarget = float((player->WeaponState & WF_WEAPONBOBBING) ? player->bob : 0.);
if (curbob != bobtarget)
for (int i = 0; i < 2; i++)
{
if (fabsf (bobtarget - curbob) <= 1)
// Bob the weapon based on movement speed.
FAngle angle = (BobSpeed * 35 / TICRATE*(level.time - 1 + i)) * (360.f / 8192.f);
// [RH] Smooth transitions between bobbing and not-bobbing frames.
// This also fixes the bug where you can "stick" a weapon off-center by
// shooting it when it's at the peak of its swing.
bobtarget = float((player->WeaponState & WF_WEAPONBOBBING) ? player->bob : 0.);
if (curbob != bobtarget)
{
curbob = bobtarget;
}
else
{
float zoom = MAX (1.f, fabsf (curbob - bobtarget) / 40);
if (curbob > bobtarget)
if (fabsf(bobtarget - curbob) <= 1)
{
curbob -= zoom;
curbob = bobtarget;
}
else
{
curbob += zoom;
float zoom = MAX(1.f, fabsf(curbob - bobtarget) / 40);
if (curbob > bobtarget)
{
curbob -= zoom;
}
else
{
curbob += zoom;
}
}
}
}
if (curbob != 0)
{
float bobx = float(player->bob * Rangex);
float boby = float(player->bob * Rangey);
switch (bobstyle)
if (curbob != 0)
{
case AWeapon::BobNormal:
*x = bobx * angle.Cos();
*y = boby * fabsf(angle.Sin());
break;
float bobx = float(player->bob * Rangex);
float boby = float(player->bob * Rangey);
switch (bobstyle)
{
case AWeapon::BobNormal:
xx[i] = bobx * angle.Cos();
yy[i] = boby * fabsf(angle.Sin());
break;
case AWeapon::BobInverse:
*x = bobx*angle.Cos();
*y = boby * (1.f - fabsf(angle.Sin()));
break;
case AWeapon::BobInverse:
xx[i] = bobx*angle.Cos();
yy[i] = boby * (1.f - fabsf(angle.Sin()));
break;
case AWeapon::BobAlpha:
*x = bobx * angle.Sin();
*y = boby * fabsf(angle.Sin());
break;
case AWeapon::BobAlpha:
xx[i] = bobx * angle.Sin();
yy[i] = boby * fabsf(angle.Sin());
break;
case AWeapon::BobInverseAlpha:
*x = bobx * angle.Sin();
*y = boby * (1.f - fabsf(angle.Sin()));
break;
case AWeapon::BobInverseAlpha:
xx[i] = bobx * angle.Sin();
yy[i] = boby * (1.f - fabsf(angle.Sin()));
break;
case AWeapon::BobSmooth:
*x = bobx*angle.Cos();
*y = 0.5f * (boby * (1.f - fabsf((angle * 2).Cos())));
break;
case AWeapon::BobSmooth:
xx[i] = bobx*angle.Cos();
yy[i] = 0.5f * (boby * (1.f - ((angle * 2).Cos())));
break;
case AWeapon::BobInverseSmooth:
*x = bobx*angle.Cos();
*y = 0.5f * (boby * (1.f + fabsf((angle * 2).Cos())));
case AWeapon::BobInverseSmooth:
xx[i] = bobx*angle.Cos();
yy[i] = 0.5f * (boby * (1.f + ((angle * 2).Cos())));
}
}
else
{
xx[i] = 0;
yy[i] = 0;
}
}
else
{
*x = 0;
*y = 0;
}
*x = (float)(xx[0] * (1. - ticfrac) + xx[1] * ticfrac);
*y = (float)(yy[0] * (1. - ticfrac) + yy[1] * ticfrac);
}
//============================================================================

View file

@ -87,7 +87,7 @@ void P_CalcSwing (player_t *player);
void P_BringUpWeapon (player_t *player);
void P_FireWeapon (player_t *player);
void P_DropWeapon (player_t *player);
void P_BobWeapon (player_t *player, pspdef_t *psp, float *x, float *y);
void P_BobWeapon (player_t *player, pspdef_t *psp, float *x, float *y, double ticfrac);
DAngle P_BulletSlope (AActor *mo, FTranslatedLineTarget *pLineTarget = NULL, int aimflags = 0);
void P_GunShot (AActor *mo, bool accurate, PClassActor *pufftype, DAngle pitch);

View file

@ -1320,19 +1320,15 @@ void P_LoadSegs (MapData * map)
if (delta_angle >= 1.)
{
double dis = (li->v2->fPos() - li->v1->fPos()).Length();
DVector2 delta = seg_angle.ToVector();
DVector2 delta = seg_angle.ToVector(dis);
if ((vnum2 > vnum1) && (vertchanged[vnum2] == 0))
{
li->v2->set(
li->v1->fX() + dis * delta.X,
li->v1->fY() + dis * delta.Y);
li->v2->set(li->v1->fPos() + delta);
vertchanged[vnum2] = 1; // this was changed
}
else if (vertchanged[vnum1] == 0)
{
li->v1->set(
li->v2->fX() - dis * delta.X,
li->v2->fY() - dis * delta.Y);
li->v1->set(li->v2->fPos() - delta);
vertchanged[vnum1] = 1; // this was changed
}
}

View file

@ -216,6 +216,9 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in)
if (open.range == 0 && open.portalflags == 0 && (lport == NULL || lport->mType != PORTT_LINKED)) // quick test for totally closed doors (must be delayed if portal checks are needed, though)
return false; // stop
if (in->frac == 0)
return true;
// check bottom
if (open.bottom > LINEOPEN_MIN)
{
@ -870,7 +873,7 @@ sightcounts[0]++;
portals.Clear();
{
sector_t *sec;
double lookheight = t1->Center();
double lookheight = t1->Z() + t1->Height*0.75;
t1->GetPortalTransition(lookheight, &sec);
double bottomslope = t2->Z() - lookheight;

View file

@ -121,6 +121,11 @@ public:
p.Y = y;
}
void set(const DVector2 &pos)
{
p = pos;
}
double fX() const
{
return p.X;

View file

@ -1579,7 +1579,7 @@ void R_DrawPlayerSprites ()
centery = viewheight >> 1;
centeryfrac = centery << FRACBITS;
P_BobWeapon (camera->player, &camera->player->psprites[ps_weapon], &ofsx, &ofsy);
P_BobWeapon (camera->player, &camera->player->psprites[ps_weapon], &ofsx, &ofsy, r_TicFracF);
// add all active psprites
for (i = 0, psp = camera->player->psprites;

View file

@ -531,7 +531,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
SpawnEAXWindow = false;
ShowEAXEditor ();
}
break;
return DefWindowProc(hWnd, message, wParam, lParam);
case WM_GETMINMAXINFO:
if (screen && !VidResizing)