diff options
| author | Japa | 2010-06-24 10:21:25 +0000 |
|---|---|---|
| committer | Japa | 2010-06-24 10:21:25 +0000 |
| commit | 313d5fd88087eded7fb9cfa24419b34d2fdaf23f (patch) | |
| tree | a40e4d80f10f0421aa9bf1161a6b266cda03112f /Creatures.cpp | |
| parent | 7973416e41f0e27600706a0fda42282daae52d82 (diff) | |
| download | stonesense-313d5fd88087eded7fb9cfa24419b34d2fdaf23f.tar.gz stonesense-313d5fd88087eded7fb9cfa24419b34d2fdaf23f.tar.bz2 stonesense-313d5fd88087eded7fb9cfa24419b34d2fdaf23f.tar.xz | |
Moved more stuff to OO sprites.
Much is commented out.
Diffstat (limited to 'Creatures.cpp')
| -rw-r--r-- | Creatures.cpp | 45 |
1 files changed, 8 insertions, 37 deletions
diff --git a/Creatures.cpp b/Creatures.cpp index a95d225..bc1f5bf 100644 --- a/Creatures.cpp +++ b/Creatures.cpp @@ -269,38 +269,10 @@ void DrawCreature(int drawx, int drawy, t_creature* creature ){ statusIcons.push_back(17);
}
- t_SpriteWithOffset sprite = GetCreatureSpriteMap( creature );
+ c_sprite * sprite = GetCreatureSpriteMap( creature );
//if(creature->x == 151 && creature->y == 145)
// int j = 10;
- ALLEGRO_BITMAP* creatureSheet;
- if (sprite.fileIndex == -1)
- {
- creatureSheet = IMGCreatureSheet;
- }
- else
- {
- creatureSheet = getImgFile(sprite.fileIndex);
- }
- al_set_separate_blender(op, src, dst, alpha_op, alpha_src, alpha_dst, color*getSpriteColor(sprite, creature));
- DrawSpriteFromSheet( sprite.sheetIndex, creatureSheet, drawx, drawy );
- al_set_separate_blender(op, src, dst, alpha_op, alpha_src, alpha_dst, color);
- if(!(sprite.subSprites.empty()))
- {
- for(int i = 0; i < sprite.subSprites.size(); i++)
- {
- if (sprite.subSprites[i].fileIndex == -1)
- {
- creatureSheet = IMGCreatureSheet;
- }
- else
- {
- creatureSheet = getImgFile(sprite.subSprites[i].fileIndex);
- }
- al_set_separate_blender(op, src, dst, alpha_op, alpha_src, alpha_dst, color*getSpriteColor(sprite.subSprites[i], creature));
- DrawSpriteFromSheet( sprite.subSprites[i].sheetIndex, creatureSheet, drawx, drawy );
- al_set_separate_blender(op, src, dst, alpha_op, alpha_src, alpha_dst, color);
- }
- }
+ sprite->draw_world(creature->x,creature->y, creature->z);
if(statusIcons.size())
{
for(int i = 0; i < statusIcons.size(); i++)
@@ -445,9 +417,9 @@ CreatureConfiguration *GetCreatureConfig( t_creature* c ){ {
return NULL;
}
+ int rando = randomCube[c->x%RANDOM_CUBE][c->y%RANDOM_CUBE][c->z%RANDOM_CUBE];
+ int offsetAnimFrame = (currentAnimationFrame + rando) % MAX_ANIMFRAME;
- //search list for given creature variant
- int offsetAnimFrame = (currentAnimationFrame + c->id) % MAX_ANIMFRAME;
num = (uint32_t)creatureData->size();
for(uint32_t i=0; i < num; i++)
{
@@ -477,9 +449,8 @@ CreatureConfiguration *GetCreatureConfig( t_creature* c ){ }
if(!creatureMatchesSpecial) continue;
- if (!(testConfig->sprite.animFrames & (1 << offsetAnimFrame)))
+ if (!(testConfig->sprite.get_animframes() & (1 << offsetAnimFrame)))
continue;
-
// dont try to match strings until other tests pass
if( testConfig->professionstr[0])
{ //cant be NULL, so check has length
@@ -493,12 +464,12 @@ CreatureConfiguration *GetCreatureConfig( t_creature* c ){ }
-t_SpriteWithOffset GetCreatureSpriteMap( t_creature* c )
+c_sprite* GetCreatureSpriteMap( t_creature* c )
{
CreatureConfiguration *testConfig = GetCreatureConfig( c );
if (testConfig == NULL)
- return spriteCre_NA;
- return testConfig->sprite;
+ return new c_sprite;
+ return &(testConfig->sprite);
}
int GetCreatureShadowMap( t_creature* c )
|
