@@ -67,6 +67,32 @@ void Tiler::Deregister(int id) | |||||
data->tilesets.RemoveSlot(id - 1); /* ID 0 is for the empty tileset */ | data->tilesets.RemoveSlot(id - 1); /* ID 0 is for the empty tileset */ | ||||
} | } | ||||
int2 Tiler::GetSize(int id) | |||||
{ | |||||
TileSet *tileset = (TileSet *)data->tilesets.GetEntity(id - 1); | |||||
#if !FINAL_RELEASE | |||||
if (!tileset) | |||||
{ | |||||
fprintf(stderr, "ERROR: getting size for null tiler #%i\n", id); | |||||
return 0; | |||||
} | |||||
#endif | |||||
return tileset->GetSize(); | |||||
} | |||||
int2 Tiler::GetCount(int id) | |||||
{ | |||||
TileSet *tileset = (TileSet *)data->tilesets.GetEntity(id - 1); | |||||
#if !FINAL_RELEASE | |||||
if (!tileset) | |||||
{ | |||||
fprintf(stderr, "ERROR: getting count for null tiler #%i\n", id); | |||||
return 0; | |||||
} | |||||
#endif | |||||
return tileset->GetCount(); | |||||
} | |||||
void Tiler::BlitTile(uint32_t code, int x, int y, int z, int o) | void Tiler::BlitTile(uint32_t code, int x, int y, int z, int o) | ||||
{ | { | ||||
int id = (code >> 16) - 1; /* ID 0 is for the empty tileset */ | int id = (code >> 16) - 1; /* ID 0 is for the empty tileset */ | ||||
@@ -25,6 +25,8 @@ public: | |||||
static int Register(char const *path, int2 size, int2 count, float dilate); | static int Register(char const *path, int2 size, int2 count, float dilate); | ||||
static void Deregister(int id); | static void Deregister(int id); | ||||
static int2 GetSize(int id); | |||||
static int2 GetCount(int id); | |||||
static void BlitTile(uint32_t code, int x, int y, int z, int o); | static void BlitTile(uint32_t code, int x, int y, int z, int o); | ||||
}; | }; | ||||
@@ -157,6 +157,16 @@ char const *TileSet::GetName() | |||||
return data->name; | return data->name; | ||||
} | } | ||||
int2 TileSet::GetSize() const | |||||
{ | |||||
return data->size; | |||||
} | |||||
int2 TileSet::GetCount() const | |||||
{ | |||||
return data->count; | |||||
} | |||||
void TileSet::BlitTile(uint32_t id, int x, int y, int z, int o) | void TileSet::BlitTile(uint32_t id, int x, int y, int z, int o) | ||||
{ | { | ||||
float tx = data->tx * ((id & 0xffff) % data->count.i); | float tx = data->tx * ((id & 0xffff) % data->count.i); | ||||
@@ -38,6 +38,8 @@ protected: | |||||
public: | public: | ||||
/* New methods */ | /* New methods */ | ||||
int2 GetSize() const; | |||||
int2 GetCount() const; | |||||
void BlitTile(uint32_t id, int x, int y, int z, int o); | void BlitTile(uint32_t id, int x, int y, int z, int o); | ||||
private: | private: | ||||