2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#ifndef ENGINE_MAP_H
|
|
|
|
#define ENGINE_MAP_H
|
|
|
|
|
|
|
|
#include "kernel.h"
|
2020-09-26 19:41:58 +00:00
|
|
|
#include <base/hash.h>
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2020-06-18 16:29:27 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MAX_MAP_LENGTH = 128
|
|
|
|
};
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
class IMap : public IInterface
|
|
|
|
{
|
|
|
|
MACRO_INTERFACE("map", 0)
|
|
|
|
public:
|
2023-05-15 16:15:17 +00:00
|
|
|
virtual int GetDataSize(int Index) const = 0;
|
2023-08-12 10:29:52 +00:00
|
|
|
virtual void *GetData(int Index) = 0;
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual void *GetDataSwapped(int Index) = 0;
|
2023-08-13 09:50:35 +00:00
|
|
|
virtual const char *GetDataString(int Index) = 0;
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual void UnloadData(int Index) = 0;
|
2023-05-15 16:17:56 +00:00
|
|
|
virtual int NumData() const = 0;
|
2023-05-15 16:04:58 +00:00
|
|
|
|
2011-07-13 20:38:32 +00:00
|
|
|
virtual int GetItemSize(int Index) = 0;
|
2023-08-12 10:29:52 +00:00
|
|
|
virtual void *GetItem(int Index, int *pType = nullptr, int *pID = nullptr) = 0;
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual void GetType(int Type, int *pStart, int *pNum) = 0;
|
2023-08-13 10:03:31 +00:00
|
|
|
virtual int FindItemIndex(int Type, int ID) = 0;
|
2011-02-12 10:40:36 +00:00
|
|
|
virtual void *FindItem(int Type, int ID) = 0;
|
2023-05-15 16:15:17 +00:00
|
|
|
virtual int NumItems() const = 0;
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class IEngineMap : public IMap
|
|
|
|
{
|
|
|
|
MACRO_INTERFACE("enginemap", 0)
|
|
|
|
public:
|
|
|
|
virtual bool Load(const char *pMapName) = 0;
|
|
|
|
virtual void Unload() = 0;
|
2023-05-15 16:15:17 +00:00
|
|
|
virtual bool IsLoaded() const = 0;
|
|
|
|
virtual IOHANDLE File() const = 0;
|
2023-05-15 16:04:58 +00:00
|
|
|
|
2023-05-15 16:15:17 +00:00
|
|
|
virtual SHA256_DIGEST Sha256() const = 0;
|
|
|
|
virtual unsigned Crc() const = 0;
|
|
|
|
virtual int MapSize() const = 0;
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern IEngineMap *CreateEngineMap();
|
|
|
|
|
|
|
|
#endif
|