summaryrefslogtreecommitdiff
path: root/SpriteMaps.cpp
diff options
context:
space:
mode:
authorJapa2010-04-09 14:12:29 +0000
committerJapa2010-04-09 14:12:29 +0000
commit81aefc8e03ff3f647494012e18bcdc8f33f4de42 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /SpriteMaps.cpp
parentc3d0b7d6778af46299901d959d589d6599afa21c (diff)
downloadstonesense-81aefc8e03ff3f647494012e18bcdc8f33f4de42.tar.gz
stonesense-81aefc8e03ff3f647494012e18bcdc8f33f4de42.tar.bz2
stonesense-81aefc8e03ff3f647494012e18bcdc8f33f4de42.tar.xz
There is no trunk
it is not the code that compiles, it is you.
Diffstat (limited to 'SpriteMaps.cpp')
-rw-r--r--SpriteMaps.cpp106
1 files changed, 0 insertions, 106 deletions
diff --git a/SpriteMaps.cpp b/SpriteMaps.cpp
deleted file mode 100644
index 5e12e09..0000000
--- a/SpriteMaps.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-#include "common.h"
-#include "SpriteMaps.h"
-#include "GroundMaterialConfiguration.h"
-#include "ContentLoader.h"
-
-
-t_SpriteWithOffset GetTerrainSpriteMap(int in, t_matglossPair material, vector<TerrainConfiguration*>& configTable)
-{
- // in case we need to return nothing
- t_SpriteWithOffset defaultSprite = {UNCONFIGURED_INDEX,0,0,INVALID_INDEX,ALL_FRAMES};
- // first check the input is sane
- if( in < 0 || in >= (int)configTable.size() )
- {
- return defaultSprite;
- }
- // find a matching terrainConfig
- TerrainConfiguration* terrain = configTable[in];
- if (terrain == NULL)
- {
- return defaultSprite;
- }
- // check material sanity
- if (material.type<0 || material.type >= (int16_t)terrain->terrainMaterials.size())
- {
- return terrain->defaultSprite;
- }
- // find mat config
- TerrainMaterialConfiguration* terrainMat = terrain->terrainMaterials[material.type];
- if (terrainMat == NULL)
- {
- return terrain->defaultSprite;
- }
- // return subtype, type default or terrain default as available
- // do map lookup
- map<int,t_SpriteWithOffset>::iterator it = terrainMat->overridingMaterials.find(material.index);
- if (it != terrainMat->overridingMaterials.end())
- {
- return it->second;
- }
- if (terrainMat->defaultSprite.sheetIndex != UNCONFIGURED_INDEX)
- {
- return terrainMat->defaultSprite;
- }
- return terrain->defaultSprite;
-}
-
-t_SpriteWithOffset GetFloorSpriteMap(int in, t_matglossPair material){
- return GetTerrainSpriteMap(in, material, contentLoader.terrainFloorConfigs);
-}
-
-t_SpriteWithOffset GetBlockSpriteMap(int in, t_matglossPair material){
- return GetTerrainSpriteMap(in, material, contentLoader.terrainBlockConfigs);
-}
-
-t_SpriteWithOffset GetSpriteVegetation( TileClass type, int index)
-{
- int base_sprite = SPRITEOBJECT_BLUEPRINT;
- vector<VegetationConfiguration>* graphicSet;
- bool live=true;
- bool grown=true;
-
- switch(type)
- {
- case TREE_DEAD:
- base_sprite = SPRITEOBJECT_TREE_DEAD;
- graphicSet = &(contentLoader.treeConfigs);
- live = false;
- break;
- case TREE_OK:
- base_sprite = SPRITEOBJECT_TREE_OK;
- graphicSet = &(contentLoader.treeConfigs);
- break;
- case SAPLING_DEAD:
- base_sprite = SPRITEOBJECT_SAPLING_DEAD;
- live = false;
- grown = false;
- graphicSet = &(contentLoader.treeConfigs);
- break;
- case SAPLING_OK:
- base_sprite = SPRITEOBJECT_SAPLING_OK;
- grown = false;
- graphicSet = &(contentLoader.treeConfigs);
- break;
- case SHRUB_DEAD:
- base_sprite = SPRITEOBJECT_SHRUB_DEAD;
- live = false;
- graphicSet = &(contentLoader.shrubConfigs);
- break;
- case SHRUB_OK:
- base_sprite = SPRITEOBJECT_SHRUB_OK;
- graphicSet = &(contentLoader.shrubConfigs);
- break;
- default:
- t_SpriteWithOffset defaultSprite = {SPRITEOBJECT_BLANK,0,0,-1,ALL_FRAMES};
- return defaultSprite;
- }
-
- t_SpriteWithOffset configuredSprite = getVegetationSprite(*graphicSet,index,live,grown);
- if (configuredSprite.sheetIndex == -1)
- {
- configuredSprite.fileIndex = -1; // should be set already, but...
- configuredSprite.sheetIndex = base_sprite;
- }
- return configuredSprite;
-}
-