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__
|
|
|
|
|
2006-06-14 15:56:56 +00:00
|
|
|
#include "w_wad.h"
|
|
|
|
#include "files.h"
|
|
|
|
#include "doomdata.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
|
2006-06-14 15:56:56 +00:00
|
|
|
struct MapData
|
|
|
|
{
|
2006-06-15 08:26:13 +00:00
|
|
|
wadlump_t MapLumps[ML_MAX];
|
2006-06-14 15:56:56 +00:00
|
|
|
bool HasBehavior;
|
|
|
|
bool CloseOnDestruct;
|
2006-06-15 03:31:19 +00:00
|
|
|
bool Encrypted;
|
2006-06-14 15:56:56 +00:00
|
|
|
int lumpnum;
|
|
|
|
FileReader * file;
|
|
|
|
|
|
|
|
MapData()
|
|
|
|
{
|
|
|
|
memset(MapLumps, 0, sizeof(MapLumps));
|
|
|
|
file = NULL;
|
2006-06-15 03:31:19 +00:00
|
|
|
lumpnum = -1;
|
|
|
|
HasBehavior = false;
|
|
|
|
CloseOnDestruct = true;
|
|
|
|
Encrypted = false;
|
2006-06-14 15:56:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
~MapData()
|
|
|
|
{
|
|
|
|
if (CloseOnDestruct && file != NULL) delete file;
|
|
|
|
file = NULL;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
|
|
|
file->Seek(MapLumps[lumpindex].FilePos, SEEK_SET);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-14 20:24:43 +00:00
|
|
|
void Read(unsigned int lumpindex, void * buffer)
|
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
|
|
|
{
|
|
|
|
file->Seek(MapLumps[lumpindex].FilePos, SEEK_SET);
|
|
|
|
file->Read(buffer, MapLumps[lumpindex].Size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-14 20:24:43 +00:00
|
|
|
DWORD Size(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
|
|
|
{
|
|
|
|
return MapLumps[lumpindex].Size;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
MapData * P_OpenMapData(const char * mapname);
|
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.
|
|
|
|
void P_SetupLevel (char *mapname, int position);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
#endif
|