Esempio n. 1
0
void LootManager::getRenders(Renderables &dest) {
	for (LootList::const_iterator it = lootList.begin(); it != lootList.end(); ++it) {
		const LootDef &loot = **it;

		Renderable r;
		r.map_pos = loot.pos;
		r.src.x = (loot.frame / LootDef::anim_loot_duration) * 64;
		r.src.y = 0;
		r.src.w = 64;
		r.src.h = 128;
		r.offset = Point(32, 112);
		r.object_layer = true;
		r.tile = Point(0, 0);
		// Right now the animation settings (number of frames, speed, frame size)
		// are hard coded.  At least move these to consts in the header.
		if (loot.stack.item) {
			// item
			for (int i=0; i<animation_count; i++) {
				if (loot.stack.item->loot == animation_id[i])
					r.sprite = flying_loot[i];
			}
		}
		else if (loot.gold > 0) {
			// gold
			if (loot.gold <= 9)
				r.sprite = flying_gold[0];
			else if (loot.gold <= 25)
				r.sprite = flying_gold[1];
			else
				r.sprite = flying_gold[2];
		}

		dest.push_back(r);
	}
}
Esempio n. 2
0
Renderables SceneData::getLights() const
{
    Renderables lights;
    
    for ( size_t index : m_lightIndices ) {
        lights.push_back( m_renderables[ index ] );
    }
    return lights;
}