2006-02-24 04:48:15 +00:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id:$
|
|
|
|
//
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
//
|
|
|
|
// This source is available for distribution and/or modification
|
|
|
|
// only under the terms of the DOOM Source Code License as
|
|
|
|
// published by id Software. All rights reserved.
|
|
|
|
//
|
|
|
|
// The source is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
// Setup a game, startup stuff.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __P_SETUP__
|
|
|
|
#define __P_SETUP__
|
|
|
|
|
2012-10-22 01:28:11 +00:00
|
|
|
#include "resourcefiles/resourcefile.h"
|
2006-06-14 15:56:56 +00:00
|
|
|
#include "doomdata.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
|
2006-06-14 15:56:56 +00:00
|
|
|
struct MapData
|
|
|
|
{
|
2012-11-01 18:23:39 +00:00
|
|
|
struct MapLump
|
2012-10-22 01:28:11 +00:00
|
|
|
{
|
|
|
|
char Name[8];
|
|
|
|
FileReader *Reader;
|
|
|
|
} MapLumps[ML_MAX];
|
2006-06-14 15:56:56 +00:00
|
|
|
bool HasBehavior;
|
2006-06-15 03:31:19 +00:00
|
|
|
bool Encrypted;
|
2008-05-11 21:16:32 +00:00
|
|
|
bool isText;
|
2013-02-14 05:06:05 +00:00
|
|
|
bool InWad;
|
2006-06-14 15:56:56 +00:00
|
|
|
int lumpnum;
|
|
|
|
FileReader * file;
|
2012-10-22 01:28:11 +00:00
|
|
|
FResourceFile * resource;
|
2006-06-14 15:56:56 +00:00
|
|
|
|
|
|
|
MapData()
|
|
|
|
{
|
|
|
|
memset(MapLumps, 0, sizeof(MapLumps));
|
|
|
|
file = NULL;
|
2012-10-22 01:28:11 +00:00
|
|
|
resource = NULL;
|
2006-06-15 03:31:19 +00:00
|
|
|
lumpnum = -1;
|
|
|
|
HasBehavior = false;
|
|
|
|
Encrypted = false;
|
2008-05-11 21:16:32 +00:00
|
|
|
isText = false;
|
2013-02-14 05:06:05 +00:00
|
|
|
InWad = false;
|
2006-06-14 15:56:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
~MapData()
|
|
|
|
{
|
2012-10-22 01:28:11 +00:00
|
|
|
for (unsigned int i = 0;i < ML_MAX;++i)
|
|
|
|
delete MapLumps[i].Reader;
|
|
|
|
|
|
|
|
delete resource;
|
|
|
|
resource = NULL;
|
2006-06-14 15:56:56 +00:00
|
|
|
}
|
|
|
|
|
2006-06-14 20:24:43 +00:00
|
|
|
void Seek(unsigned int lumpindex)
|
2006-06-14 15:56:56 +00:00
|
|
|
{
|
2006-06-14 20:24:43 +00:00
|
|
|
if (lumpindex<countof(MapLumps))
|
2006-06-14 15:56:56 +00:00
|
|
|
{
|
2012-10-22 01:28:11 +00:00
|
|
|
file = MapLumps[lumpindex].Reader;
|
|
|
|
file->Seek(0, SEEK_SET);
|
2006-06-14 15:56:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-15 17:16:32 +00:00
|
|
|
void Read(unsigned int lumpindex, void * buffer, int size = -1)
|
2006-06-14 15:56:56 +00:00
|
|
|
{
|
2006-06-14 20:24:43 +00:00
|
|
|
if (lumpindex<countof(MapLumps))
|
2006-06-14 15:56:56 +00:00
|
|
|
{
|
2012-10-22 01:28:11 +00:00
|
|
|
if (size == -1) size = MapLumps[lumpindex].Reader->GetLength();
|
|
|
|
Seek(lumpindex);
|
2008-05-15 17:16:32 +00:00
|
|
|
file->Read(buffer, size);
|
2006-06-14 15:56:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-14 20:24:43 +00:00
|
|
|
DWORD Size(unsigned int lumpindex)
|
2006-06-14 15:56:56 +00:00
|
|
|
{
|
2012-10-22 01:28:11 +00:00
|
|
|
if (lumpindex<countof(MapLumps) && MapLumps[lumpindex].Reader)
|
2006-06-14 15:56:56 +00:00
|
|
|
{
|
2012-10-22 01:28:11 +00:00
|
|
|
return MapLumps[lumpindex].Reader->GetLength();
|
2006-06-14 15:56:56 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2009-02-05 02:55:28 +00:00
|
|
|
|
|
|
|
void GetChecksum(BYTE cksum[16]);
|
2006-06-14 15:56:56 +00:00
|
|
|
};
|
|
|
|
|
2013-08-31 03:38:57 +00:00
|
|
|
MapData * P_OpenMapData(const char * mapname, bool justcheck);
|
2008-04-05 12:14:33 +00:00
|
|
|
bool P_CheckMapData(const char * mapname);
|
2006-06-14 15:56:56 +00:00
|
|
|
|
2008-05-02 16:59:38 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// NOT called by W_Ticker. Fixme. [RH] Is that bad?
|
|
|
|
//
|
|
|
|
// [RH] The only parameter used is mapname, so I removed playermask and skill.
|
|
|
|
// On September 1, 1998, I added the position to indicate which set
|
|
|
|
// of single-player start spots should be spawned in the level.
|
2014-05-13 21:16:13 +00:00
|
|
|
void P_SetupLevel (const char *mapname, int position);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-05-11 04:00:58 +00:00
|
|
|
void P_FreeLevelData();
|
2006-05-12 03:14:40 +00:00
|
|
|
void P_FreeExtraLevelData();
|
2006-05-11 04:00:58 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Called by startup code.
|
|
|
|
void P_Init (void);
|
|
|
|
|
2008-05-12 17:14:38 +00:00
|
|
|
struct line_t;
|
|
|
|
struct maplinedef_t;
|
|
|
|
|
|
|
|
void P_LoadTranslator(const char *lumpname);
|
2015-04-19 15:51:34 +00:00
|
|
|
void P_TranslateLineDef (line_t *ld, maplinedef_t *mld, int lineindexforid = -1);
|
2008-05-12 17:14:38 +00:00
|
|
|
int P_TranslateSectorSpecial (int);
|
|
|
|
|
2009-05-11 21:05:40 +00:00
|
|
|
int GetUDMFInt(int type, int index, const char *key);
|
|
|
|
fixed_t GetUDMFFixed(int type, int index, const char *key);
|
|
|
|
|
2010-08-27 15:20:05 +00:00
|
|
|
bool P_LoadGLNodes(MapData * map);
|
|
|
|
bool P_CheckNodes(MapData * map, bool rebuilt, int buildtime);
|
|
|
|
bool P_CheckForGLNodes();
|
|
|
|
void P_SetRenderSector();
|
|
|
|
|
|
|
|
|
2010-08-01 05:16:09 +00:00
|
|
|
struct sidei_t // [RH] Only keep BOOM sidedef init stuff around for init
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
|
|
|
// Used when unpacking sidedefs and assigning
|
|
|
|
// properties based on linedefs.
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
short tag, special;
|
|
|
|
short alpha;
|
|
|
|
DWORD map;
|
|
|
|
} a;
|
|
|
|
|
|
|
|
// Used when grouping sidedefs into loops.
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
DWORD first, next;
|
|
|
|
char lineside;
|
|
|
|
} b;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
extern sidei_t *sidetemp;
|
2010-08-27 15:20:05 +00:00
|
|
|
extern bool hasglnodes;
|
|
|
|
extern struct glsegextra_t *glsegextras;
|
2010-08-01 05:16:09 +00:00
|
|
|
|
2011-05-08 00:30:32 +00:00
|
|
|
struct FMissingCount
|
|
|
|
{
|
|
|
|
FMissingCount() : Count(0) {}
|
|
|
|
int Count;
|
|
|
|
};
|
|
|
|
typedef TMap<FString,FMissingCount> FMissingTextureTracker;
|
|
|
|
|
2013-02-17 00:23:58 +00:00
|
|
|
// Record of user data for UDMF maps
|
|
|
|
struct FMapThingUserData
|
|
|
|
{
|
|
|
|
FName Property;
|
|
|
|
int Value;
|
|
|
|
};
|
|
|
|
extern TMap<unsigned,unsigned> MapThingsUserDataIndex; // from mapthing idx -> user data idx
|
|
|
|
extern TArray<FMapThingUserData> MapThingsUserData;
|
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#endif
|