From c6e6b7c59d1574fd1e7c51b771a62cfc20dd47e5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 23 Oct 2022 23:23:10 +0200 Subject: [PATCH] - got rid of the global compatibility modes and made 'precise' a parameter for clipmove. This better reflects how this stuff gets used. --- source/build/include/build.h | 28 ++----------------- source/build/src/clip.cpp | 13 +++++---- source/common/models/voxels.h | 1 + source/common/rendering/i_modelvertexbuffer.h | 2 ++ source/core/actorlist.cpp | 2 +- source/core/automap.h | 1 + source/core/cheats.cpp | 2 +- source/core/coreactor.h | 6 ++-- source/core/gamecontrol.cpp | 2 +- source/core/gamecontrol.h | 2 +- source/core/gamefuncs.cpp | 7 +++-- source/core/gamefuncs.h | 5 +++- source/core/gamehud.cpp | 2 +- source/core/mainloop.cpp | 2 +- source/core/maploader.cpp | 2 +- source/core/models/modeldata.cpp | 3 +- source/core/precache.cpp | 2 +- source/core/rendering/hw_palmanager.cpp | 2 +- source/core/rendering/hw_sections.h | 3 +- source/core/rendering/hw_voxels.cpp | 3 +- source/core/rendering/scene/hw_bunchdrawer.h | 1 + source/core/rendering/scene/hw_drawstructs.h | 2 +- source/core/savegamehelp.cpp | 1 + source/core/sectorgeometry.cpp | 2 +- source/core/sectorgeometry.h | 2 +- source/core/textures/buildtiles.h | 2 ++ source/core/thingdef_properties.cpp | 1 + source/games/blood/src/actor.cpp | 14 ++++------ source/games/blood/src/blood.cpp | 2 -- source/games/blood/src/gameutil.cpp | 4 +-- source/games/blood/src/gameutil.h | 2 +- source/games/blood/src/misc.h | 1 + source/games/duke/src/constants.h | 1 + source/games/duke/src/game.cpp | 1 - source/games/duke/src/gameexec.cpp | 2 +- source/games/exhumed/src/2d.cpp | 2 +- source/games/exhumed/src/exhumed.cpp | 2 -- source/games/sw/src/game.cpp | 1 - source/games/sw/src/game.h | 2 +- 39 files changed, 59 insertions(+), 76 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 915c5721c..7d6b4ae6e 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -10,37 +10,13 @@ #ifndef build_h_ #define build_h_ - -#define TRANSPARENT_INDEX 0 - -static_assert('\xff' == 255, "Char must be unsigned!"); - +/* #include "printf.h" #include "palette.h" #include "buildtiles.h" #include "c_cvars.h" #include "cmdlib.h" - -typedef int64_t coord_t; - -#define POINT2(i) (wall[wall[i].point2]) - - #include "maptypes.h" - -enum { - ENGINECOMPATIBILITY_NONE = 0, - ENGINECOMPATIBILITY_19950829, // Powerslave/Exhumed - ENGINECOMPATIBILITY_19960925, // Blood v1.21 - ENGINECOMPATIBILITY_19961112, // Duke 3d v1.5, Redneck Rampage -}; - -inline int32_t enginecompatibility_mode; - - -inline int32_t ksqrt(uint64_t num) -{ - return int(sqrt(double(num))); -} +*/ #endif // build_h_ diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 711ebb1f6..57a321082 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -104,7 +104,7 @@ static inline void keepaway(MoveClipper& clip, int32_t *x, int32_t *y, int32_t w // clipmove // CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, int32_t yvect, - int32_t const walldist, int32_t const ceildist, int32_t const flordist, uint32_t const cliptype, int clipmoveboxtracenum) + int32_t const walldist, int32_t const ceildist, int32_t const flordist, uint32_t const cliptype, int clipmoveboxtracenum, bool precise) { if ((xvect|yvect) == 0 || *sectnum < 0) return {}; @@ -117,7 +117,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, //Extra walldist for sprites on sector lines vec2_t const diff = { goal.X - (pos->X), goal.Y - (pos->Y) }; - int32_t const rad = ksqrt((int64_t)diff.X * diff.X + (int64_t)diff.Y * diff.Y) + MAXCLIPDIST + walldist + 8; + int32_t const rad = (int)g_sqrt((int64_t)diff.X * diff.X + (int64_t)diff.Y * diff.Y) + MAXCLIPDIST + walldist + 8; vec2_t const clipMin = { cent.X - rad, cent.Y - rad }; vec2_t const clipMax = { cent.X + rad, cent.Y + rad }; @@ -134,6 +134,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, clip.dest = { goal.X * inttoworld, goal.Y * inttoworld }; clip.center = (clip.pos.XY() + clip.dest) * 0.5; clip.movedist = clip.moveDelta.Length() + clip.walldist + 0.5 + MAXCLIPDIST * inttoworld; + clip.precise = precise; collectClipObjects(clip, (cliptype >> 16)); @@ -144,7 +145,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, do { - if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE && (xvect|yvect)) + if (clip.precise && (xvect|yvect)) { for (int i=clip.clipobjects.Size() - 1; i >= 0; --i) { @@ -190,7 +191,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, if ((tempint ^ tempint2) < 0) { - if (enginecompatibility_mode == ENGINECOMPATIBILITY_19961112) + if (!clip.precise) { auto sectp = §or[*sectnum]; updatesector(DVector2(pos->X * inttoworld, pos->Y * inttoworld), §p); @@ -209,7 +210,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, hitwalls[cnt] = hitwall; } - if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE) + if (clip.precise) { DVector2 v(vec.X* inttoworld, vec.Y* inttoworld); sectortype* sect = §or[*sectnum]; @@ -222,7 +223,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, cnt--; } while ((xvect|yvect) != 0 && hitwall >= 0 && cnt > 0); - if (enginecompatibility_mode != ENGINECOMPATIBILITY_NONE) + if (!clip.precise) { DVector3 fpos(pos->X* inttoworld, pos->Y* inttoworld, pos->Z* inttoworld); diff --git a/source/common/models/voxels.h b/source/common/models/voxels.h index 52299434a..2a172c8ea 100644 --- a/source/common/models/voxels.h +++ b/source/common/models/voxels.h @@ -2,6 +2,7 @@ #define __RES_VOXEL_H #include +#include "vectors.h" // [RH] Voxels from Build enum diff --git a/source/common/rendering/i_modelvertexbuffer.h b/source/common/rendering/i_modelvertexbuffer.h index f68d4e117..73f5f0c7b 100644 --- a/source/common/rendering/i_modelvertexbuffer.h +++ b/source/common/rendering/i_modelvertexbuffer.h @@ -1,5 +1,7 @@ #pragma once +#include +#include struct FModelVertex diff --git a/source/core/actorlist.cpp b/source/core/actorlist.cpp index 0f47e4063..08f4ac06e 100644 --- a/source/core/actorlist.cpp +++ b/source/core/actorlist.cpp @@ -32,11 +32,11 @@ ** */ -#include "build.h" #include "coreactor.h" #include "gamefuncs.h" #include "raze_sound.h" #include "vm.h" +#include "buildtiles.h" // Doubly linked ring list of Actors diff --git a/source/core/automap.h b/source/core/automap.h index c7e208d50..89bf09f37 100644 --- a/source/core/automap.h +++ b/source/core/automap.h @@ -4,6 +4,7 @@ #include "build.h" #include "c_cvars.h" #include "palentry.h" +#include "maptypes.h" class FSerializer; struct event_t; diff --git a/source/core/cheats.cpp b/source/core/cheats.cpp index 924564014..8cba4a7c8 100644 --- a/source/core/cheats.cpp +++ b/source/core/cheats.cpp @@ -33,7 +33,6 @@ ** */ -#include "build.h" #include "gamestruct.h" #include "printf.h" #include "c_cvars.h" @@ -46,6 +45,7 @@ #include "screenjob.h" #include "mapinfo.h" #include "statistics.h" +#include "filesystem.h" CVAR(Bool, sv_cheats, false, CVAR_ARCHIVE|CVAR_SERVERINFO) CVAR(Bool, cl_blockcheats, false, 0) diff --git a/source/core/coreactor.h b/source/core/coreactor.h index 06c84afff..f2b723747 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -436,14 +436,14 @@ void SetActorZ(DCoreActor* actor, const DVector3& newpos); void SetActor(DCoreActor* actor, const DVector3& newpos); CollisionBase clipmove_(vec3_t* const pos, int* const sectnum, int32_t xvect, int32_t yvect, int32_t const walldist, int32_t const ceildist, - int32_t const flordist, uint32_t const cliptype, int clipmoveboxtracenum = 3); + int32_t const flordist, uint32_t const cliptype, int clipmoveboxtracenum, bool precise); inline int clipmove(DVector3& pos, sectortype** const sect, const DVector2& mvec, - double const walldist, double const ceildist, double const flordist, unsigned const cliptype, CollisionBase& result, int clipmoveboxtracenum = 3) + double const walldist, double const ceildist, double const flordist, unsigned const cliptype, CollisionBase& result, int clipmoveboxtracenum = 3, bool precise = false) { auto vect = vec3_t(int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint)); int sectno = *sect ? sector.IndexOf(*sect) : -1; - result = clipmove_(&vect, §no, FloatToFixed<18>(mvec.X), FloatToFixed<18>(mvec.Y), int(walldist * worldtoint), int(ceildist * zworldtoint), int(flordist * zworldtoint), cliptype, clipmoveboxtracenum); + result = clipmove_(&vect, §no, FloatToFixed<18>(mvec.X), FloatToFixed<18>(mvec.Y), int(walldist * worldtoint), int(ceildist * zworldtoint), int(flordist * zworldtoint), cliptype, clipmoveboxtracenum, precise); pos = { vect.X * inttoworld, vect.Y * inttoworld, vect.Z * zinttoworld }; *sect = sectno == -1 ? nullptr : §or[sectno]; return result.type; diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index ab6db44c4..941cb7bdc 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c_cvars.h" #include "gameconfigfile.h" #include "gamecvars.h" -#include "build.h" +#include "buildtiles.h" #include "inputstate.h" #include "m_argv.h" #include "rts.h" diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index a60fd4cf4..2a5962b9c 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -11,7 +11,7 @@ #include "stats.h" #include "i_time.h" #include "palentry.h" -#include "build.h" +#include "dobject.h" EXTERN_CVAR(Bool, hud_textfont) diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index dcc0e2ab3..213ff1fbf 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "coreactor.h" #include "interpolate.h" #include "hw_voxels.h" +#include "buildtiles.h" IntRect viewport3d; constexpr double MAXCLIPDISTF = 64; @@ -887,7 +888,7 @@ bool checkRangeOfWall(walltype* wal, EWallFlags flagmask, const DVector3& pos, d if (BoxOnLineSide(boxtl, boxbr, pos1, pos2 - pos1) != -1) return false; auto closest = pos.XY(); - if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE || !strict_compatibility) + if (!strict_compatibility) SquareDistToSector(closest.X, closest.Y, nextsect, &closest); calcSlope(nextsect, closest.X, closest.Y, &theZs[0], &theZs[1]); @@ -985,7 +986,7 @@ void getzrange(const DVector3& pos, sectortype* sect, double* ceilz, CollisionBa const ESpriteFlags dasprclipmask = ESpriteFlags::FromInt(cliptype >> 16); auto closest = pos.XY(); - if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE || !strict_compatibility) + if (!strict_compatibility) SquareDistToSector(closest.X, closest.Y, sect, &closest); calcSlope(sect, closest, ceilz, florz); @@ -1346,7 +1347,7 @@ static void addWallToClipSet(MoveClipper& clip, walltype* wal) #if 0 // What EDuke32 added here, this doesn't seem to make much sense // because it leaves gaps in the path from the 5 line segments being added here - if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE) + if (!strict_compatibility) { if (wal->delta().RotatedCCW().dot(pos - startpt - distv1) < 0) v *= 0.5; diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index 1e0bcc4cb..f82cfde7a 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -2,12 +2,14 @@ #include "gamecontrol.h" #include "gamestruct.h" -#include "build.h" +#include "palette.h" #include "coreactor.h" #include "intrect.h" #include "geometry.h" #include "c_cvars.h" +static_assert('\xff' == 255, "Char must be unsigned!"); + extern IntRect viewport3d; EXTERN_CVAR(Bool, hw_hightile) @@ -304,6 +306,7 @@ struct MoveClipper double movedist; TArray clipobjects; BFSSectorSearch search; + bool precise; MoveClipper(sectortype* start) : search(start) {} }; diff --git a/source/core/gamehud.cpp b/source/core/gamehud.cpp index f76c62306..b0ae92a14 100644 --- a/source/core/gamehud.cpp +++ b/source/core/gamehud.cpp @@ -41,7 +41,7 @@ #include "gamecontrol.h" #include "v_2ddrawer.h" #include "v_video.h" -#include "build.h" +#include "buildtiles.h" #include "v_draw.h" #include "v_font.h" #include "gamestruct.h" diff --git a/source/core/mainloop.cpp b/source/core/mainloop.cpp index ec7deaa53..bd44ac840 100644 --- a/source/core/mainloop.cpp +++ b/source/core/mainloop.cpp @@ -78,7 +78,7 @@ #include "uiinput.h" #include "v_video.h" #include "palette.h" -#include "build.h" +#include "buildtiles.h" #include "g_input.h" #include "mapinfo.h" #include "automap.h" diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index c67d9ef5e..1d19223c6 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -34,7 +34,6 @@ */ #include -#include "build.h" #include "files.h" #include "automap.h" #include "printf.h" @@ -48,6 +47,7 @@ #include "hw_sections.h" #include "interpolate.h" #include "games/blood/src/mapstructs.h" +#include "buildtiles.h" TArray sector; TArray wall; diff --git a/source/core/models/modeldata.cpp b/source/core/models/modeldata.cpp index d2dcb3730..d94eb02b9 100644 --- a/source/core/models/modeldata.cpp +++ b/source/core/models/modeldata.cpp @@ -4,8 +4,7 @@ #include "texturemanager.h" #include "hw_voxels.h" #include "gamefuncs.h" - -#include "build.h" +#include "buildtiles.h" int ModelManager::LoadModel(const char* fn) diff --git a/source/core/precache.cpp b/source/core/precache.cpp index ebdb1e87e..9ae7f55d3 100644 --- a/source/core/precache.cpp +++ b/source/core/precache.cpp @@ -33,7 +33,7 @@ ** */ #include "ns.h" -#include "build.h" +#include "buildtiles.h" #include "palette.h" #include "v_video.h" #include "hw_material.h" diff --git a/source/core/rendering/hw_palmanager.cpp b/source/core/rendering/hw_palmanager.cpp index b7f6f50ca..4ea74459b 100644 --- a/source/core/rendering/hw_palmanager.cpp +++ b/source/core/rendering/hw_palmanager.cpp @@ -41,7 +41,7 @@ #include "imagehelpers.h" #include "v_font.h" #include "palette.h" -#include "build.h" +#include "printf.h" #include "v_video.h" static PaletteManager* palmanager; diff --git a/source/core/rendering/hw_sections.h b/source/core/rendering/hw_sections.h index dc66f302d..74df3a0f8 100644 --- a/source/core/rendering/hw_sections.h +++ b/source/core/rendering/hw_sections.h @@ -1,6 +1,7 @@ #pragma once -#include "build.h" +#include "vectors.h" +#include "maptypes.h" enum ESectionFlag { diff --git a/source/core/rendering/hw_voxels.cpp b/source/core/rendering/hw_voxels.cpp index 738d6622e..9f61b8648 100644 --- a/source/core/rendering/hw_voxels.cpp +++ b/source/core/rendering/hw_voxels.cpp @@ -26,10 +26,11 @@ ** **/ -#include "build.h" #include "voxels.h" #include "hw_voxels.h" +#include "buildtiles.h" #include "gamecontrol.h" +#include "filesystem.h" int16_t tiletovox[MAXTILES]; static int voxlumps[MAXVOXELS]; diff --git a/source/core/rendering/scene/hw_bunchdrawer.h b/source/core/rendering/scene/hw_bunchdrawer.h index 504bb8aae..92206dc34 100644 --- a/source/core/rendering/scene/hw_bunchdrawer.h +++ b/source/core/rendering/scene/hw_bunchdrawer.h @@ -2,6 +2,7 @@ #include "tarray.h" #include "basics.h" +#include "maptypes.h" struct HWDrawInfo; class Clipper; diff --git a/source/core/rendering/scene/hw_drawstructs.h b/source/core/rendering/scene/hw_drawstructs.h index 293eb8d2a..e0820ad0d 100644 --- a/source/core/rendering/scene/hw_drawstructs.h +++ b/source/core/rendering/scene/hw_drawstructs.h @@ -7,7 +7,7 @@ #include "renderstyle.h" #include "textures.h" #include "fcolormap.h" -#include "build.h" +#include "buildtiles.h" #include "gamefuncs.h" #include "render.h" #include "matrix.h" diff --git a/source/core/savegamehelp.cpp b/source/core/savegamehelp.cpp index 5f16b3d4f..1bd626c1d 100644 --- a/source/core/savegamehelp.cpp +++ b/source/core/savegamehelp.cpp @@ -63,6 +63,7 @@ #include "ns.h" #include "serialize_obj.h" #include "games/blood/src/mapstructs.h" +#include "buildtiles.h" #include diff --git a/source/core/sectorgeometry.cpp b/source/core/sectorgeometry.cpp index be54b3ff6..a12993750 100644 --- a/source/core/sectorgeometry.cpp +++ b/source/core/sectorgeometry.cpp @@ -35,7 +35,7 @@ */ #include "sectorgeometry.h" -#include "build.h" +#include "buildtiles.h" #include "gamefuncs.h" #include "texturemanager.h" #include "earcut.hpp" diff --git a/source/core/sectorgeometry.h b/source/core/sectorgeometry.h index 9c063540d..355025da4 100644 --- a/source/core/sectorgeometry.h +++ b/source/core/sectorgeometry.h @@ -2,7 +2,7 @@ #include "tarray.h" #include "vectors.h" -#include "build.h" +#include "maptypes.h" struct Section; diff --git a/source/core/textures/buildtiles.h b/source/core/textures/buildtiles.h index 991aec3e6..9549a061b 100644 --- a/source/core/textures/buildtiles.h +++ b/source/core/textures/buildtiles.h @@ -7,6 +7,8 @@ #include "intvec.h" #include "name.h" +constexpr int TRANSPARENT_INDEX = 0; + // picanm[].sf: // |bit(1<<7) // |animtype|animtype|texhitscan|nofullbright|speed|speed|speed|speed| diff --git a/source/core/thingdef_properties.cpp b/source/core/thingdef_properties.cpp index 06ade9625..b28660dd1 100644 --- a/source/core/thingdef_properties.cpp +++ b/source/core/thingdef_properties.cpp @@ -45,6 +45,7 @@ #include "texturemanager.h" #include "coreactor.h" #include "thingdef.h" +#include "buildtiles.h" //========================================================================== // diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index a25618851..7b05cb48e 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -4500,16 +4500,13 @@ static Collision MoveThing(DBloodActor* actor) lhit.setNone(); GetActorExtents(actor, &top, &bottom); - const int bakCompat = enginecompatibility_mode; if (actor->vel.X != 0 || actor->vel.Y != 0) { auto bakCstat = actor->spr.cstat; actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; - if ((actor->GetOwner()) && !cl_bloodvanillaexplosions && !VanillaMode()) - enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy - ClipMove(actor->spr.pos, &pSector, actor->vel.XY(), actor->clipdist, (actor->spr.pos.Z - top) * 0.25, (bottom - actor->spr.pos.Z) * 0.25, CLIPMASK0, lhit); + bool precise = ((actor->GetOwner()) && !cl_bloodvanillaexplosions && !VanillaMode()); + ClipMove(actor->spr.pos, &pSector, actor->vel.XY(), actor->clipdist, (actor->spr.pos.Z - top) * 0.25, (bottom - actor->spr.pos.Z) * 0.25, CLIPMASK0, lhit, 3, precise); actor->hit.hit = lhit; - enginecompatibility_mode = bakCompat; // restore actor->spr.cstat = bakCstat; assert(pSector); if (actor->sector() != pSector) @@ -5207,21 +5204,20 @@ int MoveMissile(DBloodActor* actor) double top, bottom; GetActorExtents(actor, &top, &bottom); int i = 1; - const int bakCompat = enginecompatibility_mode; const bool isFlameSprite = (actor->spr.type == kMissileFlameSpray || actor->spr.type == kMissileFlameHound); // do not use accurate clipmove for flame based sprites (changes damage too much) while (1) { auto ppos = actor->spr.pos; auto pSector2 = actor->sector(); const auto bakSpriteCstat = actor->spr.cstat; + bool precise = false; if (Owner && !isFlameSprite && !cl_bloodvanillaexplosions && !VanillaMode()) { - enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy + precise = true; actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; // remove self collisions for accurate clipmove } Collision clipmoveresult; - ClipMove(ppos, &pSector2, vel.XY(), actor->clipdist, (ppos.Z - top) / 4, (bottom - ppos.Z) / 4, CLIPMASK0, clipmoveresult, 1); - enginecompatibility_mode = bakCompat; // restore + ClipMove(ppos, &pSector2, vel.XY(), actor->clipdist, (ppos.Z - top) / 4, (bottom - ppos.Z) / 4, CLIPMASK0, clipmoveresult, 1, precise); actor->spr.cstat = bakSpriteCstat; auto pSector = pSector2; if (pSector2 == nullptr) diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index 8ed06dcbe..cf4c33703 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -626,8 +626,6 @@ void GameInterface::app_init() gChoke.init(518, chokeCallback); UpdateDacs(0, true); - enginecompatibility_mode = ENGINECOMPATIBILITY_19960925; - gViewIndex = myconnectindex; } diff --git a/source/games/blood/src/gameutil.cpp b/source/games/blood/src/gameutil.cpp index fa10f4084..2a04dfe0f 100644 --- a/source/games/blood/src/gameutil.cpp +++ b/source/games/blood/src/gameutil.cpp @@ -510,7 +510,7 @@ void GetZRangeAtXYZ(const DVector3& pos, sectortype* pSector, double* ceilZ, Col // //--------------------------------------------------------------------------- -void ClipMove(DVector3& pos, sectortype** pSector, const DVector2& vect, double wd, double cd, double fd, unsigned int nMask, CollisionBase& hit, int tracecount) +void ClipMove(DVector3& pos, sectortype** pSector, const DVector2& vect, double wd, double cd, double fd, unsigned int nMask, CollisionBase& hit, int tracecount, bool precise) { auto opos = pos; sectortype* bakSect = *pSector; @@ -521,7 +521,7 @@ void ClipMove(DVector3& pos, sectortype** pSector, const DVector2& vect, double vel.X = (FloatToFixed(vect.X) >> 12) / 16.; vel.Y = (FloatToFixed(vect.Y) >> 12) / 16.; - clipmove(pos, &bakSect, vel, wd, cd, fd, nMask, hit, tracecount); + clipmove(pos, &bakSect, vel, wd, cd, fd, nMask, hit, tracecount, precise); if (bakSect == nullptr) { pos = opos; diff --git a/source/games/blood/src/gameutil.h b/source/games/blood/src/gameutil.h index 499ce1eb7..fc30d0fbe 100644 --- a/source/games/blood/src/gameutil.h +++ b/source/games/blood/src/gameutil.h @@ -39,7 +39,7 @@ int VectorScan(DBloodActor* pSprite, double nOffset, double nZOffset, const DVec void GetZRange(DBloodActor* pSprite, double* ceilZ, Collision* ceilHit, double* floorZ, Collision* floorHit, double nDist, unsigned int nMask, unsigned int nClipParallax = 0); void GetZRangeAtXYZ(const DVector3& pos, sectortype* pSector, double* ceilZ, Collision* ceilHit, double* floorZ, Collision* floorHit, double nDist, unsigned int nMask, unsigned int nClipParallax = 0); -void ClipMove(DVector3& pos, sectortype** pSector, const DVector2& vect, double wd, double cd, double fd, unsigned int nMask, CollisionBase& hit, int tracecount = 3); +void ClipMove(DVector3& pos, sectortype** pSector, const DVector2& vect, double wd, double cd, double fd, unsigned int nMask, CollisionBase& hit, int tracecount = 3, bool precise = false); BitArray GetClosestSpriteSectors(sectortype* pSector, const DVector2& pos, int nDist, TArray* pWalls, bool newSectCheckMethod = false); END_BLD_NS diff --git a/source/games/blood/src/misc.h b/source/games/blood/src/misc.h index b74d46cf8..0df9c5228 100644 --- a/source/games/blood/src/misc.h +++ b/source/games/blood/src/misc.h @@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "m_fixed.h" #include "filesystem.h" +#include "buildtiles.h" BEGIN_BLD_NS diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index a59825ae4..de5ef98dc 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -1,6 +1,7 @@ #pragma once #include "tflags.h" #include "coreactor.h" +#include "buildtiles.h" // all game constants got collected here. diff --git a/source/games/duke/src/game.cpp b/source/games/duke/src/game.cpp index 31d59af35..c89fea7ce 100644 --- a/source/games/duke/src/game.cpp +++ b/source/games/duke/src/game.cpp @@ -395,7 +395,6 @@ void GameInterface::app_init() } ud.last_level = -1; - enginecompatibility_mode = ENGINECOMPATIBILITY_19961112;//bVanilla; S_ParseDeveloperCommentary(); } diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 0ef8162d3..177f9300c 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -2898,7 +2898,7 @@ int ParseState::parse(void) lInVarID = *(insptr++); lOutVarID = *(insptr++); lIn = GetGameVarID(lInVarID, g_ac, g_p).safeValue(); - SetGameVarID(lOutVarID, ksqrt(lIn), g_ac, g_p); + SetGameVarID(lOutVarID, (int)g_sqrt(lIn), g_ac, g_p); break; } case concmd_findnearactor: diff --git a/source/games/exhumed/src/2d.cpp b/source/games/exhumed/src/2d.cpp index ba2e11917..4607e0b36 100644 --- a/source/games/exhumed/src/2d.cpp +++ b/source/games/exhumed/src/2d.cpp @@ -16,7 +16,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ //------------------------------------------------------------------------- #include "ns.h" -#include "build.h" +#include "buildtiles.h" #include "exhumed.h" #include "names.h" #include "engine.h" diff --git a/source/games/exhumed/src/exhumed.cpp b/source/games/exhumed/src/exhumed.cpp index df51795fb..24f5574f9 100644 --- a/source/games/exhumed/src/exhumed.cpp +++ b/source/games/exhumed/src/exhumed.cpp @@ -573,8 +573,6 @@ void GameInterface::app_init() resettiming(); GrabPalette(); - - enginecompatibility_mode = ENGINECOMPATIBILITY_19961112; } //--------------------------------------------------------------------------- diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index 623aa7d9c..7893d47c1 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -245,7 +245,6 @@ void GameInterface::app_init() INITLIST(&Player[i].PanelSpriteList); DebugOperate = true; - enginecompatibility_mode = ENGINECOMPATIBILITY_19961112; if (SW_SHAREWARE) Printf("SHADOW WARRIOR(tm) Version 1.2 (Shareware Version)\n"); diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 743305bd1..1ca50dcd4 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -32,7 +32,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #pragma warning(disable:4101) // there's too many of these... :( #endif -#include "build.h" +#include "buildtiles.h" #include "d_net.h" #include "gamefuncs.h" #include "coreactor.h"