Object::Object(ObjectType *objectType, const Vec3f &pos, const Vec2i &mapPos) : BaseColorPickEntity() { RandomGen random; random.init(static_cast<int>(pos.x * pos.z)); this->lastRenderFrame = 0; this->objectType= objectType; resource= NULL; highlight= 0.f; animated= false; this->mapPos = mapPos; this->pos= pos + Vec3f(random.randRange(-0.6f, 0.6f), 0.0f, random.randRange(-0.6f, 0.6f)); rotation= random.randRange(0.f, 360.f); if(objectType!=NULL){ variation = random.randRange(0, objectType->getModelCount()-1); TilesetModelType *tmt=objectType->getTilesetModelType(variation); if(tmt->getRotationAllowed() != true) { rotation=0; } if(tmt->getRandomPositionEnabled() != true) { this->pos = pos; } animated=tmt->getAnimSpeed()>0; } else { variation=0; } visible=false; animProgress=0.0f; }
Tile getSpecialCreatureSprite(const ViewObject& obj, bool humanoid) { RandomGen r; r.init(hash<string>()(obj.getBareDescription())); if (humanoid) return Tile::byCoord(r.get(7), 10); else return Tile::byCoord(r.get(7, 10), 10); }
Tile getSpecialCreature(const ViewObject& obj, bool humanoid) { RandomGen r; r.init(hash<string>()(obj.getBareDescription())); string let = humanoid ? "WETUIPLKJHFAXBM" : "qwetyupkfaxbnm"; char c; if (contains(let, obj.getBareDescription()[0])) c = obj.getBareDescription()[0]; else if (contains(let, tolower(obj.getBareDescription()[0]))) c = tolower(obj.getBareDescription()[0]); else c = let[r.get(let.size())]; return Tile::unicode(c, ColorId(Random.get(EnumInfo<ColorId>::getSize()))); }
Tile getSpecialCreature(const ViewObject& obj, bool humanoid) { RandomGen r; r.init(hash<string>()(obj.getBareDescription())); string let = humanoid ? "WETUIPLKJHFAXBM" : "qwetyupkfaxbnm"; char c; if (contains(let, obj.getBareDescription()[0])) c = obj.getBareDescription()[0]; else if (contains(let, tolower(obj.getBareDescription()[0]))) c = tolower(obj.getBareDescription()[0]); else c = let[r.getRandom(let.size())]; Color col(r.getRandom(80, 250), r.getRandom(80, 250), 0); return Tile(c, col); }