summaryrefslogtreecommitdiff
path: root/Creatures.cpp
diff options
context:
space:
mode:
authorJapa2012-08-24 23:29:55 +0530
committerJapa2012-08-24 23:29:55 +0530
commitb7af8ca75b244fb7499e4bfd920f5df9a4ab6f83 (patch)
tree00223e1e3e1c90a6ebcd1d189a241febe4d55117 /Creatures.cpp
parent5d4f06d785f8a9933679fe3caa12c18215e9674d (diff)
downloadstonesense-b7af8ca75b244fb7499e4bfd920f5df9a4ab6f83.tar.gz
stonesense-b7af8ca75b244fb7499e4bfd920f5df9a4ab6f83.tar.bz2
stonesense-b7af8ca75b244fb7499e4bfd920f5df9a4ab6f83.tar.xz
changed default creature sprite behavior to show a creature's letter instead of a purple question mark.
Diffstat (limited to 'Creatures.cpp')
-rw-r--r--Creatures.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/Creatures.cpp b/Creatures.cpp
index 38cef17..bface8c 100644
--- a/Creatures.cpp
+++ b/Creatures.cpp
@@ -277,11 +277,18 @@ void DrawCreature(int drawx, int drawy, t_unit* creature, Block * b){
}
c_sprite * sprite = GetCreatureSpriteMap( creature );
+ if(sprite)
+ sprite->draw_world(creature->x,creature->y, creature->z, b);
+ else
+ {
+ df::creature_raw *raw = df::global::world->raws.creatures.all[creature->race];
+ int spritenum = raw->creature_tile;
+ spritenum += (spritenum/16)*4;
+ DrawSpriteFromSheet(spritenum,IMGLetterSheet,config.colors.getDfColor(raw->color[0],raw->color[2]),drawx,drawy,b);
+ }
unsigned int offsety = config.show_creature_names ? al_get_font_line_height(font) : 0;
-
- sprite->draw_world(creature->x,creature->y, creature->z, b);
-
+
if(statusIcons.size())
{
for(int i = 0; i < statusIcons.size(); i++)
@@ -551,12 +558,9 @@ CreatureConfiguration *GetCreatureConfig( t_unit* c ){
c_sprite* GetCreatureSpriteMap( t_unit* c )
{
- static c_sprite * defaultSprite = new c_sprite;
- defaultSprite->reset();
- defaultSprite->set_defaultsheet(IMGCreatureSheet);
CreatureConfiguration *testConfig = GetCreatureConfig( c );
if (testConfig == NULL)
- return defaultSprite;
+ return NULL;
testConfig->sprite.set_defaultsheet(IMGCreatureSheet);
return &(testConfig->sprite);
}