From 172290224b09395fdf380ceb2fe45a4250edc08a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 25 Apr 2016 01:01:28 +0200 Subject: [PATCH 01/18] - make modes 2 and 3 of Teleport_NoFog compatible with Eternity by defaulting to mode 1 when no line is available. --- src/p_lnspec.cpp | 4 ++-- wadsrc/static/xlat/eternity.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 4fca74959..2e6acd856 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -1064,11 +1064,11 @@ FUNC(LS_Teleport_NoFog) break; case 2: - flags |= TELF_KEEPORIENTATION | TELF_ROTATEBOOM; // adjust to exit thing like Boom (i.e. with incorrect reversed angle) + if (ln != NULL) flags |= TELF_KEEPORIENTATION | TELF_ROTATEBOOM; // adjust to exit thing like Boom (i.e. with incorrect reversed angle) break; case 3: - flags |= TELF_KEEPORIENTATION | TELF_ROTATEBOOMINVERSE; // adjust to exit thing correctly + if (ln != NULL) flags |= TELF_KEEPORIENTATION | TELF_ROTATEBOOMINVERSE; // adjust to exit thing correctly break; } diff --git a/wadsrc/static/xlat/eternity.txt b/wadsrc/static/xlat/eternity.txt index bca1a6769..bfdac2cec 100644 --- a/wadsrc/static/xlat/eternity.txt +++ b/wadsrc/static/xlat/eternity.txt @@ -230,3 +230,4 @@ enum 443 = 0, Generic_Crusher(0) 444 = 0, Teleport(0) 445 = 0, Teleport_NoFog(0) +446 = 0, Teleport_Line(0) From fab38d092b5b1cc736aa2916523a12cd5823da16 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Apr 2016 02:13:35 +0200 Subject: [PATCH 02/18] - fixed: P_LineOpening could miss a 3D floor if an actor was centered right against its side. - restored the original 3D floor code to retrieve the current floor in P_CheckPosition. The portal aware version was a bit too strict and could place the actor on the wrong side when moving at high speeds. --- src/p_3dfloors.cpp | 2 +- src/p_map.cpp | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 8da672513..5e2117b9b 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -790,7 +790,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li lowestceilingsec = j == 0 ? linedef->frontsector : linedef->backsector; } - if(ff_top > highestfloor && delta1 < delta2 && (!restrict || thing->Z() >= ff_top)) + if(ff_top > highestfloor && delta1 <= delta2 && (!restrict || thing->Z() >= ff_top)) { highestfloor = ff_top; highestfloorpic = *rover->top.texture; diff --git a/src/p_map.cpp b/src/p_map.cpp index 3d04c6889..bd442fa61 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1514,7 +1514,45 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, boo // Any contacted lines the step closer together will adjust them. if (!thing->IsNoClip2()) { - P_GetFloorCeilingZ(tm, FFCF_SAMESECTOR); + if (!newsec->PortalBlocksMovement(sector_t::ceiling) || !newsec->PortalBlocksMovement(sector_t::floor)) + { + // Use P_GetFloorCeilingZ only if there's portals to consider. Its logic is subtly different than what is needed here for 3D floors. + P_GetFloorCeilingZ(tm, FFCF_SAMESECTOR); + } + else + { + tm.floorz = tm.dropoffz = newsec->floorplane.ZatPoint(pos); + tm.floorpic = newsec->GetTexture(sector_t::floor); + tm.ceilingz = newsec->ceilingplane.ZatPoint(pos); + tm.ceilingpic = newsec->GetTexture(sector_t::ceiling); + tm.floorsector = tm.ceilingsector = newsec; + } + + F3DFloor* rover; + double thingtop = thing->Height > 0 ? thing->Top() : thing->Z() + 1; + + for (unsigned i = 0; ie->XFloor.ffloors.Size(); i++) + { + rover = newsec->e->XFloor.ffloors[i]; + if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue; + + double ff_bottom = rover->bottom.plane->ZatPoint(pos); + double ff_top = rover->top.plane->ZatPoint(pos); + + double delta1 = thing->Z() - (ff_bottom + ((ff_top - ff_bottom) / 2)); + double delta2 = thingtop - (ff_bottom + ((ff_top - ff_bottom) / 2)); + + if (ff_top > tm.floorz && fabs(delta1) < fabs(delta2)) + { + tm.floorz = tm.dropoffz = ff_top; + tm.floorpic = *rover->top.texture; + } + if (ff_bottom < tm.ceilingz && abs(delta1) >= abs(delta2)) + { + tm.ceilingz = ff_bottom; + tm.ceilingpic = *rover->bottom.texture; + } + } } else { From a26d81e060de758e39e7c97cd991cc36e2c361f3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Apr 2016 02:28:45 +0200 Subject: [PATCH 03/18] - fixed incomplete float conversion in R_RenderFakeWallRange. --- src/r_segs.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 696e30b7c..fc52b0e4f 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -666,8 +666,8 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2) int i,j; F3DFloor *rover, *fover = NULL; int passed, last; - fixed_t floorheight; - fixed_t ceilingheight; + double floorHeight; + double ceilingHeight; sprflipvert = false; curline = ds->curline; @@ -686,16 +686,16 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2) frontsector = sec; } - floorheight = FLOAT2FIXED(backsector->CenterFloor()); - ceilingheight = FLOAT2FIXED(backsector->CenterCeiling()); + floorHeight = backsector->CenterFloor(); + ceilingHeight = backsector->CenterCeiling(); // maybe fix clipheights - if (!(fake3D & FAKE3D_CLIPBOTTOM)) sclipBottom = floorheight; - if (!(fake3D & FAKE3D_CLIPTOP)) sclipTop = ceilingheight; + if (!(fake3D & FAKE3D_CLIPBOTTOM)) sclipBottom = floorHeight; + if (!(fake3D & FAKE3D_CLIPTOP)) sclipTop = ceilingHeight; // maybe not visible - if (sclipBottom >= FLOAT2FIXED(frontsector->CenterCeiling())) return; - if (sclipTop <= FLOAT2FIXED(frontsector->CenterFloor())) return; + if (sclipBottom >= frontsector->CenterCeiling()) return; + if (sclipTop <= frontsector->CenterFloor()) return; if (fake3D & FAKE3D_DOWN2UP) { // bottom to viewz @@ -709,8 +709,8 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2) passed = 0; if (!(rover->flags & FF_RENDERSIDES) || rover->top.plane->isSlope() || rover->bottom.plane->isSlope() || rover->top.plane->Zat0() <= sclipBottom || - rover->bottom.plane->Zat0() >= ceilingheight || - rover->top.plane->Zat0() <= floorheight) + rover->bottom.plane->Zat0() >= ceilingHeight || + rover->top.plane->Zat0() <= floorHeight) { if (!i) { @@ -892,8 +892,8 @@ void R_RenderFakeWallRange (drawseg_t *ds, int x1, int x2) if (!(rover->flags & FF_RENDERSIDES) || rover->top.plane->isSlope() || rover->bottom.plane->isSlope() || rover->bottom.plane->Zat0() >= sclipTop || - rover->top.plane->Zat0() <= floorheight || - rover->bottom.plane->Zat0() >= ceilingheight) + rover->top.plane->Zat0() <= floorHeight || + rover->bottom.plane->Zat0() >= ceilingHeight) { if ((unsigned)i == backsector->e->XFloor.ffloors.Size() - 1) { From 8bda3564127596ccc85879bd0616b4b7175c3495 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Apr 2016 04:08:06 +0200 Subject: [PATCH 04/18] - fixed crash in slope drawing: Several overlooked occurences of fixed point math in R_CalcTiltedLighting. Slopes are still completely broken, though. --- src/r_plane.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 790bb9309..a3877010f 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -287,21 +287,21 @@ void R_CalcTiltedLighting (double lval, double lend, int width) } if (width > 0) { - lval = planeshade - lval; - lend = planeshade - lend; + lval = FIXED2DBL(planeshade) - lval; + lend = FIXED2DBL(planeshade) - lend; lstep = (lend - lval) / width; if (lstep < 0) { // Going from dark to light - if (lval < FRACUNIT) + if (lval < 1.) { // All bright lightfiller = basecolormapdata; } else { - if (lval >= NUMCOLORMAPS*FRACUNIT) + if (lval >= NUMCOLORMAPS) { // Starts beyond the dark end BYTE *clight = basecolormapdata + ((NUMCOLORMAPS-1) << COLORMAPSHIFT); - while (lval >= NUMCOLORMAPS*FRACUNIT && i <= width) + while (lval >= NUMCOLORMAPS && i <= width) { tiltlighting[i++] = clight; lval += lstep; @@ -319,7 +319,7 @@ void R_CalcTiltedLighting (double lval, double lend, int width) } else { // Going from light to dark - if (lval >= (NUMCOLORMAPS-1)*FRACUNIT) + if (lval >= (NUMCOLORMAPS-1)) { // All dark lightfiller = basecolormapdata + ((NUMCOLORMAPS-1) << COLORMAPSHIFT); } @@ -332,7 +332,7 @@ void R_CalcTiltedLighting (double lval, double lend, int width) } if (i > width) return; - while (i <= width && lval < (NUMCOLORMAPS-1)*FRACUNIT) + while (i <= width && lval < (NUMCOLORMAPS-1)) { tiltlighting[i++] = basecolormapdata + (xs_ToInt(lval) << COLORMAPSHIFT); lval += lstep; From ee43c4ff95ebe317d3108ede324ef8824e9ba37f Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 26 Apr 2016 23:00:41 -0500 Subject: [PATCH 05/18] Fixed: Accidentally left in /65536.0 in WallMost() --- src/r_segs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_segs.cpp b/src/r_segs.cpp index fc52b0e4f..4dc5c249d 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -2910,12 +2910,12 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc) y = z1 * InvZtoScale / iy1; if (ix2 == ix1) { - mostbuf[ix1] = (short)xs_RoundToInt(y/65536.0 + CenterY); + mostbuf[ix1] = (short)xs_RoundToInt(y + CenterY); } else { fixed_t yinc = FLOAT2FIXED(((z2 * InvZtoScale / iy2) - y) / (ix2-ix1)); - qinterpolatedown16short (&mostbuf[ix1], ix2-ix1, FLOAT2FIXED(y/65536.0 + CenterY), yinc); + qinterpolatedown16short (&mostbuf[ix1], ix2-ix1, FLOAT2FIXED(y + CenterY), yinc); } return bad; From a029c7b6648c855740a7692e899281868353612d Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 26 Apr 2016 23:11:27 -0500 Subject: [PATCH 06/18] Fix unneeded fixed_t height in R_3D_AddHeight() --- src/r_3dfloors.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/r_3dfloors.cpp b/src/r_3dfloors.cpp index ee7dc4c81..61a23187d 100644 --- a/src/r_3dfloors.cpp +++ b/src/r_3dfloors.cpp @@ -53,11 +53,10 @@ void R_3D_AddHeight(secplane_t *add, sector_t *sec) HeightLevel *near; HeightLevel *curr; - double fheight = add->ZatPoint(ViewPos); - if(fheight >= sec->CenterCeiling()) return; - if(fheight <= sec->CenterFloor()) return; + double height = add->ZatPoint(ViewPos); + if(height >= sec->CenterCeiling()) return; + if(height <= sec->CenterFloor()) return; - fixed_t height = FLOAT2FIXED(fheight); fakeActive = 1; if(height_max >= 0) { From d970be48f96cc149addb6abecb49440dd9592fcb Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 26 Apr 2016 23:30:16 -0500 Subject: [PATCH 07/18] Use floating point xscale in R_RenderFakeWall() --- src/r_segs.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 4dc5c249d..87b5f15a2 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -558,7 +558,7 @@ clearfog: void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover) { int i; - fixed_t xscale; + double xscale; double yscale; fixed_t Alpha = Scale(rover->alpha, OPAQUE, 255); @@ -599,7 +599,7 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover) scaledside = rover->master->sidedef[0]; scaledpart = side_t::mid; } - xscale = FLOAT2FIXED(rw_pic->Scale.X * scaledside->GetTextureXScale(scaledpart)); + xscale = rw_pic->Scale.X * scaledside->GetTextureXScale(scaledpart); yscale = rw_pic->Scale.Y * scaledside->GetTextureYScale(scaledpart); double rowoffset = curline->sidedef->GetTextureYOffset(side_t::mid) + rover->master->sidedef[0]->GetTextureYOffset(side_t::mid); @@ -616,7 +616,7 @@ void R_RenderFakeWall(drawseg_t *ds, int x1, int x2, F3DFloor *rover) // still be positioned in world units rather than texels. dc_texturemid = dc_texturemid + rowoffset * yscale; - rw_offset = MulScale16 (rw_offset, xscale); + rw_offset = xs_RoundToInt(rw_offset * xscale); } else { From 61b165ccc4993921cbf58258fca7f99e819a5bf1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Apr 2016 11:38:54 +0200 Subject: [PATCH 08/18] - fixed the camera height setting for the camera actors. The scripting branch changed camera semantics to default to an actor's center - which for monsters and decorations makes sense - but not for simple mapspots that get used as camera. For those the CameraHeight must be explicitly set to 0. --- wadsrc/static/actors/shared/camera.txt | 1 + wadsrc/static/actors/shared/movingcamera.txt | 1 + wadsrc/static/actors/shared/sharedmisc.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/wadsrc/static/actors/shared/camera.txt b/wadsrc/static/actors/shared/camera.txt index 2dcc12aab..46816f9ea 100644 --- a/wadsrc/static/actors/shared/camera.txt +++ b/wadsrc/static/actors/shared/camera.txt @@ -15,6 +15,7 @@ ACTOR SecurityCamera native +NOGRAVITY +DONTSPLASH RenderStyle None + CameraHeight 0 } ACTOR AimingCamera : SecurityCamera native diff --git a/wadsrc/static/actors/shared/movingcamera.txt b/wadsrc/static/actors/shared/movingcamera.txt index 13ae8a922..4ba229154 100644 --- a/wadsrc/static/actors/shared/movingcamera.txt +++ b/wadsrc/static/actors/shared/movingcamera.txt @@ -28,6 +28,7 @@ ACTOR ActorMover : PathFollower native ACTOR MovingCamera : PathFollower native { + CameraHeight 0 } diff --git a/wadsrc/static/actors/shared/sharedmisc.txt b/wadsrc/static/actors/shared/sharedmisc.txt index 04bfe0f46..bfe7d5519 100644 --- a/wadsrc/static/actors/shared/sharedmisc.txt +++ b/wadsrc/static/actors/shared/sharedmisc.txt @@ -51,6 +51,7 @@ ACTOR MapSpot +NOGRAVITY +DONTSPLASH RenderStyle None + CameraHeight 0 } // same with different editor number for Legacy maps ----------------------- From f5afa30ee6193c9038722c31e282e2bb6e5adbec Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Apr 2016 11:52:52 +0200 Subject: [PATCH 09/18] - added GetAngle(bool relative, int target) DECORATE function. --- src/thingdef/thingdef_codeptr.cpp | 34 +++++++++++++++++++++++++++++++ wadsrc/static/actors/actor.txt | 1 + 2 files changed, 35 insertions(+) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index d801a7e80..394619322 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -320,6 +320,40 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance) return 0; } +//========================================================================== +// +// GetAngle +// +// NON-ACTION function to get the angle in degrees (normalized to -180..180) +// +//========================================================================== +DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetAngle) +{ + if (numret > 0) + { + assert(ret != NULL); + PARAM_SELF_PROLOGUE(AActor); + PARAM_BOOL(relative); + PARAM_INT_OPT(ptr) { ptr = AAPTR_TARGET; } + + AActor *target = COPY_AAPTR(self, ptr); + + if (!target || target == self) + { + ret->SetFloat(0); + } + else + { + DVector3 diff = self->Vec3To(target); + DAngle angto = diff.Angle(); + if (relative) angto = deltaangle(self->Angles.Yaw, angto); + ret->SetFloat(angto.Degrees); + } + return 1; + } + return 0; +} + //========================================================================== // // GetSpawnHealth diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 9222741bd..469c1b624 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -42,6 +42,7 @@ ACTOR Actor native //: Thinker native bool IsPointerEqual(int ptr_select1, int ptr_select2); native int CountInv(class itemtype, int ptr_select = AAPTR_DEFAULT); native float GetDistance(bool checkz, int ptr = AAPTR_DEFAULT); + native float GetAngle(bool relative, int ptr = AAPTR_DEFAULT); native int GetSpawnHealth(); native int GetGibHealth(); From 044bf4ada6b0bbe926b8ecc1fb92775cc805c50c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Apr 2016 12:08:22 +0200 Subject: [PATCH 10/18] - fixed: P_CheckPosition must initialized tm.floorterrain. --- src/p_map.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_map.cpp b/src/p_map.cpp index bd442fa61..14a147d6c 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1526,6 +1526,7 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, boo tm.ceilingz = newsec->ceilingplane.ZatPoint(pos); tm.ceilingpic = newsec->GetTexture(sector_t::ceiling); tm.floorsector = tm.ceilingsector = newsec; + tm.floorterrain = newsec->GetTerrain(sector_t::floor); } F3DFloor* rover; @@ -1546,6 +1547,7 @@ bool P_CheckPosition(AActor *thing, const DVector2 &pos, FCheckPosition &tm, boo { tm.floorz = tm.dropoffz = ff_top; tm.floorpic = *rover->top.texture; + tm.floorterrain = rover->model->GetTerrain(rover->top.isceiling); } if (ff_bottom < tm.ceilingz && abs(delta1) >= abs(delta2)) { From 934b1923d0b28640138d5aed2eb3132d3ab2a559 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Apr 2016 12:37:38 +0200 Subject: [PATCH 11/18] - fixed: CheckForPushSpecial did not check blocking 3D midtextures. --- src/p_map.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/p_map.cpp b/src/p_map.cpp index 14a147d6c..0938fe3b0 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -45,6 +45,7 @@ #include "p_checkposition.h" #include "r_utility.h" #include "p_blockmap.h" +#include "p_3dmidtex.h" #include "s_sound.h" #include "decallib.h" @@ -1905,6 +1906,15 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, DVector2 * if (fzt >= mobj->Top() && bzt >= mobj->Top() && fzb <= mobj->Z() && bzb <= mobj->Z()) { + if (line->flags & ML_3DMIDTEX) + { + double top, bot; + P_GetMidTexturePosition(line, side, &top, &bot); + if (bot < mobj->Top() && top > mobj->Z()) + { + goto isblocking; + } + } // we must also check if some 3D floor in the backsector may be blocking for (auto rover : line->backsector->e->XFloor.ffloors) { From ebca8cc5b0613a8a6a002ef12b137b6f3a3b30a4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Apr 2016 13:04:37 +0200 Subject: [PATCH 12/18] - added a portable config file option, for now only on Windows: If the engine finds a file named [GAMENAME]_portable.ini, it will use that instead of creating a user specific version, so that portable installs can carry their INI along. --- src/m_specialpaths.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/m_specialpaths.cpp b/src/m_specialpaths.cpp index 60ccf08a8..abfb5db8f 100644 --- a/src/m_specialpaths.cpp +++ b/src/m_specialpaths.cpp @@ -198,6 +198,13 @@ FString M_GetConfigPath(bool for_reading) FString path; HRESULT hr; + path.Format("%s" GAMENAME "_portable.ini", progdir.GetChars()); + if (FileExists(path)) + { + return path; + } + path = ""; + // Construct a user-specific config name if (UseKnownFolders() && GetKnownFolder(CSIDL_APPDATA, FOLDERID_RoamingAppData, true, path)) { From 262f3575aed8a101d96490cf350bf3a1b43cb82e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Apr 2016 13:16:35 +0200 Subject: [PATCH 13/18] - added a "custom" flag to drawmugshot so that the user-specified image can be forced to be used. --- src/g_shared/sbar.h | 1 + src/g_shared/sbar_mugshot.cpp | 2 +- src/g_shared/sbarinfo_commands.cpp | 30 ++++++++++++++++-------------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/g_shared/sbar.h b/src/g_shared/sbar.h index 560a7500a..03901f66f 100644 --- a/src/g_shared/sbar.h +++ b/src/g_shared/sbar.h @@ -264,6 +264,7 @@ class FMugShot DISABLEOUCH = 0x8, DISABLEPAIN = 0x10, DISABLERAMPAGE = 0x20, + CUSTOM = 0x40, }; FMugShot(); diff --git a/src/g_shared/sbar_mugshot.cpp b/src/g_shared/sbar_mugshot.cpp index b26541c99..148b7cb32 100644 --- a/src/g_shared/sbar_mugshot.cpp +++ b/src/g_shared/sbar_mugshot.cpp @@ -489,7 +489,7 @@ FTexture *FMugShot::GetFace(player_t *player, const char *default_face, int accu if (CurrentState != NULL) { int skin = player->userinfo.GetSkin(); - const char *skin_face = player->morphTics ? player->MorphedPlayerClass->Face.GetChars() : skins[skin].face; + const char *skin_face = (stateflags & FMugShot::CUSTOM) ? nullptr : (player->morphTics ? player->MorphedPlayerClass->Face.GetChars() : skins[skin].face); return CurrentState->GetCurrentFrameTexture(default_face, skin_face, level, angle); } return NULL; diff --git a/src/g_shared/sbarinfo_commands.cpp b/src/g_shared/sbarinfo_commands.cpp index 26b4c9510..854cb4106 100644 --- a/src/g_shared/sbarinfo_commands.cpp +++ b/src/g_shared/sbarinfo_commands.cpp @@ -1578,23 +1578,25 @@ class CommandDrawMugShot : public SBarInfoCommand sc.ScriptError("Expected a number between 1 and 9, got %d instead.", sc.Number); accuracy = sc.Number; sc.MustGetToken(','); - while(sc.CheckToken(TK_Identifier)) + while (sc.CheckToken(TK_Identifier)) { - if(sc.Compare("xdeathface")) - stateFlags = static_cast (stateFlags|FMugShot::XDEATHFACE); - else if(sc.Compare("animatedgodmode")) - stateFlags = static_cast (stateFlags|FMugShot::ANIMATEDGODMODE); - else if(sc.Compare("disablegrin")) - stateFlags = static_cast (stateFlags|FMugShot::DISABLEGRIN); - else if(sc.Compare("disableouch")) - stateFlags = static_cast (stateFlags|FMugShot::DISABLEOUCH); - else if(sc.Compare("disablepain")) - stateFlags = static_cast (stateFlags|FMugShot::DISABLEPAIN); - else if(sc.Compare("disablerampage")) - stateFlags = static_cast (stateFlags|FMugShot::DISABLERAMPAGE); + if (sc.Compare("xdeathface")) + stateFlags = static_cast (stateFlags | FMugShot::XDEATHFACE); + else if (sc.Compare("animatedgodmode")) + stateFlags = static_cast (stateFlags | FMugShot::ANIMATEDGODMODE); + else if (sc.Compare("disablegrin")) + stateFlags = static_cast (stateFlags | FMugShot::DISABLEGRIN); + else if (sc.Compare("disableouch")) + stateFlags = static_cast (stateFlags | FMugShot::DISABLEOUCH); + else if (sc.Compare("disablepain")) + stateFlags = static_cast (stateFlags | FMugShot::DISABLEPAIN); + else if (sc.Compare("disablerampage")) + stateFlags = static_cast (stateFlags | FMugShot::DISABLERAMPAGE); + else if (sc.Compare("custom")) + stateFlags = static_cast (stateFlags | FMugShot::CUSTOM); else sc.ScriptError("Unknown flag '%s'.", sc.String); - if(!sc.CheckToken('|')) + if (!sc.CheckToken('|')) sc.MustGetToken(','); } From 660aff562d2fbcc9c9e2a1ecaaa8f15c42e9cf22 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sat, 23 Apr 2016 10:16:37 -0500 Subject: [PATCH 14/18] - Added support for THRU flags on bullets and rails. - ALLOWTHRUFLAGS must be used on the puffs, added for the sake of compatibility with older mods. This applies to the following: -- Bullets: THRUACTORS, THRUSPECIES -- Rails: Same as bullets, but includes THRUGHOST. --- src/actor.h | 1 + src/p_map.cpp | 98 ++++++++++++++++++++++++++-------- src/thingdef/thingdef_data.cpp | 1 + 3 files changed, 79 insertions(+), 21 deletions(-) diff --git a/src/actor.h b/src/actor.h index 10bbd119a..37815ba3c 100644 --- a/src/actor.h +++ b/src/actor.h @@ -380,6 +380,7 @@ enum ActorFlag7 MF7_FORCEDECAL = 0x00080000, // [ZK] Forces puff's decal to override the weapon's. MF7_LAXTELEFRAGDMG = 0x00100000, // [MC] Telefrag damage can be reduced. MF7_ICESHATTER = 0x00200000, // [MC] Shatters ice corpses regardless of damagetype. + MF7_ALLOWTHRUFLAGS = 0x00400000, // [MC] Allow THRUACTORS and the likes on puffs to prevent mod breakage. }; // --- mobj.renderflags --- diff --git a/src/p_map.cpp b/src/p_map.cpp index 0938fe3b0..959412a13 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4023,8 +4023,11 @@ DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLin struct Origin { AActor *Caller; + FNameNoInit PuffSpecies; bool hitGhosts; - bool hitSameSpecies; + bool MThruSpecies; + bool ThruSpecies; + bool ThruActors; }; static ETraceStatus CheckForActor(FTraceResults &res, void *userdata) @@ -4036,17 +4039,16 @@ static ETraceStatus CheckForActor(FTraceResults &res, void *userdata) Origin *data = (Origin *)userdata; - // check for physical attacks on spectrals - if (res.Actor->flags4 & MF4_SPECTRAL) - { - return TRACE_Skip; - } + // Skip actors if the puff has: + // 1. THRUACTORS or SPECTRAL + // 2. MTHRUSPECIES on puff and the shooter has same species as the hit actor + // 3. THRUSPECIES on puff and the puff has same species as the hit actor + // 4. THRUGHOST on puff and the GHOST flag on the hit actor - if (data->hitSameSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies()) - { - return TRACE_Skip; - } - if (data->hitGhosts && res.Actor->flags3 & MF3_GHOST) + if ((data->ThruActors) || (res.Actor->flags4 & MF4_SPECTRAL) || + (data->MThruSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies()) || + (data->ThruSpecies && res.Actor->GetSpecies() == data->PuffSpecies) || + (data->hitGhosts && res.Actor->flags3 & MF3_GHOST)) { return TRACE_Skip; } @@ -4108,14 +4110,41 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, // We need to check the defaults of the replacement here AActor *puffDefaults = GetDefaultByType(pufftype->GetReplacement()); - + TData.hitGhosts = (t1->player != NULL && t1->player->ReadyWeapon != NULL && (t1->player->ReadyWeapon->flags2 & MF2_THRUGHOST)) || (puffDefaults && (puffDefaults->flags2 & MF2_THRUGHOST)); - TData.hitSameSpecies = (puffDefaults && (puffDefaults->flags6 & MF6_MTHRUSPECIES)); + TData.MThruSpecies = (puffDefaults && (puffDefaults->flags6 & MF6_MTHRUSPECIES)); + TData.PuffSpecies = NAME_None; + // [MC] To prevent possible mod breakage, this flag is pretty much necessary. + // Somewhere, someone is relying on these to spawn on actors and move through them. + + if ((puffDefaults->flags7 & MF7_ALLOWTHRUFLAGS)) + { + TData.ThruSpecies = (puffDefaults && (puffDefaults->flags6 & MF6_THRUSPECIES)); + TData.ThruActors = (puffDefaults && (puffDefaults->flags2 & MF2_THRUACTORS)); + + // [MC] Because this is a one-hit trace event, we need to spawn the puff, get the species + // and destroy it. Assume there is no species unless tempuff isn't NULL. We cannot get + // a proper species the same way as puffDefaults flags it appears... + + AActor *tempuff = NULL; + if (pufftype != NULL) + tempuff = Spawn(pufftype, t1->Pos(), ALLOW_REPLACE); + if (tempuff != NULL) + { + TData.PuffSpecies = tempuff->GetSpecies(); + tempuff->Destroy(); + } + } + else + { + TData.ThruSpecies = false; + TData.ThruActors = false; + } // if the puff uses a non-standard damage type, this will override default, hitscan and melee damage type. // All other explicitly passed damage types (currenty only MDK) will be preserved. if ((damageType == NAME_None || damageType == NAME_Melee || damageType == NAME_Hitscan) && @@ -4543,9 +4572,13 @@ struct RailData AActor *Caller; TArray RailHits; TArray PortalHits; + FNameNoInit PuffSpecies; bool StopAtOne; bool StopAtInvul; + bool ThruGhosts; bool ThruSpecies; + bool MThruSpecies; + bool ThruActors; }; static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata) @@ -4572,8 +4605,16 @@ static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata) return TRACE_Stop; } - // Skip actors with the same species if the puff has MTHRUSPECIES. - if (data->ThruSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies()) + // Skip actors if the puff has: + // 1. THRUACTORS (This one did NOT include a check for spectral) + // 2. MTHRUSPECIES on puff and the shooter has same species as the hit actor + // 3. THRUSPECIES on puff and the puff has same species as the hit actor + // 4. THRUGHOST on puff and the GHOST flag on the hit actor + + if ((data->ThruActors) || + (data->MThruSpecies && res.Actor->GetSpecies() == data->Caller->GetSpecies()) || + (data->ThruSpecies && res.Actor->GetSpecies() == data->PuffSpecies) || + (data->ThruGhosts && res.Actor->flags3 & MF3_GHOST)) { return TRACE_Skip; } @@ -4648,7 +4689,27 @@ void P_RailAttack(FRailParams *p) // disabled because not complete yet. flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? TRACE_ReportPortals : TRACE_PCross | TRACE_Impact | TRACE_ReportPortals; rail_data.StopAtInvul = (puffDefaults->flags3 & MF3_FOILINVUL) ? false : true; - rail_data.ThruSpecies = (puffDefaults->flags6 & MF6_MTHRUSPECIES) ? true : false; + rail_data.MThruSpecies = ((puffDefaults->flags6 & MF6_MTHRUSPECIES)) ? true : false; + + // Prevent mod breakage as somewhere, someone is relying on these to spawn on an actor + // and move through them... + if ((puffDefaults->flags7 & MF7_ALLOWTHRUFLAGS)) + { + rail_data.ThruGhosts = !!(puffDefaults->flags2 & MF2_THRUGHOST); + rail_data.ThruSpecies = !!(puffDefaults->flags6 & MF6_THRUSPECIES); + rail_data.ThruActors = !!(puffDefaults->flags2 & MF2_THRUACTORS); + } + else + { + rail_data.ThruGhosts = false; + rail_data.MThruSpecies = false; + rail_data.ThruActors = false; + } + // used as damage inflictor + AActor *thepuff = NULL; + + if (puffclass != NULL) thepuff = Spawn(puffclass, source->Pos(), ALLOW_REPLACE); + rail_data.PuffSpecies = (thepuff != NULL) ? thepuff->GetSpecies() : NAME_None; Trace(start, source->Sector, vec, p->distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace, flags, ProcessRailHit, &rail_data); @@ -4656,11 +4717,6 @@ void P_RailAttack(FRailParams *p) unsigned int i; FName damagetype = (puffDefaults == NULL || puffDefaults->DamageType == NAME_None) ? FName(NAME_Railgun) : puffDefaults->DamageType; - // used as damage inflictor - AActor *thepuff = NULL; - - if (puffclass != NULL) thepuff = Spawn(puffclass, source->Pos(), ALLOW_REPLACE); - for (i = 0; i < rail_data.RailHits.Size(); i++) { bool spawnpuff; diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 55f20df03..efb7be0c2 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -256,6 +256,7 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF7, FORCEDECAL, AActor, flags7), DEFINE_FLAG(MF7, LAXTELEFRAGDMG, AActor, flags7), DEFINE_FLAG(MF7, ICESHATTER, AActor, flags7), + DEFINE_FLAG(MF7, ALLOWTHRUFLAGS, AActor, flags7), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), From c972caa9f3381d175c06af90cd70d00af83f9c46 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 25 Apr 2016 09:56:01 -0500 Subject: [PATCH 15/18] - Added rollIntensity and rollWave to A_QuakeEx. - Instead of moving the camera around, it rolls the camera. - This only has an effect in GZDoom. --- src/g_shared/a_quake.cpp | 22 +++++++++++++++------- src/g_shared/a_sharedglobal.h | 8 +++++--- src/p_acs.cpp | 4 +++- src/p_mobj.cpp | 5 +++-- src/p_spec.h | 2 +- src/r_utility.cpp | 9 +++++++++ src/thingdef/thingdef_codeptr.cpp | 6 +++++- src/vectors.h | 3 ++- wadsrc/static/actors/actor.txt | 2 +- 9 files changed, 44 insertions(+), 17 deletions(-) diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index a970f8969..bcbe05814 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -37,7 +37,8 @@ DEarthquake::DEarthquake() DEarthquake::DEarthquake(AActor *center, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesound, int flags, - double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint) + double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, int rollIntensity, + double rollWave) : DThinker(STAT_EARTHQUAKE) { m_QuakeSFX = quakesound; @@ -53,6 +54,8 @@ DEarthquake::DEarthquake(AActor *center, int intensityX, int intensityY, int int m_Falloff = falloff; m_Highpoint = highpoint; m_MiniCount = highpoint; + m_RollIntensity = rollIntensity; + m_RollWave = rollWave; } //========================================================================== @@ -68,7 +71,8 @@ void DEarthquake::Serialize (FArchive &arc) << m_TremorRadius << m_DamageRadius << m_QuakeSFX << m_Flags << m_CountdownStart << m_WaveSpeed - << m_Falloff << m_Highpoint << m_MiniCount; + << m_Falloff << m_Highpoint << m_MiniCount + << m_RollIntensity; } //========================================================================== @@ -281,11 +285,12 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger double x = quake->GetModIntensity(quake->m_Intensity.X); double y = quake->GetModIntensity(quake->m_Intensity.Y); double z = quake->GetModIntensity(quake->m_Intensity.Z); - + double r = quake->GetModIntensity(quake->m_RollIntensity); if (!(quake->m_Flags & QF_WAVE)) { jiggers.Falloff = MAX(falloff, jiggers.Falloff); + jiggers.RollIntensity = MAX(r, jiggers.RollIntensity); if (quake->m_Flags & QF_RELATIVE) { jiggers.RelIntensity.X = MAX(x, jiggers.RelIntensity.X); @@ -302,9 +307,11 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger else { jiggers.WFalloff = MAX(falloff, jiggers.WFalloff); + double mr = r * quake->GetModWave(quake->m_RollWave); double mx = x * quake->GetModWave(quake->m_WaveSpeed.X); double my = y * quake->GetModWave(quake->m_WaveSpeed.Y); double mz = z * quake->GetModWave(quake->m_WaveSpeed.Z); + jiggers.RollWave = r * quake->GetModWave(quake->m_RollWave); // [RH] This only gives effect to the last sine quake. I would // prefer if some way was found to make multiples coexist @@ -338,7 +345,8 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, - double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint) + double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, + int rollIntensity, double rollWave) { AActor *center; bool res = false; @@ -352,7 +360,7 @@ bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, if (activator != NULL) { new DEarthquake(activator, intensityX, intensityY, intensityZ, duration, damrad, tremrad, - quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint); + quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint, rollIntensity, rollWave); return true; } } @@ -363,7 +371,7 @@ bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, { res = true; new DEarthquake(center, intensityX, intensityY, intensityZ, duration, damrad, tremrad, - quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint); + quakesfx, flags, waveSpeedX, waveSpeedY, waveSpeedZ, falloff, highpoint, rollIntensity, rollWave); } } @@ -372,5 +380,5 @@ bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, bool P_StartQuake(AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx) { //Maintains original behavior by passing 0 to intensityZ, flags, and everything else after QSFX. - return P_StartQuakeXYZ(activator, tid, intensity, intensity, 0, duration, damrad, tremrad, quakesfx, 0, 0, 0, 0, 0, 0); + return P_StartQuakeXYZ(activator, tid, intensity, intensity, 0, duration, damrad, tremrad, quakesfx, 0, 0, 0, 0, 0, 0, 0, 0); } diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index f746375d3..e3a30fc67 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -153,8 +153,8 @@ struct FQuakeJiggers DVector3 RelIntensity; DVector3 Offset; DVector3 RelOffset; - double Falloff; - double WFalloff; + double Falloff, WFalloff; + double RollIntensity, RollWave; }; class DEarthquake : public DThinker @@ -164,7 +164,7 @@ class DEarthquake : public DThinker public: DEarthquake(AActor *center, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, - double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint); + double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, int rollIntensity, double rollWave); void Serialize (FArchive &arc); void Tick (); @@ -178,6 +178,8 @@ public: DVector3 m_WaveSpeed; double m_Falloff; int m_Highpoint, m_MiniCount; + double m_RollIntensity, m_RollWave; + double GetModIntensity(double intensity) const; double GetModWave(double waveMultiplier) const; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 266ff0bdc..088612e2a 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -5768,7 +5768,9 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) argCount > 10 ? ACSToDouble(args[10]) : 1.0, argCount > 11 ? ACSToDouble(args[11]) : 1.0, argCount > 12 ? args[12] : 0, - argCount > 13 ? args[13] : 0); + argCount > 13 ? args[13] : 0, + argCount > 14 ? args[14] : 0, + argCount > 15 ? args[15] : 0); } case ACSF_SetLineActivation: diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index b7d887195..ffb1c3a4f 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -238,6 +238,7 @@ void AActor::Serialize(FArchive &arc) << Angles.Yaw << Angles.Pitch << Angles.Roll + << Angles.CamRoll << frame << Scale << RenderStyle @@ -4592,7 +4593,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) } mobj->Angles.Yaw = SpawnAngle; - mobj->Angles.Pitch = mobj->Angles.Roll = 0.; + mobj->Angles.Pitch = mobj->Angles.Roll = mobj->Angles.CamRoll = 0.; mobj->health = p->health; // [RH] Set player sprite based on skin @@ -5074,7 +5075,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) if (mthing->pitch) mobj->Angles.Pitch = (double)mthing->pitch; if (mthing->roll) - mobj->Angles.Roll = (double)mthing->roll; + mobj->Angles.Roll = mobj->Angles.CamRoll = (double)mthing->roll; if (mthing->score) mobj->Score = mthing->score; if (mthing->fillcolor) diff --git a/src/p_spec.h b/src/p_spec.h index 7bd04f48c..28c73914e 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -698,7 +698,7 @@ void P_DoDeferedScripts (void); // // [RH] p_quake.c // -bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint); +bool P_StartQuakeXYZ(AActor *activator, int tid, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, int rollIntensity, double rollWave); bool P_StartQuake(AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx); #endif diff --git a/src/r_utility.cpp b/src/r_utility.cpp index d948657e7..dc32a2c70 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -799,6 +799,7 @@ void R_SetupFrame (AActor *actor) P_AimCamera (camera, campos, camangle, viewsector, unlinked); // fixme: This needs to translate the angle, too. iview->New.Pos = campos; iview->New.Angles.Yaw = camangle; + r_showviewer = true; // Interpolating this is a very complicated thing because nothing keeps track of the aim camera's movement, so whenever we detect a portal transition // it's probably best to just reset the interpolation for this move. @@ -868,6 +869,10 @@ void R_SetupFrame (AActor *actor) double quakefactor = r_quakeintensity; DAngle an; + if (jiggers.RollIntensity != 0 || jiggers.RollWave != 0) + { + camera->Angles.CamRoll = camera->Angles.Roll + QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave, jiggers.Falloff, jiggers.WFalloff); + } if (jiggers.RelIntensity.X != 0 || jiggers.RelOffset.X != 0) { an = camera->Angles.Yaw; @@ -898,6 +903,10 @@ void R_SetupFrame (AActor *actor) ViewPos.Z += QuakePower(quakefactor, jiggers.Intensity.Z, jiggers.Offset.Z, jiggers.Falloff, jiggers.WFalloff); } } + else + { + camera->Angles.CamRoll = camera->Angles.Roll; + } } extralight = camera->player ? camera->player->extralight : 0; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 394619322..689e9425a 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2388,6 +2388,7 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags) if (flags & SIXF_TRANSFERROLL) { mo->Angles.Roll = self->Angles.Roll; + mo->Angles.CamRoll = self->Angles.CamRoll; } if (flags & SIXF_ISTARGET) @@ -4985,7 +4986,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_QuakeEx) PARAM_FLOAT_OPT(mulWaveZ) { mulWaveZ = 1.; } PARAM_INT_OPT(falloff) { falloff = 0; } PARAM_INT_OPT(highpoint) { highpoint = 0; } - P_StartQuakeXYZ(self, 0, intensityX, intensityY, intensityZ, duration, damrad, tremrad, sound, flags, mulWaveX, mulWaveY, mulWaveZ, falloff, highpoint); + PARAM_INT_OPT(rollIntensity) { rollIntensity = 0; } + PARAM_FLOAT_OPT(rollWave) { rollWave = 0.; } + P_StartQuakeXYZ(self, 0, intensityX, intensityY, intensityZ, duration, damrad, tremrad, sound, flags, mulWaveX, mulWaveY, mulWaveZ, falloff, highpoint, + rollIntensity, rollWave); return 0; } diff --git a/src/vectors.h b/src/vectors.h index 8b81d05b2..caa9c2f20 100644 --- a/src/vectors.h +++ b/src/vectors.h @@ -1135,7 +1135,8 @@ struct TRotator Angle Pitch; // up/down Angle Yaw; // left/right - Angle Roll; // rotation about the forward axis + Angle Roll; // rotation about the forward axis. + Angle CamRoll; // Roll specific to actor cameras. Used by quakes. TRotator () { diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 469c1b624..b6543cd7e 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -281,7 +281,7 @@ ACTOR Actor native //: Thinker native void A_SetUserArrayFloat(name varname, int index, float value); native void A_SetSpecial(int spec, int arg0 = 0, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0); native void A_Quake(int intensity, int duration, int damrad, int tremrad, sound sfx = "world/quake"); - native void A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0); + native void A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0, int rollIntensity = 0, float rollWave = 0); action native A_SetTics(int tics); native void A_SetDamageType(name damagetype); native void A_DropItem(class item, int dropamount = -1, int chance = 256); From be9b25e76057b092b6f9a633c81793cd612024dc Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 25 Apr 2016 13:27:27 -0500 Subject: [PATCH 16/18] Use ViewRoll instead of CamRoll, and removed CamRoll entirely. Begin work on interpolation. --- src/g_shared/a_quake.cpp | 2 +- src/p_mobj.cpp | 5 ++--- src/r_utility.cpp | 9 ++++----- src/r_utility.h | 1 + src/thingdef/thingdef_codeptr.cpp | 1 - 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index bcbe05814..7da5824b8 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -72,7 +72,7 @@ void DEarthquake::Serialize (FArchive &arc) << m_QuakeSFX << m_Flags << m_CountdownStart << m_WaveSpeed << m_Falloff << m_Highpoint << m_MiniCount - << m_RollIntensity; + << m_RollIntensity << m_RollWave; } //========================================================================== diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index ffb1c3a4f..b7d887195 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -238,7 +238,6 @@ void AActor::Serialize(FArchive &arc) << Angles.Yaw << Angles.Pitch << Angles.Roll - << Angles.CamRoll << frame << Scale << RenderStyle @@ -4593,7 +4592,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) } mobj->Angles.Yaw = SpawnAngle; - mobj->Angles.Pitch = mobj->Angles.Roll = mobj->Angles.CamRoll = 0.; + mobj->Angles.Pitch = mobj->Angles.Roll = 0.; mobj->health = p->health; // [RH] Set player sprite based on skin @@ -5075,7 +5074,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) if (mthing->pitch) mobj->Angles.Pitch = (double)mthing->pitch; if (mthing->roll) - mobj->Angles.Roll = mobj->Angles.CamRoll = (double)mthing->roll; + mobj->Angles.Roll = (double)mthing->roll; if (mthing->score) mobj->Score = mthing->score; if (mthing->fillcolor) diff --git a/src/r_utility.cpp b/src/r_utility.cpp index dc32a2c70..a61227a5c 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -108,6 +108,7 @@ int viewwindowy; DVector3 ViewPos; DAngle ViewAngle; DAngle ViewPitch; +DAngle ViewRoll; DVector3 ViewPath[2]; extern "C" @@ -542,11 +543,13 @@ void R_InterpolateView (player_t *player, double Frac, InterpolationViewer *ivie ViewAngle = (nviewangle + AngleToFloat(LocalViewAngle & 0xFFFF0000)).Normalized180(); DAngle delta = player->centering ? DAngle(0.) : AngleToFloat(int(LocalViewPitch & 0xFFFF0000)); ViewPitch = clamp((iview->New.Angles.Pitch - delta).Normalized180(), player->MinPitch, player->MaxPitch); + ViewRoll = iview->New.Angles.Roll.Normalized180(); } else { ViewPitch = (iview->Old.Angles.Pitch + deltaangle(iview->Old.Angles.Pitch, iview->New.Angles.Pitch) * Frac).Normalized180(); ViewAngle = (oviewangle + deltaangle(oviewangle, nviewangle) * Frac).Normalized180(); + ViewRoll = iview->Old.Angles.Roll.Normalized180(); } // Due to interpolation this is not necessarily the same as the sector the camera is in. @@ -871,7 +874,7 @@ void R_SetupFrame (AActor *actor) if (jiggers.RollIntensity != 0 || jiggers.RollWave != 0) { - camera->Angles.CamRoll = camera->Angles.Roll + QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave, jiggers.Falloff, jiggers.WFalloff); + ViewRoll += QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave, jiggers.Falloff, jiggers.WFalloff); } if (jiggers.RelIntensity.X != 0 || jiggers.RelOffset.X != 0) { @@ -903,10 +906,6 @@ void R_SetupFrame (AActor *actor) ViewPos.Z += QuakePower(quakefactor, jiggers.Intensity.Z, jiggers.Offset.Z, jiggers.Falloff, jiggers.WFalloff); } } - else - { - camera->Angles.CamRoll = camera->Angles.Roll; - } } extralight = camera->player ? camera->player->extralight : 0; diff --git a/src/r_utility.h b/src/r_utility.h index a89e4e50c..f15d42052 100644 --- a/src/r_utility.h +++ b/src/r_utility.h @@ -15,6 +15,7 @@ extern DCanvas *RenderTarget; extern DVector3 ViewPos; extern DAngle ViewAngle; extern DAngle ViewPitch; +extern DAngle ViewRoll; extern DVector3 ViewPath[2]; extern "C" int centerx, centerxwide; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 689e9425a..fe464b137 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2388,7 +2388,6 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags) if (flags & SIXF_TRANSFERROLL) { mo->Angles.Roll = self->Angles.Roll; - mo->Angles.CamRoll = self->Angles.CamRoll; } if (flags & SIXF_ISTARGET) From 762d186657b873a30b82b58200e5d76845b25e25 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 25 Apr 2016 14:21:34 -0500 Subject: [PATCH 17/18] Finished interpolation. --- src/r_utility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_utility.cpp b/src/r_utility.cpp index a61227a5c..20f3d506c 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -549,7 +549,7 @@ void R_InterpolateView (player_t *player, double Frac, InterpolationViewer *ivie { ViewPitch = (iview->Old.Angles.Pitch + deltaangle(iview->Old.Angles.Pitch, iview->New.Angles.Pitch) * Frac).Normalized180(); ViewAngle = (oviewangle + deltaangle(oviewangle, nviewangle) * Frac).Normalized180(); - ViewRoll = iview->Old.Angles.Roll.Normalized180(); + ViewRoll = (iview->Old.Angles.Roll + deltaangle(iview->Old.Angles.Roll, iview->New.Angles.Roll) * Frac).Normalized180(); } // Due to interpolation this is not necessarily the same as the sector the camera is in. From 3a17d6aa78026f3f32b039ef4224245ad0241978 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Apr 2016 13:47:30 +0200 Subject: [PATCH 18/18] - fixed savegame compatibility. --- src/g_shared/a_quake.cpp | 7 +++++-- src/version.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index 7da5824b8..f2f2e9b57 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -71,8 +71,11 @@ void DEarthquake::Serialize (FArchive &arc) << m_TremorRadius << m_DamageRadius << m_QuakeSFX << m_Flags << m_CountdownStart << m_WaveSpeed - << m_Falloff << m_Highpoint << m_MiniCount - << m_RollIntensity << m_RollWave; + << m_Falloff << m_Highpoint << m_MiniCount; + if (SaveVersion >= 4544) + { + arc << m_RollIntensity << m_RollWave; + } } //========================================================================== diff --git a/src/version.h b/src/version.h index 91ccc3e99..096efa48c 100644 --- a/src/version.h +++ b/src/version.h @@ -76,7 +76,7 @@ const char *GetVersionString(); // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4543 +#define SAVEVER 4544 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)