vkdoom_m/src/p_setup.h
Christoph Oelckers fd79fac52c - Fixed: Saving on maps that don't contain a MAPINFO definition didn't work.
- Fixed: The Zip loader loaded all WADs inside a Zip into the lump directory.
  This is only supposed to be done for WADs in the root directory.
- Complete restructuring of the map loading code. Previously the only way
  to put maps into Zips was to load them as embedded WADs which caused
  some problems, most importantly that the map's file name was irrelevant
  and the internal map label was used instead. With the new code there
  is now a properly defined way to add maps to Zips:
  * Maps are placed in a subdirectory called 'maps'.
  * Maps are stored as WADs that contain all map related lumps.
  * The first lump in the map's WAD directory must be the map label.
  * All lumps not belonging to the first map are ignored.
  * The map's file name determines the name the map is identified with. 
    For maps stored this way the internal map label is ignored so with this 
    method renaming maps is as easy as renaming a file and it is no longer 
    necessary to manipulate the map label.
  With the new code it is also possible to load external maps without
  adding them to the WAD list. Type 'open mapfile.wad' in the console
  to start such a map.
  The new code also performs stricter lump name checks to prevent accidental
  loading of non-map data.


SVN r188 (trunk)
2006-06-14 15:56:56 +00:00

96 lines
2.2 KiB
C++

// 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__
#include "w_wad.h"
#include "files.h"
#include "doomdata.h"
struct MapData
{
wadlump_t MapLumps[ML_BEHAVIOR+1];
bool HasBehavior;
bool CloseOnDestruct;
int lumpnum;
FileReader * file;
MapData()
{
memset(MapLumps, 0, sizeof(MapLumps));
file = NULL;
lumpnum=-1;
HasBehavior=false;
CloseOnDestruct=true;
}
~MapData()
{
if (CloseOnDestruct && file != NULL) delete file;
file = NULL;
}
void Seek(int lumpindex)
{
if (lumpindex>=0 && lumpindex<countof(MapLumps))
{
file->Seek(MapLumps[lumpindex].FilePos, SEEK_SET);
}
}
void Read(int lumpindex, void * buffer)
{
if (lumpindex>=0 && lumpindex<countof(MapLumps))
{
file->Seek(MapLumps[lumpindex].FilePos, SEEK_SET);
file->Read(buffer, MapLumps[lumpindex].Size);
}
}
DWORD Size(int lumpindex)
{
if (lumpindex>=0 && lumpindex<countof(MapLumps))
{
return MapLumps[lumpindex].Size;
}
return 0;
}
};
MapData * P_OpenMapData(const char * mapname);
// 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);
void P_FreeLevelData();
void P_FreeExtraLevelData();
// Called by startup code.
void P_Init (void);
#endif