- refactored global sides array to be more VM friendly.

- moved FLevelLocals to its own header to resolve some circular include conflicts.
This commit is contained in:
Christoph Oelckers 2017-01-08 18:45:30 +01:00
parent e188047d70
commit cd7986b1b1
117 changed files with 354 additions and 251 deletions

View file

@ -779,14 +779,7 @@ public:
// set translation // set translation
void SetTranslation(FName trname); void SetTranslation(FName trname);
double GetBobOffset(double ticfrac = 0) const double GetBobOffset(double ticfrac = 0) const;
{
if (!(flags2 & MF2_FLOATBOB))
{
return 0;
}
return BobSin(FloatBobPhase + level.maptime + ticfrac);
}
// Enter the crash state // Enter the crash state
void Crash(); void Crash();

View file

@ -70,6 +70,7 @@
#include "po_man.h" #include "po_man.h"
#include "a_keys.h" #include "a_keys.h"
#include "r_data/colormaps.h" #include "r_data/colormaps.h"
#include "g_levellocals.h"
//============================================================================= //=============================================================================

View file

@ -49,6 +49,7 @@
#include "d_player.h" #include "d_player.h"
#include "g_level.h" #include "g_level.h"
#include "doomstat.h" #include "doomstat.h"
#include "g_levellocals.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------

View file

@ -72,6 +72,7 @@
#include "r_utility.h" #include "r_utility.h"
#include "r_data/r_interpolate.h" #include "r_data/r_interpolate.h"
#include "c_functions.h" #include "c_functions.h"
#include "g_levellocals.h"
extern FILE *Logfile; extern FILE *Logfile;
extern bool insave; extern bool insave;

View file

@ -67,6 +67,7 @@
#include "d_player.h" #include "d_player.h"
#include "gstrings.h" #include "gstrings.h"
#include "c_consolebuffer.h" #include "c_consolebuffer.h"
#include "g_levellocals.h"
#include "gi.h" #include "gi.h"

View file

@ -52,6 +52,7 @@
#include "p_tags.h" #include "p_tags.h"
#include "r_state.h" #include "r_state.h"
#include "w_wad.h" #include "w_wad.h"
#include "g_levellocals.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------

View file

@ -109,6 +109,7 @@
#include "p_local.h" #include "p_local.h"
#include "autosegs.h" #include "autosegs.h"
#include "fragglescript/t_fs.h" #include "fragglescript/t_fs.h"
#include "g_levellocals.h"
EXTERN_CVAR(Bool, hud_althud) EXTERN_CVAR(Bool, hud_althud)
void DrawHUD(); void DrawHUD();

View file

@ -63,6 +63,7 @@
#include "r_utility.h" #include "r_utility.h"
#include "a_keys.h" #include "a_keys.h"
#include "intermission/intermission.h" #include "intermission/intermission.h"
#include "g_levellocals.h"
EXTERN_CVAR (Int, disableautosave) EXTERN_CVAR (Int, disableautosave)
EXTERN_CVAR (Int, autosavecount) EXTERN_CVAR (Int, autosavecount)

View file

@ -49,6 +49,7 @@
#include "colormatcher.h" #include "colormatcher.h"
#include "b_bot.h" #include "b_bot.h"
#include "serializer.h" #include "serializer.h"
#include "g_levellocals.h"
FDecalLib DecalLibrary; FDecalLib DecalLibrary;

View file

@ -49,6 +49,7 @@
#include "dsectoreffect.h" #include "dsectoreffect.h"
#include "serializer.h" #include "serializer.h"
#include "virtual.h" #include "virtual.h"
#include "g_levellocals.h"
//========================================================================== //==========================================================================
// //

View file

@ -77,6 +77,7 @@
#include "r_utility.h" #include "r_utility.h"
#include "menu/menu.h" #include "menu/menu.h"
#include "intermission/intermission.h" #include "intermission/intermission.h"
#include "g_levellocals.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -709,15 +710,15 @@ size_t DSectorMarker::PropagateMark()
moretodo = true; moretodo = true;
} }
} }
if (!moretodo && sides != NULL) if (!moretodo && level.sides.Size() > 0)
{ {
for (i = 0; i < SIDEDEFSTEPSIZE && SideNum + i < numsides; ++i) for (i = 0; i < SIDEDEFSTEPSIZE && SideNum + i < (int)level.sides.Size(); ++i)
{ {
side_t *side = &sides[SideNum + i]; side_t *side = &level.sides[SideNum + i];
for(int j=0;j<3;j++) GC::Mark(side->textures[j].interpolation); for(int j=0;j<3;j++) GC::Mark(side->textures[j].interpolation);
} }
marked += i * sizeof(side_t); marked += i * sizeof(side_t);
if (SideNum + i < numsides) if (SideNum + i < (int)level.sides.Size())
{ {
SideNum += i; SideNum += i;
moretodo = true; moretodo = true;

View file

@ -29,6 +29,7 @@
#include "i_system.h" #include "i_system.h"
#include "g_level.h" #include "g_level.h"
#include "p_local.h" #include "p_local.h"
#include "g_levellocals.h"
int SaveVersion; int SaveVersion;

View file

@ -49,6 +49,7 @@
#include "v_palette.h" #include "v_palette.h"
#include "p_acs.h" #include "p_acs.h"
#include "r_data/colormaps.h" #include "r_data/colormaps.h"
#include "g_levellocals.h"
struct FEDOptions : public FOptionalMapinfoData struct FEDOptions : public FOptionalMapinfoData

View file

@ -48,6 +48,7 @@
#include "g_level.h" #include "g_level.h"
#include "r_renderer.h" #include "r_renderer.h"
#include "d_player.h" #include "d_player.h"
#include "g_levellocals.h"
//========================================================================== //==========================================================================
// //

View file

@ -71,6 +71,7 @@
#include "r_utility.h" #include "r_utility.h"
#include "a_ammo.h" #include "a_ammo.h"
#include "math/cmath.h" #include "math/cmath.h"
#include "g_levellocals.h"
static FRandom pr_script("FScript"); static FRandom pr_script("FScript");

View file

@ -43,6 +43,7 @@
#include "cmdlib.h" #include "cmdlib.h"
#include "p_lnspec.h" #include "p_lnspec.h"
#include "gi.h" #include "gi.h"
#include "g_levellocals.h"
#include "xlat/xlat.h" #include "xlat/xlat.h"
void T_Init(); void T_Init();

View file

@ -55,6 +55,7 @@
#include "doomerrors.h" #include "doomerrors.h"
#include "doomstat.h" #include "doomstat.h"
#include "serializer.h" #include "serializer.h"
#include "g_levellocals.h"
//========================================================================== //==========================================================================
// //

View file

@ -91,6 +91,7 @@
#include <zlib.h> #include <zlib.h>
#include "g_hub.h" #include "g_hub.h"
#include "g_levellocals.h"
static FRandom pr_dmspawn ("DMSpawn"); static FRandom pr_dmspawn ("DMSpawn");

View file

@ -44,6 +44,7 @@
#include "gstrings.h" #include "gstrings.h"
#include "wi_stuff.h" #include "wi_stuff.h"
#include "serializer.h" #include "serializer.h"
#include "g_levellocals.h"
//========================================================================== //==========================================================================

View file

@ -22,6 +22,7 @@
#include "serializer.h" #include "serializer.h"
#include "r_utility.h" #include "r_utility.h"
#include "virtual.h" #include "virtual.h"
#include "g_levellocals.h"
#include "r_data/colormaps.h" #include "r_data/colormaps.h"

View file

@ -22,6 +22,7 @@
#include "virtual.h" #include "virtual.h"
#include "a_ammo.h" #include "a_ammo.h"
#include "c_functions.h" #include "c_functions.h"
#include "g_levellocals.h"
EXTERN_CVAR(Bool, sv_unlimited_pickup) EXTERN_CVAR(Bool, sv_unlimited_pickup)

View file

@ -88,6 +88,7 @@
#include "gi.h" #include "gi.h"
#include "g_hub.h" #include "g_hub.h"
#include "g_levellocals.h"
#include <string.h> #include <string.h>

View file

@ -376,78 +376,6 @@ struct level_info_t
} }
}; };
struct FLevelLocals
{
void Tick ();
void AddScroller (int secnum);
BYTE md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded.
int time; // time in the hub
int maptime; // time in the map
int totaltime; // time in the game
int starttime;
int partime;
int sucktime;
level_info_t *info;
int cluster;
int clusterflags;
int levelnum;
int lumpnum;
FString LevelName;
FString MapName; // the lump name (E1M1, MAP01, etc)
FString NextMap; // go here when using the regular exit
FString NextSecretMap; // map to go to when used secret exit
EMapType maptype;
TStaticArray<sector_t> sectors;
TStaticArray<line_t> lines;
DWORD flags;
DWORD flags2;
DWORD flags3;
DWORD fadeto; // The color the palette fades to (usually black)
DWORD outsidefog; // The fog for sectors with sky ceilings
FString Music;
int musicorder;
int cdtrack;
unsigned int cdid;
FTextureID skytexture1;
FTextureID skytexture2;
float skyspeed1; // Scrolling speed of sky textures, in pixels per ms
float skyspeed2;
int total_secrets;
int found_secrets;
int total_items;
int found_items;
int total_monsters;
int killed_monsters;
double gravity;
double aircontrol;
double airfriction;
int airsupply;
int DefaultEnvironment; // Default sound environment.
TArray<DVector2> Scrolls; // NULL if no DScrollers in this level
SBYTE WallVertLight; // Light diffs for vert/horiz walls
SBYTE WallHorizLight;
bool FromSnapshot; // The current map was restored from a snapshot
double teamdamage;
bool IsJumpingAllowed() const;
bool IsCrouchingAllowed() const;
bool IsFreelookAllowed() const;
};
struct cluster_info_t struct cluster_info_t
{ {
@ -477,8 +405,6 @@ struct cluster_info_t
#define CLUSTER_LOOKUPCLUSTERNAME 0x00000080 // Cluster name is the name of a language string #define CLUSTER_LOOKUPCLUSTERNAME 0x00000080 // Cluster name is the name of a language string
#define CLUSTER_ALLOWINTERMISSION 0x00000100 // Allow intermissions between levels in a hub. #define CLUSTER_ALLOWINTERMISSION 0x00000100 // Allow intermissions between levels in a hub.
extern FLevelLocals level;
extern TArray<level_info_t> wadlevelinfos; extern TArray<level_info_t> wadlevelinfos;
extern TArray<cluster_info_t> wadclusterinfos; extern TArray<cluster_info_t> wadclusterinfos;

95
src/g_levellocals.h Normal file
View file

@ -0,0 +1,95 @@
#pragma once
#include "g_level.h"
#include "r_defs.h"
struct FLevelLocals
{
void Tick ();
void AddScroller (int secnum);
BYTE md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded.
int time; // time in the hub
int maptime; // time in the map
int totaltime; // time in the game
int starttime;
int partime;
int sucktime;
level_info_t *info;
int cluster;
int clusterflags;
int levelnum;
int lumpnum;
FString LevelName;
FString MapName; // the lump name (E1M1, MAP01, etc)
FString NextMap; // go here when using the regular exit
FString NextSecretMap; // map to go to when used secret exit
EMapType maptype;
TStaticArray<sector_t> sectors;
TStaticArray<line_t> lines;
TStaticArray<side_t> sides;
DWORD flags;
DWORD flags2;
DWORD flags3;
DWORD fadeto; // The color the palette fades to (usually black)
DWORD outsidefog; // The fog for sectors with sky ceilings
FString Music;
int musicorder;
int cdtrack;
unsigned int cdid;
FTextureID skytexture1;
FTextureID skytexture2;
float skyspeed1; // Scrolling speed of sky textures, in pixels per ms
float skyspeed2;
int total_secrets;
int found_secrets;
int total_items;
int found_items;
int total_monsters;
int killed_monsters;
double gravity;
double aircontrol;
double airfriction;
int airsupply;
int DefaultEnvironment; // Default sound environment.
TArray<DVector2> Scrolls; // NULL if no DScrollers in this level
SBYTE WallVertLight; // Light diffs for vert/horiz walls
SBYTE WallHorizLight;
bool FromSnapshot; // The current map was restored from a snapshot
double teamdamage;
bool IsJumpingAllowed() const;
bool IsCrouchingAllowed() const;
bool IsFreelookAllowed() const;
};
extern FLevelLocals level;
inline int side_t::Index() const
{
return int(this - &level.sides[0]);
}
inline int line_t::Index() const
{
return int(this - &level.lines[0]);
}
inline int sector_t::Index() const
{
return int(this - &level.sectors[0]);
}

View file

@ -51,6 +51,7 @@
#include "autosegs.h" #include "autosegs.h"
#include "version.h" #include "version.h"
#include "v_text.h" #include "v_text.h"
#include "g_levellocals.h"
TArray<cluster_info_t> wadclusterinfos; TArray<cluster_info_t> wadclusterinfos;
TArray<level_info_t> wadlevelinfos; TArray<level_info_t> wadlevelinfos;

View file

@ -47,6 +47,7 @@
#include "serializer.h" #include "serializer.h"
#include "doomdata.h" #include "doomdata.h"
#include "r_state.h" #include "r_state.h"
#include "g_levellocals.h"
static double DecalWidth, DecalLeft, DecalRight; static double DecalWidth, DecalLeft, DecalRight;
static double SpreadZ; static double SpreadZ;
@ -415,7 +416,7 @@ void DBaseDecal::SpreadLeft (double r, vertex_t *v1, side_t *feelwall, F3DFloor
double x = v1->fX(); double x = v1->fX();
double y = v1->fY(); double y = v1->fY();
feelwall = &sides[feelwall->LeftSide]; feelwall = &level.sides[feelwall->LeftSide];
GetWallStuff (feelwall, v1, ldx, ldy); GetWallStuff (feelwall, v1, ldx, ldy);
double wallsize = Length (ldx, ldy); double wallsize = Length (ldx, ldy);
r += DecalLeft; r += DecalLeft;
@ -455,7 +456,7 @@ void DBaseDecal::SpreadRight (double r, side_t *feelwall, double wallsize, F3DFl
while (r > wallsize && feelwall->RightSide != NO_SIDE) while (r > wallsize && feelwall->RightSide != NO_SIDE)
{ {
feelwall = &sides[feelwall->RightSide]; feelwall = &level.sides[feelwall->RightSide];
side_t *nextwall = NextWall (feelwall); side_t *nextwall = NextWall (feelwall);
if (nextwall != NULL && nextwall->LeftSide != NO_SIDE) if (nextwall != NULL && nextwall->LeftSide != NO_SIDE)

View file

@ -7,6 +7,7 @@
#include "b_bot.h" #include "b_bot.h"
#include "p_checkposition.h" #include "p_checkposition.h"
#include "virtual.h" #include "virtual.h"
#include "g_levellocals.h"
IMPLEMENT_CLASS(AFastProjectile, false, false) IMPLEMENT_CLASS(AFastProjectile, false, false)

View file

@ -2,6 +2,7 @@
#include "g_level.h" #include "g_level.h"
#include "d_player.h" #include "d_player.h"
#include "serializer.h" #include "serializer.h"
#include "g_levellocals.h"
IMPLEMENT_CLASS(DFlashFader, false, true) IMPLEMENT_CLASS(DFlashFader, false, true)

View file

@ -10,6 +10,7 @@
#include "g_level.h" #include "g_level.h"
#include "r_state.h" #include "r_state.h"
#include "serializer.h" #include "serializer.h"
#include "g_levellocals.h"
static FRandom pr_lightning ("Lightning"); static FRandom pr_lightning ("Lightning");

View file

@ -16,6 +16,7 @@
#include "d_player.h" #include "d_player.h"
#include "a_armor.h" #include "a_armor.h"
#include "r_data/sprites.h" #include "r_data/sprites.h"
#include "g_levellocals.h"
static FRandom pr_morphmonst ("MorphMonster"); static FRandom pr_morphmonst ("MorphMonster");

View file

@ -38,6 +38,7 @@
#include "p_lnspec.h" #include "p_lnspec.h"
#include "doomstat.h" #include "doomstat.h"
#include "serializer.h" #include "serializer.h"
#include "g_levellocals.h"
/* /*
== InterpolationPoint: node along a camera's path == InterpolationPoint: node along a camera's path

View file

@ -16,6 +16,7 @@
#include "v_text.h" #include "v_text.h"
#include "doomstat.h" #include "doomstat.h"
#include "doomdata.h" #include "doomdata.h"
#include "g_levellocals.h"
#define MAX_RANDOMSPAWNERS_RECURSION 32 // Should be largely more than enough, honestly. #define MAX_RANDOMSPAWNERS_RECURSION 32 // Should be largely more than enough, honestly.
static FRandom pr_randomspawn("RandomSpawn"); static FRandom pr_randomspawn("RandomSpawn");

View file

@ -60,6 +60,7 @@
#include "version.h" #include "version.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "a_ammo.h" #include "a_ammo.h"
#include "g_levellocals.h"
#define ARTIFLASH_OFFSET (statusBar->invBarOffset+6) #define ARTIFLASH_OFFSET (statusBar->invBarOffset+6)
enum enum

View file

@ -55,6 +55,7 @@
#include "d_player.h" #include "d_player.h"
#include "r_utility.h" #include "r_utility.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "g_levellocals.h"
#include <time.h> #include <time.h>

View file

@ -55,6 +55,7 @@
#include "gstrings.h" #include "gstrings.h"
#include "r_utility.h" #include "r_utility.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "g_levellocals.h"
#include "../version.h" #include "../version.h"

View file

@ -43,6 +43,7 @@
#include "v_font.h" #include "v_font.h"
#include "m_fixed.h" #include "m_fixed.h"
#include "gstrings.h" #include "gstrings.h"
#include "g_levellocals.h"
TArray<FSkillInfo> AllSkills; TArray<FSkillInfo> AllSkills;
int DefaultSkill = -1; int DefaultSkill = -1;

View file

@ -19,6 +19,7 @@
#include "colormatcher.h" #include "colormatcher.h"
#include "v_palette.h" #include "v_palette.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "g_levellocals.h"
// Number of tics to move the popscreen up and down. // Number of tics to move the popscreen up and down.
#define POP_TIME (TICRATE/8) #define POP_TIME (TICRATE/8)

View file

@ -38,6 +38,7 @@
#include "i_system.h" #include "i_system.h"
#include "v_text.h" #include "v_text.h"
#include "r_utility.h" #include "r_utility.h"
#include "g_levellocals.h"
#include "gl/dynlights/gl_dynlight.h" #include "gl/dynlights/gl_dynlight.h"
#include "gl/utility/gl_geometric.h" #include "gl/utility/gl_geometric.h"
#include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderer.h"

View file

@ -41,6 +41,7 @@
#include "g_level.h" #include "g_level.h"
#include "doomstat.h" #include "doomstat.h"
#include "d_player.h" #include "d_player.h"
#include "g_levellocals.h"
#include "gl/system/gl_interface.h" #include "gl/system/gl_interface.h"
#include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderer.h"

View file

@ -38,6 +38,7 @@
#include "gi.h" #include "gi.h"
#include "g_level.h" #include "g_level.h"
#include "a_sharedglobal.h" #include "a_sharedglobal.h"
#include "g_levellocals.h"
#include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderer.h"
#include "gl/data/gl_data.h" #include "gl/data/gl_data.h"

View file

@ -40,6 +40,7 @@
#include "gi.h" #include "gi.h"
#include "p_setup.h" #include "p_setup.h"
#include "g_level.h" #include "g_level.h"
#include "g_levellocals.h"
#include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderer.h"
#include "gl/data/gl_data.h" #include "gl/data/gl_data.h"
@ -459,8 +460,8 @@ static void InitVertexData()
static void GetSideVertices(int sdnum, DVector2 *v1, DVector2 *v2) static void GetSideVertices(int sdnum, DVector2 *v1, DVector2 *v2)
{ {
line_t *ln = sides[sdnum].linedef; line_t *ln = level.sides[sdnum].linedef;
if (ln->sidedef[0] == &sides[sdnum]) if (ln->sidedef[0] == &level.sides[sdnum])
{ {
*v1 = ln->v1->fPos(); *v1 = ln->v1->fPos();
*v2 = ln->v2->fPos(); *v2 = ln->v2->fPos();
@ -487,6 +488,7 @@ static int segcmp(const void *a, const void *b)
static void PrepareSegs() static void PrepareSegs()
{ {
auto numsides = level.sides.Size();
int *segcount = new int[numsides]; int *segcount = new int[numsides];
int realsegs = 0; int realsegs = 0;
@ -534,7 +536,7 @@ static void PrepareSegs()
seg_t *seg = &segs[i]; seg_t *seg = &segs[i];
if (seg->sidedef == NULL) continue; // miniseg if (seg->sidedef == NULL) continue; // miniseg
int sidenum = int(seg->sidedef - sides); int sidenum = seg->sidedef->Index();
realsegs++; realsegs++;
segcount[sidenum]++; segcount[sidenum]++;
@ -548,13 +550,13 @@ static void PrepareSegs()
} }
// allocate memory // allocate memory
sides[0].segs = new seg_t*[realsegs]; level.sides[0].segs = new seg_t*[realsegs];
sides[0].numsegs = 0; level.sides[0].numsegs = 0;
for(int i = 1; i < numsides; i++) for(int i = 1; i < numsides; i++)
{ {
sides[i].segs = sides[i-1].segs + segcount[i-1]; level.sides[i].segs = level.sides[i-1].segs + segcount[i-1];
sides[i].numsegs = 0; level.sides[i].numsegs = 0;
} }
delete [] segcount; delete [] segcount;
@ -568,7 +570,7 @@ static void PrepareSegs()
// sort the segs // sort the segs
for(int i = 0; i < numsides; i++) for(int i = 0; i < numsides; i++)
{ {
if (sides[i].numsegs > 1) qsort(sides[i].segs, sides[i].numsegs, sizeof(seg_t*), segcmp); if (level.sides[i].numsegs > 1) qsort(level.sides[i].segs, level.sides[i].numsegs, sizeof(seg_t*), segcmp);
} }
} }
@ -667,10 +669,10 @@ void gl_CleanLevelData()
} }
} }
if (sides && sides[0].segs) if (level.sides.Size() > 0 && level.sides[0].segs)
{ {
delete [] sides[0].segs; delete [] level.sides[0].segs;
sides[0].segs = NULL; level.sides[0].segs = NULL;
} }
if (level.sectors.Size() > 0 && level.sectors[0].subsectors) if (level.sectors.Size() > 0 && level.sectors[0].subsectors)
{ {

View file

@ -31,6 +31,7 @@
#include "r_state.h" #include "r_state.h"
#include "m_argv.h" #include "m_argv.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "g_levellocals.h"
#include "gl/system/gl_interface.h" #include "gl/system/gl_interface.h"
#include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderer.h"
#include "gl/shaders/gl_shader.h" #include "gl/shaders/gl_shader.h"

View file

@ -71,6 +71,7 @@
#include "portal.h" #include "portal.h"
#include "doomstat.h" #include "doomstat.h"
#include "serializer.h" #include "serializer.h"
#include "g_levellocals.h"
#include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderer.h"

View file

@ -49,6 +49,7 @@
#include "zstring.h" #include "zstring.h"
#include "d_dehacked.h" #include "d_dehacked.h"
#include "v_text.h" #include "v_text.h"
#include "g_levellocals.h"
#include "gl/dynlights/gl_dynlight.h" #include "gl/dynlights/gl_dynlight.h"

View file

@ -37,6 +37,7 @@
#include "g_level.h" #include "g_level.h"
#include "r_state.h" #include "r_state.h"
#include "d_player.h" #include "d_player.h"
#include "g_levellocals.h"
//#include "resources/voxels.h" //#include "resources/voxels.h"
//#include "gl/gl_intern.h" //#include "gl/gl_intern.h"

View file

@ -38,6 +38,7 @@
#include "p_local.h" #include "p_local.h"
#include "g_level.h" #include "g_level.h"
#include "r_sky.h" #include "r_sky.h"
#include "g_levellocals.h"
// externally settable lighting properties // externally settable lighting properties
static float distfogtable[2][256]; // light to fog conversion table for black fog static float distfogtable[2][256]; // light to fog conversion table for black fog

View file

@ -32,6 +32,7 @@
#include "r_utility.h" #include "r_utility.h"
#include "r_state.h" #include "r_state.h"
#include "doomstat.h" #include "doomstat.h"
#include "g_levellocals.h"
#include "gl/system/gl_cvars.h" #include "gl/system/gl_cvars.h"
#include "gl/data/gl_data.h" #include "gl/data/gl_data.h"

View file

@ -35,6 +35,7 @@
#include "d_player.h" #include "d_player.h"
#include "portal.h" #include "portal.h"
#include "templates.h" #include "templates.h"
#include "g_levellocals.h"
#include "gl/system/gl_interface.h" #include "gl/system/gl_interface.h"
#include "gl/system/gl_cvars.h" #include "gl/system/gl_cvars.h"

View file

@ -30,7 +30,7 @@
#include "r_defs.h" #include "r_defs.h"
#include "r_sky.h" #include "r_sky.h"
#include "g_level.h" #include "g_level.h"
#include "g_levellocals.h"
#include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderer.h"
#include "gl/data/gl_data.h" #include "gl/data/gl_data.h"

View file

@ -43,6 +43,7 @@
#include "p_local.h" #include "p_local.h"
#include "gl/gl_functions.h" #include "gl/gl_functions.h"
#include "serializer.h" #include "serializer.h"
#include "g_levellocals.h"
#include "gl/dynlights/gl_lightbuffer.h" #include "gl/dynlights/gl_lightbuffer.h"
#include "gl/system/gl_interface.h" #include "gl/system/gl_interface.h"

View file

@ -28,6 +28,7 @@
#include "r_utility.h" #include "r_utility.h"
#include "doomdata.h" #include "doomdata.h"
#include "portal.h" #include "portal.h"
#include "g_levellocals.h"
#include "gl/gl_functions.h" #include "gl/gl_functions.h"
#include "gl/data/gl_data.h" #include "gl/data/gl_data.h"

View file

@ -36,6 +36,7 @@
#include "r_utility.h" #include "r_utility.h"
#include "a_pickups.h" #include "a_pickups.h"
#include "d_player.h" #include "d_player.h"
#include "g_levellocals.h"
#include "gl/system/gl_interface.h" #include "gl/system/gl_interface.h"
#include "gl/system/gl_framebuffer.h" #include "gl/system/gl_framebuffer.h"

View file

@ -33,6 +33,7 @@
#include "p_maputl.h" #include "p_maputl.h"
#include "doomdata.h" #include "doomdata.h"
#include "portal.h" #include "portal.h"
#include "g_levellocals.h"
#include "gl/system/gl_cvars.h" #include "gl/system/gl_cvars.h"
#include "gl/renderer/gl_lightdata.h" #include "gl/renderer/gl_lightdata.h"

View file

@ -32,6 +32,7 @@
#include "doomstat.h" #include "doomstat.h"
#include "d_player.h" #include "d_player.h"
#include "g_level.h" #include "g_level.h"
#include "g_levellocals.h"
#include "gl/system/gl_interface.h" #include "gl/system/gl_interface.h"
#include "gl/system/gl_cvars.h" #include "gl/system/gl_cvars.h"

View file

@ -48,6 +48,7 @@
#include "c_dispatch.h" #include "c_dispatch.h"
#include "r_utility.h" #include "r_utility.h"
#include "v_video.h" #include "v_video.h"
#include "g_levellocals.h"
#include "gl/utility/gl_clock.h" #include "gl/utility/gl_clock.h"
#include "gl/utility/gl_convert.h" #include "gl/utility/gl_convert.h"

View file

@ -50,6 +50,7 @@
#include "gstrings.h" #include "gstrings.h"
#include "d_net.h" #include "d_net.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "g_levellocals.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------

View file

@ -51,6 +51,7 @@
#include "p_conversation.h" #include "p_conversation.h"
#include "menu/menu.h" #include "menu/menu.h"
#include "d_net.h" #include "d_net.h"
#include "g_levellocals.h"
FIntermissionDescriptorList IntermissionDescriptors; FIntermissionDescriptorList IntermissionDescriptors;

View file

@ -49,6 +49,7 @@
#include "a_morph.h" #include "a_morph.h"
#include "a_armor.h" #include "a_armor.h"
#include "a_ammo.h" #include "a_ammo.h"
#include "g_levellocals.h"
// [RH] Actually handle the cheat. The cheat code in st_stuff.c now just // [RH] Actually handle the cheat. The cheat code in st_stuff.c now just
// writes some bytes to the network data stream, and the network code // writes some bytes to the network data stream, and the network code

View file

@ -37,6 +37,7 @@
#include "v_video.h" #include "v_video.h"
#include "g_level.h" #include "g_level.h"
#include "gi.h" #include "gi.h"
#include "g_levellocals.h"
#include "textures/textures.h" #include "textures/textures.h"
class DReadThisMenu : public DMenu class DReadThisMenu : public DMenu

View file

@ -186,7 +186,7 @@ int FNodeBuilder::CreateSeg (int linenum, int sidenum)
} }
seg.linedef = linenum; seg.linedef = linenum;
side_t *sd = Level.Lines[linenum].sidedef[sidenum]; side_t *sd = Level.Lines[linenum].sidedef[sidenum];
seg.sidedef = sd != NULL? int(sd - sides) : int(NO_SIDE); seg.sidedef = sd != NULL? sd->Index() : int(NO_SIDE);
seg.nextforvert = Vertices[seg.v1].segs; seg.nextforvert = Vertices[seg.v1].segs;
seg.nextforvert2 = Vertices[seg.v2].segs2; seg.nextforvert2 = Vertices[seg.v2].segs2;

View file

@ -47,6 +47,7 @@
#include "r_utility.h" #include "r_utility.h"
#include "p_spec.h" #include "p_spec.h"
#include "r_data/colormaps.h" #include "r_data/colormaps.h"
#include "g_levellocals.h"
EXTERN_CVAR(Int, vid_renderer) EXTERN_CVAR(Int, vid_renderer)

View file

@ -41,6 +41,7 @@
#include "p_terrain.h" #include "p_terrain.h"
#include "p_maputl.h" #include "p_maputl.h"
#include "p_spec.h" #include "p_spec.h"
#include "g_levellocals.h"
//============================================================================ //============================================================================

View file

@ -86,6 +86,7 @@
#include "a_armor.h" #include "a_armor.h"
#include "a_ammo.h" #include "a_ammo.h"
#include "r_data/colormaps.h" #include "r_data/colormaps.h"
#include "g_levellocals.h"
extern FILE *Logfile; extern FILE *Logfile;
@ -3332,16 +3333,14 @@ void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, int flags)
picnum1 = TexMan.GetTexture (fromname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable); picnum1 = TexMan.GetTexture (fromname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
picnum2 = TexMan.GetTexture (toname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable); picnum2 = TexMan.GetTexture (toname, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable);
for (int i = 0; i < numsides; ++i) for (auto &side : level.sides)
{ {
side_t *wal = &sides[i];
for(int j=0;j<3;j++) for(int j=0;j<3;j++)
{ {
static BYTE bits[]={NOT_TOP, NOT_MIDDLE, NOT_BOTTOM}; static BYTE bits[]={NOT_TOP, NOT_MIDDLE, NOT_BOTTOM};
if (!(flags & bits[j]) && wal->GetTexture(j) == picnum1) if (!(flags & bits[j]) && side.GetTexture(j) == picnum1)
{ {
wal->SetTexture(j, picnum2); side.SetTexture(j, picnum2);
} }
} }
} }
@ -4428,14 +4427,14 @@ int DLevelScript::SideFromID(int id, int side)
{ {
if (activationline == NULL) return -1; if (activationline == NULL) return -1;
if (activationline->sidedef[side] == NULL) return -1; if (activationline->sidedef[side] == NULL) return -1;
return activationline->sidedef[side]->Index; return activationline->sidedef[side]->UDMFIndex;
} }
else else
{ {
int line = P_FindFirstLineFromID(id); int line = P_FindFirstLineFromID(id);
if (line == -1) return -1; if (line == -1) return -1;
if (level.lines[line].sidedef[side] == NULL) return -1; if (level.lines[line].sidedef[side] == NULL) return -1;
return level.lines[line].sidedef[side]->Index; return level.lines[line].sidedef[side]->UDMFIndex;
} }
} }

View file

@ -80,6 +80,7 @@
#include "math/cmath.h" #include "math/cmath.h"
#include "a_armor.h" #include "a_armor.h"
#include "a_health.h" #include "a_health.h"
#include "g_levellocals.h"
AActor *SingleActorFromTID(int tid, AActor *defactor); AActor *SingleActorFromTID(int tid, AActor *defactor);

View file

@ -31,6 +31,7 @@
#include "gi.h" #include "gi.h"
#include "serializer.h" #include "serializer.h"
#include "p_spec.h" #include "p_spec.h"
#include "g_levellocals.h"
//============================================================================ //============================================================================
// //

View file

@ -60,6 +60,7 @@
#include "r_utility.h" #include "r_utility.h"
#include "p_local.h" #include "p_local.h"
#include "menu/menu.h" #include "menu/menu.h"
#include "g_levellocals.h"
// The conversations as they exist inside a SCRIPTxx lump. // The conversations as they exist inside a SCRIPTxx lump.
struct Response struct Response

View file

@ -38,6 +38,7 @@
#include "serializer.h" #include "serializer.h"
#include "d_player.h" #include "d_player.h"
#include "p_spec.h" #include "p_spec.h"
#include "g_levellocals.h"
//============================================================================ //============================================================================
// //

View file

@ -53,6 +53,7 @@
#include "colormatcher.h" #include "colormatcher.h"
#include "d_player.h" #include "d_player.h"
#include "r_utility.h" #include "r_utility.h"
#include "g_levellocals.h"
CVAR (Int, cl_rockettrails, 1, CVAR_ARCHIVE); CVAR (Int, cl_rockettrails, 1, CVAR_ARCHIVE);
CVAR (Bool, r_rail_smartspiral, 0, CVAR_ARCHIVE); CVAR (Bool, r_rail_smartspiral, 0, CVAR_ARCHIVE);

View file

@ -52,6 +52,7 @@
#include "p_checkposition.h" #include "p_checkposition.h"
#include "math/cmath.h" #include "math/cmath.h"
#include "a_ammo.h" #include "a_ammo.h"
#include "g_levellocals.h"
#include "gi.h" #include "gi.h"

View file

@ -32,6 +32,7 @@
#include "p_3dmidtex.h" #include "p_3dmidtex.h"
#include "p_spec.h" #include "p_spec.h"
#include "r_data/r_interpolate.h" #include "r_data/r_interpolate.h"
#include "g_levellocals.h"
//========================================================================== //==========================================================================
// //

View file

@ -67,6 +67,7 @@
#include "m_misc.h" #include "m_misc.h"
#include "r_utility.h" #include "r_utility.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "g_levellocals.h"
void P_GetPolySpots (MapData * lump, TArray<FNodeBuilder::FPolyStart> &spots, TArray<FNodeBuilder::FPolyStart> &anchors); void P_GetPolySpots (MapData * lump, TArray<FNodeBuilder::FPolyStart> &spots, TArray<FNodeBuilder::FPolyStart> &anchors);
@ -129,6 +130,7 @@ struct gl5_mapnode_t
static int CheckForMissingSegs() static int CheckForMissingSegs()
{ {
auto numsides = level.sides.Size();
double *added_seglen = new double[numsides]; double *added_seglen = new double[numsides];
int missing = 0; int missing = 0;
@ -141,13 +143,13 @@ static int CheckForMissingSegs()
{ {
// check all the segs and calculate the length they occupy on their sidedef // check all the segs and calculate the length they occupy on their sidedef
DVector2 vec1(seg->v2->fX() - seg->v1->fX(), seg->v2->fY() - seg->v1->fY()); DVector2 vec1(seg->v2->fX() - seg->v1->fX(), seg->v2->fY() - seg->v1->fY());
added_seglen[seg->sidedef - sides] += vec1.Length(); added_seglen[seg->sidedef->Index()] += vec1.Length();
} }
} }
for(int i=0;i<numsides;i++) for(unsigned i=0;i<numsides;i++)
{ {
double linelen = sides[i].linedef->Delta().Length(); double linelen = level.sides[i].linedef->Delta().Length();
missing += (added_seglen[i] < linelen - 1.); missing += (added_seglen[i] < linelen - 1.);
} }
@ -1001,7 +1003,7 @@ bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
FNodeBuilder::FLevel leveldata = FNodeBuilder::FLevel leveldata =
{ {
vertexes, numvertexes, vertexes, numvertexes,
sides, numsides, &level.sides[0], (int)level.sides.Size(),
&level.lines[0], (int)level.lines.Size(), &level.lines[0], (int)level.lines.Size(),
0, 0, 0, 0 0, 0, 0, 0
}; };

View file

@ -60,6 +60,7 @@
#include "a_morph.h" #include "a_morph.h"
#include "virtual.h" #include "virtual.h"
#include "a_health.h" #include "a_health.h"
#include "g_levellocals.h"
static FRandom pr_obituary ("Obituary"); static FRandom pr_obituary ("Obituary");
static FRandom pr_botrespawn ("BotRespawn"); static FRandom pr_botrespawn ("BotRespawn");

View file

@ -32,6 +32,7 @@
#include "p_lnspec.h" #include "p_lnspec.h"
#include "doomstat.h" #include "doomstat.h"
#include "p_maputl.h" #include "p_maputl.h"
#include "g_levellocals.h"
// State. // State.
#include "r_state.h" #include "r_state.h"

View file

@ -37,6 +37,7 @@
#include "p_local.h" #include "p_local.h"
#include "p_lnspec.h" #include "p_lnspec.h"
#include "p_spec.h" #include "p_spec.h"
#include "g_levellocals.h"
enum enum
{ {

View file

@ -61,6 +61,7 @@
#include "r_data/colormaps.h" #include "r_data/colormaps.h"
#include "fragglescript/t_fs.h" #include "fragglescript/t_fs.h"
#include "p_spec.h" #include "p_spec.h"
#include "g_levellocals.h"
// Remaps EE sector change types to Generic_Floor values. According to the Eternity Wiki: // Remaps EE sector change types to Generic_Floor values. According to the Eternity Wiki:
/* /*

View file

@ -63,6 +63,7 @@
#include "r_data/r_translate.h" #include "r_data/r_translate.h"
#include "g_level.h" #include "g_level.h"
#include "r_sky.h" #include "r_sky.h"
#include "g_levellocals.h"
CVAR(Bool, cl_bloodsplats, true, CVAR_ARCHIVE) CVAR(Bool, cl_bloodsplats, true, CVAR_ARCHIVE)
CVAR(Int, sv_smartaim, 0, CVAR_ARCHIVE | CVAR_SERVERINFO) CVAR(Int, sv_smartaim, 0, CVAR_ARCHIVE | CVAR_SERVERINFO)

View file

@ -44,6 +44,7 @@
#include "r_state.h" #include "r_state.h"
#include "templates.h" #include "templates.h"
#include "po_man.h" #include "po_man.h"
#include "g_levellocals.h"
sector_t *P_PointInSectorBuggy(double x, double y); sector_t *P_PointInSectorBuggy(double x, double y);
int P_VanillaPointOnDivlineSide(double x, double y, const divline_t* line); int P_VanillaPointOnDivlineSide(double x, double y, const divline_t* line);

View file

@ -72,6 +72,7 @@
#include "a_armor.h" #include "a_armor.h"
#include "a_ammo.h" #include "a_ammo.h"
#include "a_health.h" #include "a_health.h"
#include "g_levellocals.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -7539,6 +7540,22 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
return 0; return 0;
} }
double AActor::GetBobOffset(double ticfrac) const
{
if (!(flags2 & MF2_FLOATBOB))
{
return 0;
}
return BobSin(FloatBobPhase + level.maptime + ticfrac);
}
DEFINE_ACTION_FUNCTION(AActor, GetBobOffset)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT_DEF(frac);
ACTION_RETURN_FLOAT(self->GetBobOffset(frac));
}
@ -7639,13 +7656,6 @@ DEFINE_ACTION_FUNCTION(AActor, GetDefaultByType)
ACTION_RETURN_OBJECT(cls == nullptr? nullptr : GetDefaultByType(cls)); ACTION_RETURN_OBJECT(cls == nullptr? nullptr : GetDefaultByType(cls));
} }
DEFINE_ACTION_FUNCTION(AActor, GetBobOffset)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT_DEF(frac);
ACTION_RETURN_FLOAT(self->GetBobOffset(frac));
}
// This combines all 3 variations of the internal function // This combines all 3 variations of the internal function
DEFINE_ACTION_FUNCTION(AActor, VelFromAngle) DEFINE_ACTION_FUNCTION(AActor, VelFromAngle)
{ {

View file

@ -39,6 +39,7 @@
#include "s_sndseq.h" #include "s_sndseq.h"
#include "serializer.h" #include "serializer.h"
#include "r_data/r_interpolate.h" #include "r_data/r_interpolate.h"
#include "g_levellocals.h"
IMPLEMENT_CLASS(DPillar, false, true) IMPLEMENT_CLASS(DPillar, false, true)

View file

@ -32,6 +32,7 @@
#include "gi.h" #include "gi.h"
#include "serializer.h" #include "serializer.h"
#include "p_spec.h" #include "p_spec.h"
#include "g_levellocals.h"
static FRandom pr_doplat ("DoPlat"); static FRandom pr_doplat ("DoPlat");

View file

@ -30,6 +30,7 @@
#include "serializer.h" #include "serializer.h"
#include "v_text.h" #include "v_text.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "g_levellocals.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------

View file

@ -32,6 +32,7 @@
#include "p_maputl.h" #include "p_maputl.h"
#include "p_local.h" #include "p_local.h"
#include "d_player.h" #include "d_player.h"
#include "g_levellocals.h"
CVAR(Bool, var_pushers, true, CVAR_SERVERINFO); CVAR(Bool, var_pushers, true, CVAR_SERVERINFO);

View file

@ -62,10 +62,11 @@
#include "r_sky.h" #include "r_sky.h"
#include "r_renderer.h" #include "r_renderer.h"
#include "serializer.h" #include "serializer.h"
#include "g_levellocals.h"
static TStaticArray<sector_t> loadsectors; static TStaticArray<sector_t> loadsectors;
static TStaticArray<line_t> loadlines; static TStaticArray<line_t> loadlines;
static TArray<side_t> loadsides; static TStaticArray<side_t> loadsides;
//========================================================================== //==========================================================================
@ -903,7 +904,7 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
BYTE chk[16] = { 0 }; BYTE chk[16] = { 0 };
arc.Array("checksum", chk, 16); arc.Array("checksum", chk, 16);
if (arc.GetSize("linedefs") != level.lines.Size() || if (arc.GetSize("linedefs") != level.lines.Size() ||
arc.GetSize("sidedefs") != (unsigned)numsides || arc.GetSize("sidedefs") != level.sides.Size() ||
arc.GetSize("sectors") != level.sectors.Size() || arc.GetSize("sectors") != level.sectors.Size() ||
arc.GetSize("polyobjs") != (unsigned)po_NumPolyobjs || arc.GetSize("polyobjs") != (unsigned)po_NumPolyobjs ||
memcmp(chk, level.md5, 16)) memcmp(chk, level.md5, 16))
@ -957,7 +958,7 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
FBehavior::StaticSerializeModuleStates(arc); FBehavior::StaticSerializeModuleStates(arc);
// The order here is important: First world state, then portal state, then thinkers, and last polyobjects. // The order here is important: First world state, then portal state, then thinkers, and last polyobjects.
arc.Array("linedefs", &level.lines[0], &loadlines[0], level.lines.Size()); arc.Array("linedefs", &level.lines[0], &loadlines[0], level.lines.Size());
arc.Array("sidedefs", sides, &loadsides[0], numsides); arc.Array("sidedefs", &level.sides[0], &loadsides[0], level.sides.Size());
arc.Array("sectors", &level.sectors[0], &loadsectors[0], level.sectors.Size()); arc.Array("sectors", &level.sectors[0], &loadsectors[0], level.sectors.Size());
arc("zones", Zones); arc("zones", Zones);
arc("lineportals", linePortals); arc("lineportals", linePortals);
@ -998,8 +999,7 @@ void P_BackupMapData()
{ {
loadsectors = level.sectors; loadsectors = level.sectors;
loadlines = level.lines; loadlines = level.lines;
loadsides.Resize(numsides); loadsides = level.sides;
memcpy(&loadsides[0], sides, numsides * sizeof(side_t));
} }
void P_FreeMapDataBackup() void P_FreeMapDataBackup()

View file

@ -29,6 +29,7 @@
#include "serializer.h" #include "serializer.h"
#include "p_lnspec.h" #include "p_lnspec.h"
#include "r_data/r_interpolate.h" #include "r_data/r_interpolate.h"
#include "g_levellocals.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
@ -191,19 +192,19 @@ void DScroller::Tick ()
case EScroll::sc_side: // killough 3/7/98: Scroll wall texture case EScroll::sc_side: // killough 3/7/98: Scroll wall texture
if (m_Parts & EScrollPos::scw_top) if (m_Parts & EScrollPos::scw_top)
{ {
sides[m_Affectee].AddTextureXOffset(side_t::top, dx); level.sides[m_Affectee].AddTextureXOffset(side_t::top, dx);
sides[m_Affectee].AddTextureYOffset(side_t::top, dy); level.sides[m_Affectee].AddTextureYOffset(side_t::top, dy);
} }
if (m_Parts & EScrollPos::scw_mid && (sides[m_Affectee].linedef->backsector == NULL || if (m_Parts & EScrollPos::scw_mid && (level.sides[m_Affectee].linedef->backsector == NULL ||
!(sides[m_Affectee].linedef->flags&ML_3DMIDTEX))) !(level.sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
{ {
sides[m_Affectee].AddTextureXOffset(side_t::mid, dx); level.sides[m_Affectee].AddTextureXOffset(side_t::mid, dx);
sides[m_Affectee].AddTextureYOffset(side_t::mid, dy); level.sides[m_Affectee].AddTextureYOffset(side_t::mid, dy);
} }
if (m_Parts & EScrollPos::scw_bottom) if (m_Parts & EScrollPos::scw_bottom)
{ {
sides[m_Affectee].AddTextureXOffset(side_t::bottom, dx); level.sides[m_Affectee].AddTextureXOffset(side_t::bottom, dx);
sides[m_Affectee].AddTextureYOffset(side_t::bottom, dy); level.sides[m_Affectee].AddTextureYOffset(side_t::bottom, dy);
} }
break; break;
@ -276,19 +277,19 @@ DScroller::DScroller (EScroll type, double dx, double dy,
break; break;
case EScroll::sc_side: case EScroll::sc_side:
sides[affectee].Flags |= WALLF_NOAUTODECALS; level.sides[affectee].Flags |= WALLF_NOAUTODECALS;
if (m_Parts & EScrollPos::scw_top) if (m_Parts & EScrollPos::scw_top)
{ {
m_Interpolations[0] = sides[m_Affectee].SetInterpolation(side_t::top); m_Interpolations[0] = level.sides[m_Affectee].SetInterpolation(side_t::top);
} }
if (m_Parts & EScrollPos::scw_mid && (sides[m_Affectee].linedef->backsector == NULL || if (m_Parts & EScrollPos::scw_mid && (level.sides[m_Affectee].linedef->backsector == nullptr ||
!(sides[m_Affectee].linedef->flags&ML_3DMIDTEX))) !(level.sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
{ {
m_Interpolations[1] = sides[m_Affectee].SetInterpolation(side_t::mid); m_Interpolations[1] = level.sides[m_Affectee].SetInterpolation(side_t::mid);
} }
if (m_Parts & EScrollPos::scw_bottom) if (m_Parts & EScrollPos::scw_bottom)
{ {
m_Interpolations[2] = sides[m_Affectee].SetInterpolation(side_t::bottom); m_Interpolations[2] = level.sides[m_Affectee].SetInterpolation(side_t::bottom);
} }
break; break;
@ -349,22 +350,22 @@ DScroller::DScroller (double dx, double dy, const line_t *l,
m_LastHeight = 0; m_LastHeight = 0;
if ((m_Control = control) != -1) if ((m_Control = control) != -1)
m_LastHeight = level.sectors[control].CenterFloor() + level.sectors[control].CenterCeiling(); m_LastHeight = level.sectors[control].CenterFloor() + level.sectors[control].CenterCeiling();
m_Affectee = int(l->sidedef[0] - sides); m_Affectee = l->sidedef[0]->Index();
sides[m_Affectee].Flags |= WALLF_NOAUTODECALS; level.sides[m_Affectee].Flags |= WALLF_NOAUTODECALS;
m_Interpolations[0] = m_Interpolations[1] = m_Interpolations[2] = NULL; m_Interpolations[0] = m_Interpolations[1] = m_Interpolations[2] = NULL;
if (m_Parts & EScrollPos::scw_top) if (m_Parts & EScrollPos::scw_top)
{ {
m_Interpolations[0] = sides[m_Affectee].SetInterpolation(side_t::top); m_Interpolations[0] = level.sides[m_Affectee].SetInterpolation(side_t::top);
} }
if (m_Parts & EScrollPos::scw_mid && (sides[m_Affectee].linedef->backsector == NULL || if (m_Parts & EScrollPos::scw_mid && (level.sides[m_Affectee].linedef->backsector == NULL ||
!(sides[m_Affectee].linedef->flags&ML_3DMIDTEX))) !(level.sides[m_Affectee].linedef->flags&ML_3DMIDTEX)))
{ {
m_Interpolations[1] = sides[m_Affectee].SetInterpolation(side_t::mid); m_Interpolations[1] = level.sides[m_Affectee].SetInterpolation(side_t::mid);
} }
if (m_Parts & EScrollPos::scw_bottom) if (m_Parts & EScrollPos::scw_bottom)
{ {
m_Interpolations[2] = sides[m_Affectee].SetInterpolation(side_t::bottom); m_Interpolations[2] = level.sides[m_Affectee].SetInterpolation(side_t::bottom);
} }
} }
@ -536,41 +537,41 @@ void P_SpawnScrollers(void)
case Scroll_Texture_Offsets: case Scroll_Texture_Offsets:
// killough 3/2/98: scroll according to sidedef offsets // killough 3/2/98: scroll according to sidedef offsets
s = int(level.lines[i].sidedef[0] - sides); s = level.lines[i].sidedef[0]->Index();
new DScroller (EScroll::sc_side, -sides[s].GetTextureXOffset(side_t::mid), new DScroller (EScroll::sc_side, -level.sides[s].GetTextureXOffset(side_t::mid),
sides[s].GetTextureYOffset(side_t::mid), -1, s, accel, SCROLLTYPE(l->args[0])); level.sides[s].GetTextureYOffset(side_t::mid), -1, s, accel, SCROLLTYPE(l->args[0]));
break; break;
case Scroll_Texture_Left: case Scroll_Texture_Left:
l->special = special; // Restore the special, for compat_useblocking's benefit. l->special = special; // Restore the special, for compat_useblocking's benefit.
s = int(level.lines[i].sidedef[0] - sides); s = level.lines[i].sidedef[0]->Index();
new DScroller (EScroll::sc_side, l->args[0] / 64., 0, new DScroller (EScroll::sc_side, l->args[0] / 64., 0,
-1, s, accel, SCROLLTYPE(l->args[1])); -1, s, accel, SCROLLTYPE(l->args[1]));
break; break;
case Scroll_Texture_Right: case Scroll_Texture_Right:
l->special = special; l->special = special;
s = int(level.lines[i].sidedef[0] - sides); s = level.lines[i].sidedef[0]->Index();
new DScroller (EScroll::sc_side, -l->args[0] / 64., 0, new DScroller (EScroll::sc_side, -l->args[0] / 64., 0,
-1, s, accel, SCROLLTYPE(l->args[1])); -1, s, accel, SCROLLTYPE(l->args[1]));
break; break;
case Scroll_Texture_Up: case Scroll_Texture_Up:
l->special = special; l->special = special;
s = int(level.lines[i].sidedef[0] - sides); s = level.lines[i].sidedef[0]->Index();
new DScroller (EScroll::sc_side, 0, l->args[0] / 64., new DScroller (EScroll::sc_side, 0, l->args[0] / 64.,
-1, s, accel, SCROLLTYPE(l->args[1])); -1, s, accel, SCROLLTYPE(l->args[1]));
break; break;
case Scroll_Texture_Down: case Scroll_Texture_Down:
l->special = special; l->special = special;
s = int(level.lines[i].sidedef[0] - sides); s = level.lines[i].sidedef[0]->Index();
new DScroller (EScroll::sc_side, 0, -l->args[0] / 64., new DScroller (EScroll::sc_side, 0, -l->args[0] / 64.,
-1, s, accel, SCROLLTYPE(l->args[1])); -1, s, accel, SCROLLTYPE(l->args[1]));
break; break;
case Scroll_Texture_Both: case Scroll_Texture_Both:
s = int(level.lines[i].sidedef[0] - sides); s = level.lines[i].sidedef[0]->Index();
if (l->args[0] == 0) { if (l->args[0] == 0) {
dx = (l->args[1] - l->args[2]) / 64.; dx = (l->args[1] - l->args[2]) / 64.;
dy = (l->args[4] - l->args[3]) / 64.; dy = (l->args[4] - l->args[3]) / 64.;
@ -607,8 +608,8 @@ void SetWallScroller (int id, int sidechoice, double dx, double dy, EScrollPos W
{ {
int wallnum = scroller->GetWallNum (); int wallnum = scroller->GetWallNum ();
if (wallnum >= 0 && tagManager.LineHasID(sides[wallnum].linedef, id) && if (wallnum >= 0 && tagManager.LineHasID(level.sides[wallnum].linedef, id) &&
int(sides[wallnum].linedef->sidedef[sidechoice] - sides) == wallnum && level.sides[wallnum].linedef->sidedef[sidechoice]->Index() == wallnum &&
Where == scroller->GetScrollParts()) Where == scroller->GetScrollParts())
{ {
scroller->Destroy (); scroller->Destroy ();
@ -627,8 +628,8 @@ void SetWallScroller (int id, int sidechoice, double dx, double dy, EScrollPos W
while ( (collect.Obj = iterator.Next ()) ) while ( (collect.Obj = iterator.Next ()) )
{ {
if ((collect.RefNum = ((DScroller *)collect.Obj)->GetWallNum ()) != -1 && if ((collect.RefNum = ((DScroller *)collect.Obj)->GetWallNum ()) != -1 &&
tagManager.LineHasID(sides[collect.RefNum].linedef, id) && tagManager.LineHasID(level.sides[collect.RefNum].linedef, id) &&
int(sides[collect.RefNum].linedef->sidedef[sidechoice] - sides) == collect.RefNum && level.sides[collect.RefNum].linedef->sidedef[sidechoice]->Index() == collect.RefNum &&
Where == ((DScroller *)collect.Obj)->GetScrollParts()) Where == ((DScroller *)collect.Obj)->GetScrollParts())
{ {
((DScroller *)collect.Obj)->SetRate (dx, dy); ((DScroller *)collect.Obj)->SetRate (dx, dy);
@ -646,7 +647,7 @@ void SetWallScroller (int id, int sidechoice, double dx, double dy, EScrollPos W
{ {
if (level.lines[linenum].sidedef[sidechoice] != NULL) if (level.lines[linenum].sidedef[sidechoice] != NULL)
{ {
int sidenum = int(level.lines[linenum].sidedef[sidechoice] - sides); int sidenum = level.lines[linenum].sidedef[sidechoice]->Index();
unsigned int i; unsigned int i;
for (i = 0; i < numcollected; i++) for (i = 0; i < numcollected; i++)
{ {

View file

@ -35,6 +35,7 @@
#include "p_local.h" #include "p_local.h"
#include "r_sky.h" #include "r_sky.h"
#include "r_data/colormaps.h" #include "r_data/colormaps.h"
#include "g_levellocals.h"
// [RH] // [RH]
@ -1925,10 +1926,10 @@ void subsector_t::BuildPolyBSP()
assert((BSP == NULL || BSP->bDirty) && "BSP computed more than once"); assert((BSP == NULL || BSP->bDirty) && "BSP computed more than once");
// Set up level information for the node builder. // Set up level information for the node builder.
PolyNodeLevel.Sides = sides; PolyNodeLevel.Sides = &level.sides[0];
PolyNodeLevel.NumSides = numsides; PolyNodeLevel.NumSides = level.sides.Size();
PolyNodeLevel.Lines = &level.lines[0]; PolyNodeLevel.Lines = &level.lines[0];
PolyNodeLevel.NumLines = numlines; PolyNodeLevel.NumLines = numlines; // is this correct???
// Feed segs to the nodebuilder and build the nodes. // Feed segs to the nodebuilder and build the nodes.
PolyNodeBuilder.Clear(); PolyNodeBuilder.Clear();

View file

@ -74,6 +74,7 @@
#include "r_utility.h" #include "r_utility.h"
#include "p_spec.h" #include "p_spec.h"
#include "p_saveg.h" #include "p_saveg.h"
#include "g_levellocals.h"
#ifndef NO_EDATA #ifndef NO_EDATA
#include "edata.h" #include "edata.h"
#endif #endif
@ -136,9 +137,6 @@ subsector_t* subsectors;
int numnodes; int numnodes;
node_t* nodes; node_t* nodes;
int numsides;
side_t* sides;
TArray<zone_t> Zones; TArray<zone_t> Zones;
node_t * gamenodes; node_t * gamenodes;
@ -194,7 +192,7 @@ TArray<FPlayerStart> deathmatchstarts (16);
FPlayerStart playerstarts[MAXPLAYERS]; FPlayerStart playerstarts[MAXPLAYERS];
TArray<FPlayerStart> AllPlayerStarts; TArray<FPlayerStart> AllPlayerStarts;
static void P_AllocateSideDefs (int count); static void P_AllocateSideDefs (MapData *map, int count);
//=========================================================================== //===========================================================================
@ -1336,9 +1334,9 @@ void P_LoadSegs (MapData * map)
ldef = &level.lines[linedef]; ldef = &level.lines[linedef];
li->linedef = ldef; li->linedef = ldef;
side = LittleShort(ml->side); side = LittleShort(ml->side);
if ((unsigned)(ldef->sidedef[side] - sides) >= level.lines.Size()) if ((unsigned)(ldef->sidedef[side]->Index()) >= level.sides.Size())
{ {
throw badseg(2, i, int(ldef->sidedef[side] - sides)); throw badseg(2, i, ldef->sidedef[side]->Index());
} }
li->sidedef = ldef->sidedef[side]; li->sidedef = ldef->sidedef[side];
li->frontsector = ldef->sidedef[side]->sector; li->frontsector = ldef->sidedef[side]->sector;
@ -1368,7 +1366,7 @@ void P_LoadSegs (MapData * map)
break; break;
case 2: case 2:
Printf ("The linedef for seg %d references a nonexistant sidedef %d (max %d).\n", bad.badsegnum, bad.baddata, numsides); Printf ("The linedef for seg %d references a nonexistant sidedef %d (max %d).\n", bad.badsegnum, bad.baddata, level.sides.Size());
break; break;
} }
Printf ("The BSP will be rebuilt.\n"); Printf ("The BSP will be rebuilt.\n");
@ -1978,7 +1976,7 @@ void P_SaveLineSpecial (line_t *ld)
if (ld->sidedef[0] == NULL) if (ld->sidedef[0] == NULL)
return; return;
DWORD sidenum = DWORD(ld->sidedef[0]-sides); DWORD sidenum = ld->sidedef[0]->Index();
// killough 4/4/98: support special sidedef interpretation below // killough 4/4/98: support special sidedef interpretation below
// [RH] Save Static_Init only if it's interested in the textures // [RH] Save Static_Init only if it's interested in the textures
if (ld->special != Static_Init || ld->args[1] == Init_Color) if (ld->special != Static_Init || ld->args[1] == Init_Color)
@ -2069,7 +2067,7 @@ void P_FinishLoadingLineDefs ()
{ {
for (auto &line : level.lines) for (auto &line : level.lines)
{ {
P_FinishLoadingLineDef(&line, sidetemp[line.sidedef[0]-sides].a.alpha); P_FinishLoadingLineDef(&line, sidetemp[line.sidedef[0]->Index()].a.alpha);
} }
} }
@ -2079,10 +2077,10 @@ static void P_SetSideNum (side_t **sidenum_p, WORD sidenum)
{ {
*sidenum_p = NULL; *sidenum_p = NULL;
} }
else if (sidecount < numsides) else if (sidecount < (int)level.sides.Size())
{ {
sidetemp[sidecount].a.map = sidenum; sidetemp[sidecount].a.map = sidenum;
*sidenum_p = &sides[sidecount++]; *sidenum_p = &level.sides[sidecount++];
} }
else else
{ {
@ -2148,7 +2146,7 @@ void P_LoadLineDefs (MapData * map)
} }
} }
P_AllocateSideDefs (sidecount); P_AllocateSideDefs (map, sidecount);
mld = (maplinedef_t *)mldf; mld = (maplinedef_t *)mldf;
ld = &level.lines[0]; ld = &level.lines[0];
@ -2241,7 +2239,7 @@ void P_LoadLineDefs2 (MapData * map)
ForceNodeBuild = true; ForceNodeBuild = true;
} }
P_AllocateSideDefs (sidecount); P_AllocateSideDefs (map, sidecount);
mld = (maplinedef2_t *)mldf; mld = (maplinedef2_t *)mldf;
ld = &level.lines[0]; ld = &level.lines[0];
@ -2291,18 +2289,13 @@ void P_LoadLineDefs2 (MapData * map)
// //
// P_LoadSideDefs // P_LoadSideDefs
// //
// killough 4/4/98: split into two functions
void P_LoadSideDefs (MapData * map)
{
numsides = map->Size(ML_SIDEDEFS) / sizeof(mapsidedef_t);
}
static void P_AllocateSideDefs (int count) static void P_AllocateSideDefs (MapData *map, int count)
{ {
int i; int i;
sides = new side_t[count]; level.sides.Alloc(count);
memset (sides, 0, count*sizeof(side_t)); memset(&level.sides[0], 0, count * sizeof(side_t));
sidetemp = new sidei_t[MAX(count,numvertexes)]; sidetemp = new sidei_t[MAX(count,numvertexes)];
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
@ -2311,6 +2304,7 @@ static void P_AllocateSideDefs (int count)
sidetemp[i].a.alpha = SHRT_MIN; sidetemp[i].a.alpha = SHRT_MIN;
sidetemp[i].a.map = NO_SIDE; sidetemp[i].a.map = NO_SIDE;
} }
auto numsides = map->Size(ML_SIDEDEFS) / sizeof(mapsidedef_t);
if (count < numsides) if (count < numsides)
{ {
Printf ("Map has %d unused sidedefs\n", numsides - count); Printf ("Map has %d unused sidedefs\n", numsides - count);
@ -2331,6 +2325,7 @@ static void P_LoopSidedefs (bool firstloop)
{ {
delete[] sidetemp; delete[] sidetemp;
} }
int numsides = level.sides.Size();
sidetemp = new sidei_t[MAX(numvertexes, numsides)]; sidetemp = new sidei_t[MAX(numvertexes, numsides)];
for (i = 0; i < numvertexes; ++i) for (i = 0; i < numvertexes; ++i)
@ -2347,8 +2342,8 @@ static void P_LoopSidedefs (bool firstloop)
{ {
// For each vertex, build a list of sidedefs that use that vertex // For each vertex, build a list of sidedefs that use that vertex
// as their left edge. // as their left edge.
line_t *line = sides[i].linedef; line_t *line = level.sides[i].linedef;
int lineside = (line->sidedef[0] != &sides[i]); int lineside = (line->sidedef[0] != &level.sides[i]);
int vert = int((lineside ? line->v2 : line->v1) - vertexes); int vert = int((lineside ? line->v2 : line->v1) - vertexes);
sidetemp[i].b.lineside = lineside; sidetemp[i].b.lineside = lineside;
@ -2356,8 +2351,8 @@ static void P_LoopSidedefs (bool firstloop)
sidetemp[vert].b.first = i; sidetemp[vert].b.first = i;
// Set each side so that it is the only member of its loop // Set each side so that it is the only member of its loop
sides[i].LeftSide = NO_SIDE; level.sides[i].LeftSide = NO_SIDE;
sides[i].RightSide = NO_SIDE; level.sides[i].RightSide = NO_SIDE;
} }
// For each side, find the side that is to its right and set the // For each side, find the side that is to its right and set the
@ -2366,7 +2361,7 @@ static void P_LoopSidedefs (bool firstloop)
for (i = 0; i < numsides; ++i) for (i = 0; i < numsides; ++i)
{ {
DWORD right; DWORD right;
line_t *line = sides[i].linedef; line_t *line = level.sides[i].linedef;
// If the side's line only exists in a single sector, // If the side's line only exists in a single sector,
// then consider that line to be a self-contained loop // then consider that line to be a self-contained loop
@ -2382,7 +2377,7 @@ static void P_LoopSidedefs (bool firstloop)
continue; continue;
} }
right = DWORD(rightside - sides); right = rightside->Index();
} }
else else
{ {
@ -2411,7 +2406,7 @@ static void P_LoopSidedefs (bool firstloop)
line_t *leftline, *rightline; line_t *leftline, *rightline;
DAngle ang1, ang2, ang; DAngle ang1, ang2, ang;
leftline = sides[i].linedef; leftline = level.sides[i].linedef;
ang1 = leftline->Delta().Angle(); ang1 = leftline->Delta().Angle();
if (!sidetemp[i].b.lineside) if (!sidetemp[i].b.lineside)
{ {
@ -2420,9 +2415,9 @@ static void P_LoopSidedefs (bool firstloop)
while (right != NO_SIDE) while (right != NO_SIDE)
{ {
if (sides[right].LeftSide == NO_SIDE) if (level.sides[right].LeftSide == NO_SIDE)
{ {
rightline = sides[right].linedef; rightline = level.sides[right].linedef;
if (rightline->frontsector != rightline->backsector) if (rightline->frontsector != rightline->backsector)
{ {
ang2 = rightline->Delta().Angle(); ang2 = rightline->Delta().Angle();
@ -2447,8 +2442,8 @@ static void P_LoopSidedefs (bool firstloop)
} }
assert((unsigned)i<(unsigned)numsides); assert((unsigned)i<(unsigned)numsides);
assert(right<(unsigned)numsides); assert(right<(unsigned)numsides);
sides[i].RightSide = right; level.sides[i].RightSide = right;
sides[right].LeftSide = i; level.sides[right].LeftSide = i;
} }
// We keep the sidedef init info around until after polyobjects are initialized, // We keep the sidedef init info around until after polyobjects are initialized,
@ -2604,14 +2599,13 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, intmaps
void P_LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex) void P_LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex)
{ {
int i;
char * msdf = new char[map->Size(ML_SIDEDEFS)]; char * msdf = new char[map->Size(ML_SIDEDEFS)];
map->Read(ML_SIDEDEFS, msdf); map->Read(ML_SIDEDEFS, msdf);
for (i = 0; i < numsides; i++) for (unsigned i = 0; i < level.sides.Size(); i++)
{ {
mapsidedef_t *msd = ((mapsidedef_t*)msdf) + sidetemp[i].a.map; mapsidedef_t *msd = ((mapsidedef_t*)msdf) + sidetemp[i].a.map;
side_t *sd = sides + i; side_t *sd = &level.sides[i];
sector_t *sec; sector_t *sec;
// [RH] The Doom renderer ignored the patch y locations when // [RH] The Doom renderer ignored the patch y locations when
@ -2628,7 +2622,7 @@ void P_LoadSideDefs2 (MapData *map, FMissingTextureTracker &missingtex)
sd->SetTextureYScale(1.); sd->SetTextureYScale(1.);
sd->linedef = NULL; sd->linedef = NULL;
sd->Flags = 0; sd->Flags = 0;
sd->Index = i; sd->UDMFIndex = i;
// killough 4/4/98: allow sidedef texture names to be overloaded // killough 4/4/98: allow sidedef texture names to be overloaded
// killough 4/11/98: refined to allow colormaps to work as wall // killough 4/11/98: refined to allow colormaps to work as wall
@ -3390,11 +3384,11 @@ static void P_PrecacheLevel()
hitlist[level.sectors[i].GetTexture(sector_t::ceiling).GetIndex()] |= FTextureManager::HIT_Flat; hitlist[level.sectors[i].GetTexture(sector_t::ceiling).GetIndex()] |= FTextureManager::HIT_Flat;
} }
for (i = numsides - 1; i >= 0; i--) for (i = level.sides.Size() - 1; i >= 0; i--)
{ {
hitlist[sides[i].GetTexture(side_t::top).GetIndex()] |= FTextureManager::HIT_Wall; hitlist[level.sides[i].GetTexture(side_t::top).GetIndex()] |= FTextureManager::HIT_Wall;
hitlist[sides[i].GetTexture(side_t::mid).GetIndex()] |= FTextureManager::HIT_Wall; hitlist[level.sides[i].GetTexture(side_t::mid).GetIndex()] |= FTextureManager::HIT_Wall;
hitlist[sides[i].GetTexture(side_t::bottom).GetIndex()] |= FTextureManager::HIT_Wall; hitlist[level.sides[i].GetTexture(side_t::bottom).GetIndex()] |= FTextureManager::HIT_Wall;
} }
// Sky texture is always present. // Sky texture is always present.
@ -3464,6 +3458,7 @@ void P_FreeLevelData ()
} }
level.sectors.Clear(); level.sectors.Clear();
level.lines.Clear(); level.lines.Clear();
level.sides.Clear();
if (gamenodes != NULL && gamenodes != nodes) if (gamenodes != NULL && gamenodes != nodes)
{ {
@ -3492,12 +3487,6 @@ void P_FreeLevelData ()
numsubsectors = numgamesubsectors = 0; numsubsectors = numgamesubsectors = 0;
nodes = gamenodes = NULL; nodes = gamenodes = NULL;
numnodes = numgamenodes = 0; numnodes = numgamenodes = 0;
if (sides != NULL)
{
delete[] sides;
sides = NULL;
}
numsides = 0;
if (blockmaplump != NULL) if (blockmaplump != NULL)
{ {
@ -3754,7 +3743,6 @@ void P_SetupLevel (const char *lumpname, int position)
times[1].Unclock(); times[1].Unclock();
times[2].Clock(); times[2].Clock();
P_LoadSideDefs (map);
times[2].Unclock(); times[2].Unclock();
times[3].Clock(); times[3].Clock();
@ -3919,7 +3907,7 @@ void P_SetupLevel (const char *lumpname, int position)
FNodeBuilder::FLevel leveldata = FNodeBuilder::FLevel leveldata =
{ {
vertexes, numvertexes, vertexes, numvertexes,
sides, numsides, &level.sides[0], (int)level.sides.Size(),
&level.lines[0], (int)level.lines.Size(), &level.lines[0], (int)level.lines.Size(),
0, 0, 0, 0 0, 0, 0, 0
}; };

View file

@ -29,6 +29,7 @@
#include "r_state.h" #include "r_state.h"
#include "stats.h" #include "stats.h"
#include "g_levellocals.h"
static FRandom pr_botchecksight ("BotCheckSight"); static FRandom pr_botchecksight ("BotCheckSight");
static FRandom pr_checksight ("CheckSight"); static FRandom pr_checksight ("CheckSight");

View file

@ -38,6 +38,7 @@
#include "p_lnspec.h" #include "p_lnspec.h"
#include "p_maputl.h" #include "p_maputl.h"
#include "p_spec.h" #include "p_spec.h"
#include "g_levellocals.h"
//=========================================================================== //===========================================================================
// //

View file

@ -70,6 +70,7 @@
#include "d_player.h" #include "d_player.h"
#include "p_maputl.h" #include "p_maputl.h"
#include "p_blockmap.h" #include "p_blockmap.h"
#include "g_levellocals.h"
#ifndef NO_EDATA #ifndef NO_EDATA
#include "edata.h" #include "edata.h"
#endif #endif

View file

@ -36,6 +36,7 @@
#include "p_tags.h" #include "p_tags.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "g_levellocals.h"
FTagManager tagManager; FTagManager tagManager;
@ -45,17 +46,6 @@ FTagManager tagManager;
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static inline int lineindex(const line_t *line)
{
return level.lines.Size();
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
void FTagManager::AddSectorTag(int sector, int tag) void FTagManager::AddSectorTag(int sector, int tag)
{ {
if (tag == 0) return; if (tag == 0) return;
@ -244,7 +234,7 @@ bool FTagManager::SectorHasTag(const sector_t *sector, int tag) const
int FTagManager::GetFirstLineID(const line_t *line) const int FTagManager::GetFirstLineID(const line_t *line) const
{ {
int i = lineindex(line); int i = line->Index();
return LineHasIDs(i) ? allIDs[startForLine[i]].tag : 0; return LineHasIDs(i) ? allIDs[startForLine[i]].tag : 0;
} }
@ -276,7 +266,7 @@ bool FTagManager::LineHasID(int i, int tag) const
bool FTagManager::LineHasID(const line_t *line, int tag) const bool FTagManager::LineHasID(const line_t *line, int tag) const
{ {
return LineHasID(lineindex(line), tag); return LineHasID(line->Index(), tag);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -38,6 +38,7 @@
#include "p_maputl.h" #include "p_maputl.h"
#include "r_utility.h" #include "r_utility.h"
#include "p_spec.h" #include "p_spec.h"
#include "g_levellocals.h"
#define FUDGEFACTOR 10 #define FUDGEFACTOR 10

View file

@ -51,6 +51,7 @@
#include "p_spec.h" #include "p_spec.h"
#include "math/cmath.h" #include "math/cmath.h"
#include "actorptrselect.h" #include "actorptrselect.h"
#include "g_levellocals.h"
// Set of spawnable things for the Thing_Spawn and Thing_Projectile specials. // Set of spawnable things for the Thing_Spawn and Thing_Projectile specials.
FClassMap SpawnableThings; FClassMap SpawnableThings;

View file

@ -35,6 +35,7 @@
#include "g_level.h" #include "g_level.h"
#include "r_utility.h" #include "r_utility.h"
#include "p_spec.h" #include "p_spec.h"
#include "g_levellocals.h"
extern gamestate_t wipegamestate; extern gamestate_t wipegamestate;

View file

@ -40,6 +40,7 @@
#include "p_maputl.h" #include "p_maputl.h"
#include "r_defs.h" #include "r_defs.h"
#include "p_spec.h" #include "p_spec.h"
#include "g_levellocals.h"
//========================================================================== //==========================================================================
// //

View file

@ -48,6 +48,7 @@
#include "w_wad.h" #include "w_wad.h"
#include "p_tags.h" #include "p_tags.h"
#include "p_terrain.h" #include "p_terrain.h"
#include "g_levellocals.h"
//=========================================================================== //===========================================================================
// //
@ -1136,7 +1137,7 @@ public:
sdt->midtexture = "-"; sdt->midtexture = "-";
sd->SetTextureXScale(1.); sd->SetTextureXScale(1.);
sd->SetTextureYScale(1.); sd->SetTextureYScale(1.);
sd->Index = index; sd->UDMFIndex = index;
sc.MustGetToken('{'); sc.MustGetToken('{');
while (!sc.CheckToken('}')) while (!sc.CheckToken('}'))
@ -1815,11 +1816,11 @@ public:
} }
} }
unsigned numlines = ParsedLines.Size(); unsigned numlines = ParsedLines.Size();
numsides = sidecount; level.sides.Alloc(sidecount);
level.lines.Alloc(numlines); level.lines.Alloc(numlines);
sides = new side_t[numsides];
int line, side; int line, side;
auto lines = &level.lines[0]; auto lines = &level.lines[0];
auto sides = &level.sides[0];
for(line = 0, side = 0; line < (int)numlines; line++) for(line = 0, side = 0; line < (int)numlines; line++)
{ {
@ -1854,11 +1855,10 @@ public:
P_AdjustLine(&lines[line]); P_AdjustLine(&lines[line]);
P_FinishLoadingLineDef(&lines[line], tempalpha[0]); P_FinishLoadingLineDef(&lines[line], tempalpha[0]);
} }
assert(side <= numsides); assert((unsigned)side <= level.sides.Size());
if (side < numsides) if ((unsigned)side > level.sides.Size())
{ {
Printf("Map had %d invalid side references\n", numsides - side); Printf("Map had %d invalid side references\n", (int)level.sides.Size() - side);
numsides = side;
} }
} }

View file

@ -61,6 +61,7 @@
#include "virtual.h" #include "virtual.h"
#include "a_armor.h" #include "a_armor.h"
#include "a_ammo.h" #include "a_ammo.h"
#include "g_levellocals.h"
static FRandom pr_skullpop ("SkullPop"); static FRandom pr_skullpop ("SkullPop");

View file

@ -44,6 +44,7 @@
#include "w_wad.h" #include "w_wad.h"
#include "sc_man.h" #include "sc_man.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "g_levellocals.h"
#include "xlat/xlat.h" #include "xlat/xlat.h"
// define names for the TriggerType field of the general linedefs // define names for the TriggerType field of the general linedefs

View file

@ -32,6 +32,7 @@
#include "p_maputl.h" #include "p_maputl.h"
#include "r_utility.h" #include "r_utility.h"
#include "p_blockmap.h" #include "p_blockmap.h"
#include "g_levellocals.h"
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -1429,11 +1430,11 @@ static void InitBlockMap (void)
static void InitSideLists () static void InitSideLists ()
{ {
for (int i = 0; i < numsides; ++i) for (unsigned i = 0; i < level.sides.Size(); ++i)
{ {
if (sides[i].linedef != NULL && if (level.sides[i].linedef != NULL &&
(sides[i].linedef->special == Polyobj_StartLine || (level.sides[i].linedef->special == Polyobj_StartLine ||
sides[i].linedef->special == Polyobj_ExplicitLine)) level.sides[i].linedef->special == Polyobj_ExplicitLine))
{ {
KnownPolySides.Push (i); KnownPolySides.Push (i);
} }
@ -1499,8 +1500,8 @@ static void IterFindPolySides (FPolyObj *po, side_t *side)
DWORD sidenum = sidetemp[vnum[vnumat++]].b.first; DWORD sidenum = sidetemp[vnum[vnumat++]].b.first;
while (sidenum != NO_SIDE) while (sidenum != NO_SIDE)
{ {
po->Sidedefs.Push(&sides[sidenum]); po->Sidedefs.Push(&level.sides[sidenum]);
AddPolyVert(vnum, DWORD(sides[sidenum].V2() - vertexes)); AddPolyVert(vnum, DWORD(level.sides[sidenum].V2() - vertexes));
sidenum = sidetemp[sidenum].b.next; sidenum = sidetemp[sidenum].b.next;
} }
} }
@ -1534,7 +1535,7 @@ static void SpawnPolyobj (int index, int tag, int type)
po->bBlocked = false; po->bBlocked = false;
po->bHasPortals = 0; po->bHasPortals = 0;
side_t *sd = &sides[i]; side_t *sd = &level.sides[i];
if (sd->linedef->special == Polyobj_StartLine && if (sd->linedef->special == Polyobj_StartLine &&
sd->linedef->args[0] == tag) sd->linedef->args[0] == tag)
@ -1570,14 +1571,14 @@ static void SpawnPolyobj (int index, int tag, int type)
i = KnownPolySides[ii]; i = KnownPolySides[ii];
if (i >= 0 && if (i >= 0 &&
sides[i].linedef->special == Polyobj_ExplicitLine && level.sides[i].linedef->special == Polyobj_ExplicitLine &&
sides[i].linedef->args[0] == tag) level.sides[i].linedef->args[0] == tag)
{ {
if (!sides[i].linedef->args[1]) if (!level.sides[i].linedef->args[1])
{ {
I_Error("SpawnPolyobj: Explicit line missing order number in poly %d, linedef %d.\n", tag, sides[i].linedef->Index()); I_Error("SpawnPolyobj: Explicit line missing order number in poly %d, linedef %d.\n", tag, level.sides[i].linedef->Index());
} }
po->Sidedefs.Push (&sides[i]); po->Sidedefs.Push (&level.sides[i]);
} }
} }
qsort(&po->Sidedefs[0], po->Sidedefs.Size(), sizeof(po->Sidedefs[0]), posicmp); qsort(&po->Sidedefs[0], po->Sidedefs.Size(), sizeof(po->Sidedefs[0]), posicmp);

View file

@ -51,6 +51,7 @@
#include "p_spec.h" #include "p_spec.h"
#include "p_checkposition.h" #include "p_checkposition.h"
#include "math/cmath.h" #include "math/cmath.h"
#include "g_levellocals.h"
// simulation recurions maximum // simulation recurions maximum
CVAR(Int, sv_portal_recursions, 4, CVAR_ARCHIVE|CVAR_SERVERINFO) CVAR(Int, sv_portal_recursions, 4, CVAR_ARCHIVE|CVAR_SERVERINFO)

View file

@ -51,6 +51,7 @@
#include "r_sky.h" #include "r_sky.h"
#include "po_man.h" #include "po_man.h"
#include "r_data/colormaps.h" #include "r_data/colormaps.h"
#include "g_levellocals.h"
CVAR (Bool, r_drawflat, false, 0) // [RH] Don't texture segs? CVAR (Bool, r_drawflat, false, 0) // [RH] Don't texture segs?
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor);

Some files were not shown because too many files have changed in this diff Show more