- 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
void SetTranslation(FName trname);
double GetBobOffset(double ticfrac = 0) const
{
if (!(flags2 & MF2_FLOATBOB))
{
return 0;
}
return BobSin(FloatBobPhase + level.maptime + ticfrac);
}
double GetBobOffset(double ticfrac = 0) const;
// Enter the crash state
void Crash();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -77,6 +77,7 @@
#include "r_utility.h"
#include "menu/menu.h"
#include "intermission/intermission.h"
#include "g_levellocals.h"
// MACROS ------------------------------------------------------------------
@ -709,15 +710,15 @@ size_t DSectorMarker::PropagateMark()
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);
}
marked += i * sizeof(side_t);
if (SideNum + i < numsides)
if (SideNum + i < (int)level.sides.Size())
{
SideNum += i;
moretodo = true;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -88,6 +88,7 @@
#include "gi.h"
#include "g_hub.h"
#include "g_levellocals.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
{
@ -477,8 +405,6 @@ struct cluster_info_t
#define CLUSTER_LOOKUPCLUSTERNAME 0x00000080 // Cluster name is the name of a language string
#define CLUSTER_ALLOWINTERMISSION 0x00000100 // Allow intermissions between levels in a hub.
extern FLevelLocals level;
extern TArray<level_info_t> wadlevelinfos;
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 "version.h"
#include "v_text.h"
#include "g_levellocals.h"
TArray<cluster_info_t> wadclusterinfos;
TArray<level_info_t> wadlevelinfos;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -38,6 +38,7 @@
#include "p_local.h"
#include "g_level.h"
#include "r_sky.h"
#include "g_levellocals.h"
// externally settable lighting properties
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_state.h"
#include "doomstat.h"
#include "g_levellocals.h"
#include "gl/system/gl_cvars.h"
#include "gl/data/gl_data.h"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -49,6 +49,7 @@
#include "a_morph.h"
#include "a_armor.h"
#include "a_ammo.h"
#include "g_levellocals.h"
// [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

View File

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

View File

@ -186,7 +186,7 @@ int FNodeBuilder::CreateSeg (int linenum, int sidenum)
}
seg.linedef = linenum;
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.nextforvert2 = Vertices[seg.v2].segs2;

View File

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

View File

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

View File

@ -86,6 +86,7 @@
#include "a_armor.h"
#include "a_ammo.h"
#include "r_data/colormaps.h"
#include "g_levellocals.h"
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);
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++)
{
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->sidedef[side] == NULL) return -1;
return activationline->sidedef[side]->Index;
return activationline->sidedef[side]->UDMFIndex;
}
else
{
int line = P_FindFirstLineFromID(id);
if (line == -1) 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 "a_armor.h"
#include "a_health.h"
#include "g_levellocals.h"
AActor *SingleActorFromTID(int tid, AActor *defactor);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -67,6 +67,7 @@
#include "m_misc.h"
#include "r_utility.h"
#include "cmdlib.h"
#include "g_levellocals.h"
void P_GetPolySpots (MapData * lump, TArray<FNodeBuilder::FPolyStart> &spots, TArray<FNodeBuilder::FPolyStart> &anchors);
@ -129,6 +130,7 @@ struct gl5_mapnode_t
static int CheckForMissingSegs()
{
auto numsides = level.sides.Size();
double *added_seglen = new double[numsides];
int missing = 0;
@ -141,13 +143,13 @@ static int CheckForMissingSegs()
{
// 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());
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.);
}
@ -1001,7 +1003,7 @@ bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime)
FNodeBuilder::FLevel leveldata =
{
vertexes, numvertexes,
sides, numsides,
&level.sides[0], (int)level.sides.Size(),
&level.lines[0], (int)level.lines.Size(),
0, 0, 0, 0
};

View File

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

View File

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

View File

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

View File

@ -61,6 +61,7 @@
#include "r_data/colormaps.h"
#include "fragglescript/t_fs.h"
#include "p_spec.h"
#include "g_levellocals.h"
// 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 "g_level.h"
#include "r_sky.h"
#include "g_levellocals.h"
CVAR(Bool, cl_bloodsplats, true, CVAR_ARCHIVE)
CVAR(Int, sv_smartaim, 0, CVAR_ARCHIVE | CVAR_SERVERINFO)

View File

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

View File

@ -72,6 +72,7 @@
#include "a_armor.h"
#include "a_ammo.h"
#include "a_health.h"
#include "g_levellocals.h"
// MACROS ------------------------------------------------------------------
@ -7539,6 +7540,22 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
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));
}
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
DEFINE_ACTION_FUNCTION(AActor, VelFromAngle)
{

View File

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

View File

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

View File

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

View File

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

View File

@ -62,10 +62,11 @@
#include "r_sky.h"
#include "r_renderer.h"
#include "serializer.h"
#include "g_levellocals.h"
static TStaticArray<sector_t> loadsectors;
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 };
arc.Array("checksum", chk, 16);
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("polyobjs") != (unsigned)po_NumPolyobjs ||
memcmp(chk, level.md5, 16))
@ -957,7 +958,7 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
FBehavior::StaticSerializeModuleStates(arc);
// 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("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("zones", Zones);
arc("lineportals", linePortals);
@ -998,8 +999,7 @@ void P_BackupMapData()
{
loadsectors = level.sectors;
loadlines = level.lines;
loadsides.Resize(numsides);
memcpy(&loadsides[0], sides, numsides * sizeof(side_t));
loadsides = level.sides;
}
void P_FreeMapDataBackup()

View File

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

View File

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

View File

@ -74,6 +74,7 @@
#include "r_utility.h"
#include "p_spec.h"
#include "p_saveg.h"
#include "g_levellocals.h"
#ifndef NO_EDATA
#include "edata.h"
#endif
@ -136,9 +137,6 @@ subsector_t* subsectors;
int numnodes;
node_t* nodes;
int numsides;
side_t* sides;
TArray<zone_t> Zones;
node_t * gamenodes;
@ -194,7 +192,7 @@ TArray<FPlayerStart> deathmatchstarts (16);
FPlayerStart playerstarts[MAXPLAYERS];
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];
li->linedef = ldef;
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->frontsector = ldef->sidedef[side]->sector;
@ -1368,7 +1366,7 @@ void P_LoadSegs (MapData * map)
break;
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;
}
Printf ("The BSP will be rebuilt.\n");
@ -1978,7 +1976,7 @@ void P_SaveLineSpecial (line_t *ld)
if (ld->sidedef[0] == NULL)
return;
DWORD sidenum = DWORD(ld->sidedef[0]-sides);
DWORD sidenum = ld->sidedef[0]->Index();
// killough 4/4/98: support special sidedef interpretation below
// [RH] Save Static_Init only if it's interested in the textures
if (ld->special != Static_Init || ld->args[1] == Init_Color)
@ -2069,7 +2067,7 @@ void P_FinishLoadingLineDefs ()
{
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;
}
else if (sidecount < numsides)
else if (sidecount < (int)level.sides.Size())
{
sidetemp[sidecount].a.map = sidenum;
*sidenum_p = &sides[sidecount++];
*sidenum_p = &level.sides[sidecount++];
}
else
{
@ -2148,7 +2146,7 @@ void P_LoadLineDefs (MapData * map)
}
}
P_AllocateSideDefs (sidecount);
P_AllocateSideDefs (map, sidecount);
mld = (maplinedef_t *)mldf;
ld = &level.lines[0];
@ -2241,7 +2239,7 @@ void P_LoadLineDefs2 (MapData * map)
ForceNodeBuild = true;
}
P_AllocateSideDefs (sidecount);
P_AllocateSideDefs (map, sidecount);
mld = (maplinedef2_t *)mldf;
ld = &level.lines[0];
@ -2291,18 +2289,13 @@ void P_LoadLineDefs2 (MapData * map)
//
// 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;
sides = new side_t[count];
memset (sides, 0, count*sizeof(side_t));
level.sides.Alloc(count);
memset(&level.sides[0], 0, count * sizeof(side_t));
sidetemp = new sidei_t[MAX(count,numvertexes)];
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.map = NO_SIDE;
}
auto numsides = map->Size(ML_SIDEDEFS) / sizeof(mapsidedef_t);
if (count < numsides)
{
Printf ("Map has %d unused sidedefs\n", numsides - count);
@ -2331,6 +2325,7 @@ static void P_LoopSidedefs (bool firstloop)
{
delete[] sidetemp;
}
int numsides = level.sides.Size();
sidetemp = new sidei_t[MAX(numvertexes, numsides)];
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
// as their left edge.
line_t *line = sides[i].linedef;
int lineside = (line->sidedef[0] != &sides[i]);
line_t *line = level.sides[i].linedef;
int lineside = (line->sidedef[0] != &level.sides[i]);
int vert = int((lineside ? line->v2 : line->v1) - vertexes);
sidetemp[i].b.lineside = lineside;
@ -2356,8 +2351,8 @@ static void P_LoopSidedefs (bool firstloop)
sidetemp[vert].b.first = i;
// Set each side so that it is the only member of its loop
sides[i].LeftSide = NO_SIDE;
sides[i].RightSide = NO_SIDE;
level.sides[i].LeftSide = NO_SIDE;
level.sides[i].RightSide = NO_SIDE;
}
// 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)
{
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,
// then consider that line to be a self-contained loop
@ -2382,7 +2377,7 @@ static void P_LoopSidedefs (bool firstloop)
continue;
}
right = DWORD(rightside - sides);
right = rightside->Index();
}
else
{
@ -2411,7 +2406,7 @@ static void P_LoopSidedefs (bool firstloop)
line_t *leftline, *rightline;
DAngle ang1, ang2, ang;
leftline = sides[i].linedef;
leftline = level.sides[i].linedef;
ang1 = leftline->Delta().Angle();
if (!sidetemp[i].b.lineside)
{
@ -2420,9 +2415,9 @@ static void P_LoopSidedefs (bool firstloop)
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)
{
ang2 = rightline->Delta().Angle();
@ -2447,8 +2442,8 @@ static void P_LoopSidedefs (bool firstloop)
}
assert((unsigned)i<(unsigned)numsides);
assert(right<(unsigned)numsides);
sides[i].RightSide = right;
sides[right].LeftSide = i;
level.sides[i].RightSide = right;
level.sides[right].LeftSide = i;
}
// 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)
{
int i;
char * msdf = new char[map->Size(ML_SIDEDEFS)];
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;
side_t *sd = sides + i;
side_t *sd = &level.sides[i];
sector_t *sec;
// [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->linedef = NULL;
sd->Flags = 0;
sd->Index = i;
sd->UDMFIndex = i;
// killough 4/4/98: allow sidedef texture names to be overloaded
// 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;
}
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[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::top).GetIndex()] |= FTextureManager::HIT_Wall;
hitlist[level.sides[i].GetTexture(side_t::mid).GetIndex()] |= FTextureManager::HIT_Wall;
hitlist[level.sides[i].GetTexture(side_t::bottom).GetIndex()] |= FTextureManager::HIT_Wall;
}
// Sky texture is always present.
@ -3464,6 +3458,7 @@ void P_FreeLevelData ()
}
level.sectors.Clear();
level.lines.Clear();
level.sides.Clear();
if (gamenodes != NULL && gamenodes != nodes)
{
@ -3492,12 +3487,6 @@ void P_FreeLevelData ()
numsubsectors = numgamesubsectors = 0;
nodes = gamenodes = NULL;
numnodes = numgamenodes = 0;
if (sides != NULL)
{
delete[] sides;
sides = NULL;
}
numsides = 0;
if (blockmaplump != NULL)
{
@ -3754,7 +3743,6 @@ void P_SetupLevel (const char *lumpname, int position)
times[1].Unclock();
times[2].Clock();
P_LoadSideDefs (map);
times[2].Unclock();
times[3].Clock();
@ -3919,7 +3907,7 @@ void P_SetupLevel (const char *lumpname, int position)
FNodeBuilder::FLevel leveldata =
{
vertexes, numvertexes,
sides, numsides,
&level.sides[0], (int)level.sides.Size(),
&level.lines[0], (int)level.lines.Size(),
0, 0, 0, 0
};

View File

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

View File

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

View File

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

View File

@ -36,6 +36,7 @@
#include "p_tags.h"
#include "c_dispatch.h"
#include "g_levellocals.h"
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)
{
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 i = lineindex(line);
int i = line->Index();
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
{
return LineHasID(lineindex(line), tag);
return LineHasID(line->Index(), tag);
}
//-----------------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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