1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #include "EntityType.h"
- #include "Entity.h"
- #include "Registries.h"
- #include "Globals.h"
- EntityType::EntityType(int id, ModelInfo model)
- : id(id),
- model(model)
- {}
- Entity* EntityType::loadEntity(Framework::StreamReader* zReader) const
- {
- int id;
- zReader->lese((char*)&id, 4);
- Framework::Vec3<float> position;
- zReader->lese((char*)&position.x, 4);
- zReader->lese((char*)&position.y, 4);
- zReader->lese((char*)&position.z, 4);
- float maxSpeed;
- zReader->lese((char*)&maxSpeed, 4);
- bool specialModel = 0;
- zReader->lese((char*)&specialModel, 1);
- Entity* e;
- if (specialModel)
- {
- ModelInfo model(zReader);
- e = new Entity(this, model.getModel(), model.getTexture(), id, position, maxSpeed);
- }
- else
- {
- e = new Entity(this, model.getModel(), model.getTexture(), id, position, maxSpeed);
- }
- if (World::INSTANCE->zKamera()->getEntityId() == id)
- {
- e->setPlayerControlled();
- }
- return e;
- }
- int EntityType::getId() const
- {
- return id;
- }
|