- changed automap initialization so that static data only gets initialized once upon startup instead of each time a level starts.

- initialize AUTOPAGE only once when the level starts, not each time the automap is switched on.


SVN r3031 (trunk)
This commit is contained in:
Christoph Oelckers 2010-12-12 17:54:10 +00:00
parent 0715b7dfc6
commit 572bc4620a
4 changed files with 36 additions and 39 deletions

View file

@ -64,6 +64,12 @@
#include "po_man.h"
#include "a_keys.h"
//=============================================================================
//
// Automap colors
//
//=============================================================================
struct AMColor
{
int Index;
@ -119,6 +125,12 @@ static BYTE RavenPaletteVals[11*3] =
0, 0, 0, 0, 0, 0,
};
//=============================================================================
//
// globals
//
//=============================================================================
#define MAPBITS 12
#define MapDiv SafeDivScale12
#define MapMul MulScale12
@ -287,28 +299,28 @@ struct islope_t
// A line drawing of the player pointing right,
// starting from the middle.
//
TArray<mline_t> MapArrow;
TArray<mline_t> CheatMapArrow;
TArray<mline_t> CheatKey;
static TArray<mline_t> MapArrow;
static TArray<mline_t> CheatMapArrow;
static TArray<mline_t> CheatKey;
#define R (MAPUNIT)
// [RH] Avoid lots of warnings without compiler-specific #pragmas
#define L(a,b,c,d) { {(fixed_t)((a)*R),(fixed_t)((b)*R)}, {(fixed_t)((c)*R),(fixed_t)((d)*R)} }
mline_t triangle_guy[] = {
static mline_t triangle_guy[] = {
L (-.867,-.5, .867,-.5),
L (.867,-.5, 0,1),
L (0,1, -.867,-.5)
};
#define NUMTRIANGLEGUYLINES (sizeof(triangle_guy)/sizeof(mline_t))
mline_t thintriangle_guy[] = {
static mline_t thintriangle_guy[] = {
L (-.5,-.7, 1,0),
L (1,0, -.5,.7),
L (-.5,.7, -.5,-.7)
};
#define NUMTHINTRIANGLEGUYLINES (sizeof(thintriangle_guy)/sizeof(mline_t))
mline_t square_guy[] = {
static mline_t square_guy[] = {
L (0,1,1,0),
L (1,0,0,-1),
L (0,-1,-1,0),
@ -332,8 +344,6 @@ CUSTOM_CVAR (Int, am_cheat, 0, 0)
static int grid = 0;
static int leveljuststarted = 1; // kluge until AM_LevelInit() is called
bool automapactive = false;
// location of window on screen
@ -515,16 +525,26 @@ void AM_ParseArrow(TArray<mline_t> &Arrow, const char *lumpname)
}
}
void AM_InitArrows()
void AM_StaticInit()
{
MapArrow.Clear();
CheatMapArrow.Clear();
CheatKey.Clear();
if (gameinfo.mMapArrow.IsNotEmpty()) AM_ParseArrow(MapArrow, gameinfo.mMapArrow);
if (gameinfo.mCheatMapArrow.IsNotEmpty()) AM_ParseArrow(CheatMapArrow, gameinfo.mCheatMapArrow);
AM_ParseArrow(CheatKey, "maparrows/key.txt");
if (MapArrow.Size() == 0) I_FatalError("No automap arrow defined");
char namebuf[9];
for (int i = 0; i < 10; i++)
{
mysnprintf (namebuf, countof(namebuf), "AMMNUM%d", i);
marknums[i] = TexMan.CheckForTexture (namebuf, FTexture::TEX_MiscPatch);
}
markpointnum = 0;
mapback.SetInvalid();
}
//=============================================================================
@ -1004,28 +1024,6 @@ static void AM_initColors (bool overlayed)
lastpal = palette;
}
//=============================================================================
//
//
//
//=============================================================================
void AM_loadPics ()
{
int i;
char namebuf[9];
for (i = 0; i < 10; i++)
{
mysnprintf (namebuf, countof(namebuf), "AMMNUM%d", i);
marknums[i] = TexMan.CheckForTexture (namebuf, FTexture::TEX_MiscPatch);
}
const char *autopage = level.info->mapbg[0] == 0? "AUTOPAGE" : (const char*)&level.info->mapbg[0];
mapback = TexMan.CheckForTexture(autopage, FTexture::TEX_MiscPatch);
}
//=============================================================================
//
//
@ -1048,9 +1046,8 @@ bool AM_clearMarks ()
void AM_LevelInit ()
{
if (MapArrow.Size() == 0) AM_InitArrows();
leveljuststarted = 0;
const char *autopage = level.info->mapbg[0] == 0? "AUTOPAGE" : (const char*)&level.info->mapbg[0];
mapback = TexMan.CheckForTexture(autopage, FTexture::TEX_MiscPatch);
AM_clearMarks();
@ -1088,7 +1085,6 @@ void AM_Start ()
if (!stopped) AM_Stop();
stopped = false;
AM_initVariables();
AM_loadPics();
}

View file

@ -25,6 +25,9 @@
struct event_t;
class FArchive;
void AM_StaticInit();
// Called by main loop.
bool AM_Responder (event_t* ev, bool last);

View file

@ -2226,6 +2226,7 @@ void D_DoomMain (void)
Printf ("P_Init: Init Playloop state.\n");
StartScreen->LoadingStatus ("Init game engine", 0x3f);
AM_StaticInit();
P_Init ();
P_SetupWeapons_ntohton();

View file

@ -48,9 +48,6 @@
#include "cmdlib.h"
#include "g_level.h"
extern void R_InitBuildTiles();
FTextureManager TexMan;
//==========================================================================