diff --git a/src/am_map.cpp b/src/am_map.cpp index 58082a7bf..765443c20 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -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]; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 40fe650c1..186e9c3d4 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -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); diff --git a/src/p_map.cpp b/src/p_map.cpp index 26c08af26..8fbbb3e99 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -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(chase_height, -1000, 1000); if (Trace(t1->PosAtZ(sz), t1->Sector, vvec, distance, 0, 0, NULL, trace) && diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index bacef28e4..2c7c4ea42 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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; diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index ed4c97409..d7da8fa4c 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -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; - - case AWeapon::BobInverse: - *x = bobx*angle.Cos(); - *y = boby * (1.f - fabsf(angle.Sin())); - break; - - case AWeapon::BobAlpha: - *x = bobx * angle.Sin(); - *y = boby * fabsf(angle.Sin()); - break; - - case AWeapon::BobInverseAlpha: - *x = bobx * angle.Sin(); - *y = 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; + 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::BobInverseSmooth: - *x = bobx*angle.Cos(); - *y = 0.5f * (boby * (1.f + fabsf((angle * 2).Cos()))); + case AWeapon::BobInverse: + xx[i] = bobx*angle.Cos(); + yy[i] = boby * (1.f - fabsf(angle.Sin())); + break; + + case AWeapon::BobAlpha: + xx[i] = bobx * angle.Sin(); + yy[i] = boby * fabsf(angle.Sin()); + break; + + case AWeapon::BobInverseAlpha: + xx[i] = bobx * angle.Sin(); + yy[i] = boby * (1.f - fabsf(angle.Sin())); + break; + + case AWeapon::BobSmooth: + xx[i] = bobx*angle.Cos(); + yy[i] = 0.5f * (boby * (1.f - ((angle * 2).Cos()))); + break; + + 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); } //============================================================================ diff --git a/src/p_pspr.h b/src/p_pspr.h index 7045f96a5..27f1778f3 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -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); diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 89ca3a799..b88e3e2a0 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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 } } diff --git a/src/p_sight.cpp b/src/p_sight.cpp index f8d2043fd..469cc8783 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -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; diff --git a/src/r_defs.h b/src/r_defs.h index e96f47a05..89df08cab 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -121,6 +121,11 @@ public: p.Y = y; } + void set(const DVector2 &pos) + { + p = pos; + } + double fX() const { return p.X; diff --git a/src/r_things.cpp b/src/r_things.cpp index 465b6c30f..d2c0dcdb4 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -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; diff --git a/src/win32/i_input.cpp b/src/win32/i_input.cpp index 2251e5275..2b0659c83 100644 --- a/src/win32/i_input.cpp +++ b/src/win32/i_input.cpp @@ -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)