void SpriteCache::initFile_initNullSpriteParams(sprkey_t index) { // no sprite ... blank it out _sprInfos[index] = SpriteInfo(); _spriteData[index] = SpriteData(); }
void Viewport::drawTile(const Tile* t, u16 x, s16 y, Plane plane) { TextureID* tx = planeTextures[plane]; if (t->node) { u16 index = 0; if (t->node->school == NATURE) index = 1; else if (t->node->school == CHAOS) index = 2; Gfx::drawAnimated(SpriteInfo(tx[NODES], index), x, y, t->animationOffset); } else { if (t->type == TILE_WATER || t->type == TILE_SHORE) { if (waterMap.find(t->subtype) != waterMap.end() && (t->subtype != 0 || t->tileGfxType == TILE_GFX_ANIMATED)) Gfx::drawAnimated(SpriteInfo(tx[ANIMATED], waterMap[t->subtype]), x, y, t->animationOffset); /*else if (waterMap.contains(t->subtype)) TextureID::drawAnimated(animated, waterMap.get(t->subtype), x, y, t->animationOffset());*/ else if (t->tileGfxType == TILE_GFX_BORDER) Gfx::draw(tx[SHORE], t->subtype/10, t->subtype%10, x, y); else Gfx::draw(tx[TILES], 5, 0, x, y); } else if (t->type == TILE_RIVER) Gfx::draw(tx[RIVERS], t->subtype/8, t->subtype%8, x, y); else if (t->type == TILE_DESERT) Gfx::draw(tx[DESERT], t->subtype/10, t->subtype%10, x, y); else if (t->type == TILE_TUNDRA) { // the sprite doesn't have borders with other types, then a random sprite of basic terrain is used if (t->tileGfxType == TILE_GFX_PLAIN) Gfx::draw(tx[TILES], GfxData::tileGfxSpec(t->type).row, t->subtype, x, y); else Gfx::draw(tx[TUNDRA], t->subtype/10, t->subtype%10, x, y); } else if (t->type == TILE_MOUNTAIN) Gfx::draw(tx[MOUNTAINS], 0, t->subtype, x, y); else if (t->type == TILE_VOLCANO) Gfx::drawAnimated(SpriteInfo(tx[ANIMATED], 1), x, y, t->animationOffset); else if (t->type == TILE_HILL) Gfx::draw(tx[MOUNTAINS], 1, t->subtype, x, y); else if (t->type == TILE_GRASS || t->type == TILE_SWAMP || t->type == TILE_FOREST || t->type == TILE_DESERT || t->type == TILE_TUNDRA) { Gfx::draw(tx[TILES], GfxData::tileGfxSpec(t->type).row, t->subtype, x, y); } } if (t->resource != Resource::NONE) Gfx::draw(gfxForResource(t->resource), x, y); if (t->place) Gfx::draw(gfxForPlace(t->place), x, y); if (t->isCorrupted()) Gfx::draw(place_corruption, x, y); if (t->hasRoad || t->city) { if (t->roads == 0) Gfx::drawAnimated(t->hasEnchantedRoad ? roads_ench[0] : roads[0], x, y); else for (int i = 0; i < 8; ++i) if ((t->roads & (1<<i)) == 1<<i) { Gfx::drawAnimated(t->hasEnchantedRoad ? roads_ench[i+1] : roads[i+1], x, y); } } //if (LocalGame.i.currentPlayer.mapGridEnabled) // Gfx::draw(TextureID::TILE_FOG, 0, 9, x, y); }