EntityType.cpp 746 B

1234567891011121314151617181920212223242526272829303132
  1. #include "EntityType.h"
  2. #include "Entity.h"
  3. #include "Registries.h"
  4. EntityType::EntityType(int id, ModelInfo model)
  5. : id(id),
  6. model(model)
  7. {}
  8. Entity* EntityType::loadEntity(Framework::StreamReader* zReader) const
  9. {
  10. int id;
  11. zReader->lese((char*)&id, 4);
  12. Framework::Vec3<float> position;
  13. zReader->lese((char*)&position.x, 4);
  14. zReader->lese((char*)&position.y, 4);
  15. zReader->lese((char*)&position.z, 4);
  16. bool specialModel = 0;
  17. zReader->lese((char*)&specialModel, 1);
  18. if (specialModel)
  19. {
  20. ModelInfo model(zReader);
  21. return new Entity(this, model.getModel(), model.getTexture(), id);;
  22. }
  23. return new Entity(this, model.getModel(), model.getTexture(), id);
  24. }
  25. int EntityType::getId() const
  26. {
  27. return id;
  28. }