2009-02-24 14:12:49 -08:00
|
|
|
/*
|
|
|
|
This file is part of Warzone 2100.
|
|
|
|
Copyright (C) 1999-2004 Eidos Interactive
|
|
|
|
Copyright (C) 2005-2009 Warzone Resurrection Project
|
|
|
|
|
|
|
|
Warzone 2100 is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Warzone 2100 is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Warzone 2100; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __INCLUDED_TOOLS_MAPLOAD_H__
|
|
|
|
#define __INCLUDED_TOOLS_MAPLOAD_H__
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2009-07-27 09:01:56 -07:00
|
|
|
#include "wzglobal.h"
|
2009-03-01 04:44:54 -08:00
|
|
|
#include "physfs_ext.h"
|
2009-02-24 14:12:49 -08:00
|
|
|
|
2009-03-01 04:44:54 -08:00
|
|
|
#define MAX_LEVEL_SIZE 20
|
2009-03-07 10:47:07 -08:00
|
|
|
#define TILE_HEIGHT 128
|
|
|
|
#define TILE_WIDTH 128
|
2009-02-24 14:12:49 -08:00
|
|
|
|
2009-03-08 07:19:28 -07:00
|
|
|
enum {
|
|
|
|
IMD_FEATURE,
|
|
|
|
IMD_STRUCTURE,
|
|
|
|
IMD_DROID,
|
|
|
|
IMD_OBJECT,
|
|
|
|
};
|
|
|
|
|
2009-03-07 06:20:20 -08:00
|
|
|
typedef struct _lnd_object_type
|
|
|
|
{
|
|
|
|
uint32_t id;
|
|
|
|
uint32_t player;
|
|
|
|
int type; // "IMD" LND object type
|
|
|
|
char name[128];
|
|
|
|
char script[32];
|
|
|
|
uint32_t x, y, z;
|
|
|
|
uint32_t direction;
|
|
|
|
} LND_OBJECT;
|
|
|
|
|
2009-03-02 11:40:31 -08:00
|
|
|
typedef enum _tileset_type
|
|
|
|
{
|
|
|
|
TILESET_ARIZONA = 0,
|
|
|
|
TILESET_URBAN = 1,
|
|
|
|
TILESET_ROCKIES = 2
|
|
|
|
} TILESET;
|
|
|
|
|
2009-03-02 10:53:08 -08:00
|
|
|
typedef struct _gateway
|
|
|
|
{
|
|
|
|
uint8_t x1, y1, x2, y2;
|
|
|
|
} GATEWAY;
|
|
|
|
|
2009-02-24 14:12:49 -08:00
|
|
|
/* Information stored with each tile */
|
|
|
|
typedef struct _maptile_type
|
|
|
|
{
|
|
|
|
uint8_t tileInfoBits;
|
|
|
|
uint8_t tileVisBits; // COMPRESSED - bit per player
|
|
|
|
uint8_t height; // The height at the top left of the tile
|
|
|
|
uint8_t illumination; // How bright is this tile?
|
|
|
|
uint32_t texture; // Which graphics texture is on this tile
|
|
|
|
float level;
|
|
|
|
} MAPTILE;
|
|
|
|
|
|
|
|
typedef struct _mapfile_type
|
|
|
|
{
|
2009-07-27 09:01:56 -07:00
|
|
|
uint32_t height, width, mapVersion, gameVersion, numGateways, numFeatures, numTerrainTypes, power[8];
|
|
|
|
uint32_t numPlayers, numDroids, numStructures, droidVersion, structVersion, featVersion, terrainVersion;
|
2009-02-26 15:17:05 -08:00
|
|
|
int32_t scrollMinX;
|
|
|
|
int32_t scrollMinY;
|
|
|
|
uint32_t scrollMaxX;
|
|
|
|
uint32_t scrollMaxY;
|
2009-03-01 04:44:54 -08:00
|
|
|
char levelName[MAX_LEVEL_SIZE];
|
2009-03-02 11:40:31 -08:00
|
|
|
TILESET tileset;
|
2009-03-02 10:53:08 -08:00
|
|
|
|
|
|
|
// private members - don't touch! :-)
|
|
|
|
GATEWAY *mGateways;
|
|
|
|
MAPTILE *mMapTiles;
|
2009-03-07 06:20:20 -08:00
|
|
|
LND_OBJECT *mLndObjects[3]; // for map2lnd only
|
2009-02-24 14:12:49 -08:00
|
|
|
} GAMEMAP;
|
|
|
|
|
2009-03-02 10:53:08 -08:00
|
|
|
static inline MAPTILE *mapTile(GAMEMAP *map, int x, int y)
|
|
|
|
{
|
|
|
|
return &map->mMapTiles[y * map->width + x];
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline GATEWAY *mapGateway(GAMEMAP *map, int index)
|
|
|
|
{
|
|
|
|
return &map->mGateways[index];
|
|
|
|
}
|
|
|
|
|
2009-02-24 14:12:49 -08:00
|
|
|
/* Load the map data */
|
|
|
|
GAMEMAP *mapLoad(char *filename);
|
|
|
|
void mapFree(GAMEMAP *map);
|
|
|
|
|
|
|
|
#endif
|