Browse Source

remove unneeded information from client

Kolja Strohm 2 years ago
parent
commit
857c1ff152
77 changed files with 1419 additions and 3049 deletions
  1. 9 11
      FactoryCraft/AddChunkUpdate.cpp
  2. 4 4
      FactoryCraft/AddChunkUpdate.h
  3. 6 6
      FactoryCraft/AddEntityUpdate.cpp
  4. 4 4
      FactoryCraft/AddEntityUpdate.h
  5. 47 47
      FactoryCraft/Area.cpp
  6. 17 17
      FactoryCraft/Area.h
  7. 0 228
      FactoryCraft/BasicBlocks.cpp
  8. 0 256
      FactoryCraft/BasicBlocks.h
  9. 31 72
      FactoryCraft/Block.cpp
  10. 8 46
      FactoryCraft/Block.h
  11. 0 50
      FactoryCraft/BlockChangedUpdate.cpp
  12. 0 14
      FactoryCraft/BlockChangedUpdate.h
  13. 9 12
      FactoryCraft/BlockRemovedUpdate.cpp
  14. 4 4
      FactoryCraft/BlockRemovedUpdate.h
  15. 13 42
      FactoryCraft/BlockType.cpp
  16. 10 15
      FactoryCraft/BlockType.h
  17. 6 20
      FactoryCraft/Chunk.cpp
  18. 2 4
      FactoryCraft/Chunk.h
  19. 1 1
      FactoryCraft/Dialog.h
  20. 2 8
      FactoryCraft/Dimension.cpp
  21. 1 3
      FactoryCraft/Dimension.h
  22. 30 29
      FactoryCraft/DirectConnect.cpp
  23. 3 3
      FactoryCraft/DirectConnect.h
  24. 22 89
      FactoryCraft/Entity.cpp
  25. 7 45
      FactoryCraft/Entity.h
  26. 0 31
      FactoryCraft/EntityChangedUpdate.cpp
  27. 0 14
      FactoryCraft/EntityChangedUpdate.h
  28. 5 5
      FactoryCraft/EntityRemovedUpdate.cpp
  29. 4 4
      FactoryCraft/EntityRemovedUpdate.h
  30. 19 44
      FactoryCraft/EntityType.cpp
  31. 7 12
      FactoryCraft/EntityType.h
  32. 75 0
      FactoryCraft/FactoryClient.cpp
  33. 2 20
      FactoryCraft/FactoryCraft.vcxproj
  34. 9 66
      FactoryCraft/FactoryCraft.vcxproj.filters
  35. 0 37
      FactoryCraft/Game.cpp
  36. 0 4
      FactoryCraft/Game.h
  37. 46 23
      FactoryCraft/Globals.cpp
  38. 6 0
      FactoryCraft/Globals.h
  39. 110 110
      FactoryCraft/Initialisierung.cpp
  40. 12 12
      FactoryCraft/Initialisierung.h
  41. 0 30
      FactoryCraft/Inventory.h
  42. 0 84
      FactoryCraft/Inventoty.cpp
  43. 0 78
      FactoryCraft/Item.cpp
  44. 0 41
      FactoryCraft/Item.h
  45. 0 35
      FactoryCraft/ItemEntity.cpp
  46. 0 27
      FactoryCraft/ItemEntity.h
  47. 0 47
      FactoryCraft/ItemSlot.cpp
  48. 0 27
      FactoryCraft/ItemSlot.h
  49. 0 35
      FactoryCraft/ItemStack.cpp
  50. 0 20
      FactoryCraft/ItemStack.h
  51. 10 43
      FactoryCraft/ItemType.cpp
  52. 8 25
      FactoryCraft/ItemType.h
  53. 471 505
      FactoryCraft/Load.cpp
  54. 4 4
      FactoryCraft/Load.h
  55. 29 28
      FactoryCraft/Login.cpp
  56. 4 4
      FactoryCraft/Login.h
  57. 45 44
      FactoryCraft/Main.cpp
  58. 10 9
      FactoryCraft/Menu.cpp
  59. 5 5
      FactoryCraft/Menu.h
  60. 45 0
      FactoryCraft/ModelInfo.cpp
  61. 19 0
      FactoryCraft/ModelInfo.h
  62. 97 97
      FactoryCraft/NetworkHandler.cpp
  63. 12 12
      FactoryCraft/NetworkHandler.h
  64. 0 69
      FactoryCraft/NoBlock.cpp
  65. 0 51
      FactoryCraft/NoBlock.h
  66. 10 19
      FactoryCraft/PlaceBlockUpdate.cpp
  67. 4 4
      FactoryCraft/PlaceBlockUpdate.h
  68. 0 102
      FactoryCraft/Player.cpp
  69. 0 38
      FactoryCraft/Player.h
  70. 16 0
      FactoryCraft/PlayerKam.cpp
  71. 9 7
      FactoryCraft/PlayerKam.h
  72. 0 11
      FactoryCraft/StaticInitializerOrder.cpp
  73. 44 44
      FactoryCraft/StaticRegistry.h
  74. 21 66
      FactoryCraft/World.cpp
  75. 5 6
      FactoryCraft/World.h
  76. 16 16
      FactoryCraft/WorldUpdate.cpp
  77. 4 4
      FactoryCraft/WorldUpdate.h

+ 9 - 11
FactoryCraft/AddChunkUpdate.cpp

@@ -5,19 +5,17 @@
 #include "Globals.h"
 
 AddChunkUpdateType::AddChunkUpdateType()
-    : WorldUpdateType( ID )
+	: WorldUpdateType(ID)
 {}
 
 
-void AddChunkUpdateType::applyUpdate( Framework::StreamReader* zReader )
+void AddChunkUpdateType::applyUpdate(Framework::StreamReader* zReader)
 {
-    int dimensionID;
-    zReader->lese( (char*)&dimensionID, 4 );
-    Framework::Punkt center;
-    zReader->lese( (char*)&center.x, 4 );
-    zReader->lese( (char*)&center.y, 4 );
-    std::cout << "downloading chunk " << center.x << ", " << center.y << "\n";
-    Chunk* chunk = new Chunk( center, dimensionID );
-    chunk->load( zReader );
-    currentGame->setChunk( chunk, dimensionID );
+	Framework::Punkt center;
+	zReader->lese((char*)&center.x, 4);
+	zReader->lese((char*)&center.y, 4);
+	std::cout << "downloading chunk " << center.x << ", " << center.y << "\n";
+	Chunk* chunk = new Chunk(center);
+	chunk->load(zReader);
+	currentGame->setChunk(chunk);
 }

+ 4 - 4
FactoryCraft/AddChunkUpdate.h

@@ -4,11 +4,11 @@
 
 class AddChunkUpdateType : WorldUpdateType
 {
-    REGISTRABLE( AddChunkUpdateType )
+	REGISTRABLE(AddChunkUpdateType)
 
 protected:
-    AddChunkUpdateType();
-    void applyUpdate( Framework::StreamReader* zReader ) override;
+	AddChunkUpdateType();
+	void applyUpdate(Framework::StreamReader* zReader) override;
 };
 
-REGISTER( AddChunkUpdateType, WorldUpdateType )
+REGISTER(AddChunkUpdateType, WorldUpdateType)

+ 6 - 6
FactoryCraft/AddEntityUpdate.cpp

@@ -6,13 +6,13 @@
 
 
 AddEntityUpdateType::AddEntityUpdateType()
-    : WorldUpdateType( ID )
+	: WorldUpdateType(ID)
 {}
 
-void AddEntityUpdateType::applyUpdate( Framework::StreamReader* zReader )
+void AddEntityUpdateType::applyUpdate(Framework::StreamReader* zReader)
 {
-    int type;
-    zReader->lese( (char*)&type, 4 );
-    Entity* entity = STATIC_REGISTRY( EntityType ).zElement( type )->loadEntity( zReader );
-    currentGame->zDimensionOrCreate( entity->getCurrentDimension() )->addEntity( entity );
+	int type;
+	zReader->lese((char*)&type, 4);
+	Entity* entity = entityTypes[type]->loadEntity(zReader);
+	currentGame->zDimension()->addEntity(entity);
 }

+ 4 - 4
FactoryCraft/AddEntityUpdate.h

@@ -4,11 +4,11 @@
 
 class AddEntityUpdateType : public WorldUpdateType
 {
-    REGISTRABLE( AddEntityUpdateType )
+	REGISTRABLE(AddEntityUpdateType)
 
 protected:
-    AddEntityUpdateType();
-    void applyUpdate( Framework::StreamReader* zReader ) override;
+	AddEntityUpdateType();
+	void applyUpdate(Framework::StreamReader* zReader) override;
 };
 
-REGISTER( AddEntityUpdateType, WorldUpdateType )
+REGISTER(AddEntityUpdateType, WorldUpdateType)

+ 47 - 47
FactoryCraft/Area.cpp

@@ -1,61 +1,61 @@
 #include "Area.h"
 
 
-Framework::Vec3<int> getDirection( Directions dir )
+Framework::Vec3<int> getDirection(Directions dir)
 {
-    Framework::Vec3<int> result( 0, 0, 0 );
-    if( (dir | NORTH) == dir )
-        --result.y;
-    if( (dir | EAST) == dir )
-        ++result.x;
-    if( (dir | SOUTH) == dir )
-        ++result.y;
-    if( (dir | WEST) == dir )
-        --result.x;
-    if( (dir | TOP) == dir )
-        ++result.z;
-    if( (dir | BOTTOM) == dir )
-        --result.z;
-    return result;
+	Framework::Vec3<int> result(0, 0, 0);
+	if ((dir | NORTH) == dir)
+		--result.y;
+	if ((dir | EAST) == dir)
+		++result.x;
+	if ((dir | SOUTH) == dir)
+		++result.y;
+	if ((dir | WEST) == dir)
+		--result.x;
+	if ((dir | TOP) == dir)
+		++result.z;
+	if ((dir | BOTTOM) == dir)
+		--result.z;
+	return result;
 }
 
-int getDirectionIndex( Direction dir )
+int getDirectionIndex(Direction dir)
 {
-    if( dir == NORTH )
-        return 0;
-    if( dir == EAST )
-        return 1;
-    if( dir == SOUTH )
-        return 2;
-    if( dir == WEST )
-        return 3;
-    if( dir == TOP )
-        return 4;
-    if( dir == BOTTOM )
-        return 5;
-    assert( false );
-    return -1;
+	if (dir == NORTH)
+		return 0;
+	if (dir == EAST)
+		return 1;
+	if (dir == SOUTH)
+		return 2;
+	if (dir == WEST)
+		return 3;
+	if (dir == TOP)
+		return 4;
+	if (dir == BOTTOM)
+		return 5;
+	assert(false);
+	return -1;
 }
 
-Direction getOppositeDirection( Direction dir )
+Direction getOppositeDirection(Direction dir)
 {
-    if( dir == NORTH )
-        return SOUTH;
-    if( dir == EAST )
-        return WEST;
-    if( dir == SOUTH )
-        return NORTH;
-    if( dir == WEST )
-        return EAST;
-    if( dir == TOP )
-        return BOTTOM;
-    if( dir == BOTTOM )
-        return TOP;
-    assert( false );
-    return NO_DIRECTION;
+	if (dir == NORTH)
+		return SOUTH;
+	if (dir == EAST)
+		return WEST;
+	if (dir == SOUTH)
+		return NORTH;
+	if (dir == WEST)
+		return EAST;
+	if (dir == TOP)
+		return BOTTOM;
+	if (dir == BOTTOM)
+		return TOP;
+	assert(false);
+	return NO_DIRECTION;
 }
 
-Direction getDirectionFromIndex( int index )
+Direction getDirectionFromIndex(int index)
 {
-    return (Direction)(1 << index);
+	return (Direction)(1 << index);
 }

+ 17 - 17
FactoryCraft/Area.h

@@ -4,29 +4,29 @@
 
 struct Area
 {
-    int startX;
-    int startY;
-    int endX;
-    int endY;
-    int dimensionId;
+	int startX;
+	int startY;
+	int endX;
+	int endY;
+	int dimensionId;
 };
 
 enum Direction
 {
-    NO_DIRECTION = 0,
-    NORTH = 1,
-    EAST = 2,
-    SOUTH = 4,
-    WEST = 8,
-    TOP = 16,
-    BOTTOM = 32,
-    INSIDE = 64
+	NO_DIRECTION = 0,
+	NORTH = 1,
+	EAST = 2,
+	SOUTH = 4,
+	WEST = 8,
+	TOP = 16,
+	BOTTOM = 32,
+	INSIDE = 64
 };
 typedef int Directions;
 
 #define ANY_DIRECTION NORTH | EAST | SOUTH | WEST | TOP | BOTTOM
 
-Framework::Vec3<int> getDirection( Directions dir );
-int getDirectionIndex( Direction dir );
-Direction getOppositeDirection( Direction dir );
-Direction getDirectionFromIndex( int index );
+Framework::Vec3<int> getDirection(Directions dir);
+int getDirectionIndex(Direction dir);
+Direction getOppositeDirection(Direction dir);
+Direction getDirectionFromIndex(int index);

+ 0 - 228
FactoryCraft/BasicBlocks.cpp

@@ -1,228 +0,0 @@
-#include "BasicBlocks.h"
-#include <Model3D.h>
-#include <Globals.h>
-#include <GraphicsApi.h>
-#include <Bild.h>
-#include <Model3DList.h>
-#include "Globals.h"
-
-
-BasicBlock::BasicBlock( const BlockType* zType, const char* texture, ItemType* zTool, Framework::Vec3<int> pos, Framework::Textur* t )
-    : Block( zType, zTool, pos, false )
-{
-    Model3DData* data = window->zBildschirm()->zGraphicsApi()->getModel( "cube" );
-    setModelDaten( data );
-    Bild* b = new Bild();
-    b->neuBild( 10, 10, 0xFFFFFFFF );
-    Textur* tex = uiFactory.initParam.bildschirm->zGraphicsApi()->createOrGetTextur( texture, 0 );
-    if( !tex->zBild() )
-        tex->setBildZ( b );
-    else
-        b->release();
-    Model3DTextur* textur = new Model3DTextur();
-    textur->setPolygonTextur( 0, dynamic_cast<Textur*>(tex->getThis()) );
-    textur->setPolygonTextur( 1, dynamic_cast<Textur*>(tex->getThis()) );
-    textur->setPolygonTextur( 2, dynamic_cast<Textur*>(tex->getThis()) );
-    textur->setPolygonTextur( 3, dynamic_cast<Textur*>(tex->getThis()) );
-    textur->setPolygonTextur( 4, dynamic_cast<Textur*>(tex->getThis()) );
-    textur->setPolygonTextur( 5, tex );
-    setModelTextur( textur );
-    breakTextur = uiFactory.initParam.bildschirm->zGraphicsApi()->createOrGetTextur( "blocks.ltdb/crack.png", 0 );
-}
-
-BasicBlock::~BasicBlock()
-{
-    breakTextur->release();
-}
-
-bool BasicBlock::needRenderPolygon( int index )
-{
-    return sideVisible[ index ];
-}
-
-Textur* BasicBlock::zEffectTextur()
-{
-    if( hp < maxHP )
-        return breakTextur;
-    return 0;
-}
-
-float BasicBlock::getEffectPercentage()
-{
-    return 1 - hp / maxHP;
-}
-
-BasicBlockType::BasicBlockType( int id, const char* texturPath )
-    : BlockType( id ),
-    texturPath( texturPath ),
-    transparent( 0 ),
-    passable( 0 ),
-    maxHp( 100.f ),
-    hardness( 1.f ),
-    zTool( 0 ),
-    speedModifier( 1.f ),
-    interactable( 1 )
-{}
-
-Block* BasicBlockType::createBlock( Framework::Vec3<int> position )
-{
-    Block* b = new BasicBlock( this, texturPath, 0, position, 0 ); // TODO: add efective tool
-    initializeSuperBlock( b );
-    return b;
-}
-
-void BasicBlockType::initializeSuperBlock( Block* zBlock )
-{
-    BasicBlock* block = dynamic_cast<BasicBlock*>(zBlock);
-    if( !block )
-        throw "BasicBlockType::initializeSuperBlock was called with a block witch is not an instance of BasicBlock";
-    block->transparent = transparent;
-    block->passable = passable;
-    block->hp = maxHp;
-    block->maxHP = maxHp;
-    block->hardness = hardness;
-    block->zTool = zTool;
-    block->speedModifier = speedModifier;
-}
-
-bool BasicBlockType::needsInstance() const
-{
-    return 1;
-}
-
-
-DirtBlockType::DirtBlockType()
-    : BasicBlockType( ID, "blocks.ltdb/dirt.png" )
-{}
-
-Block* DirtBlockType::createBlock( Framework::Vec3<int> position )
-{
-    Block* b = BasicBlockType::createBlock( position );
-    b->zTextur()->setPolygonTextur( 4, uiFactory.initParam.bildschirm->zGraphicsApi()->createOrGetTextur( "blocks.ltdb/lawn.png", 0 ) );
-    return b;
-}
-
-
-DirtBlockItemType::DirtBlockItemType()
-    : BasicBlockItemType( ID, "Dirt", "blocks.ltdb/dirt.png" )
-{}
-
-
-StoneBlockType::StoneBlockType()
-    : BasicBlockType( ID, "blocks.ltdb/stone.png" )
-{
-    hardness = 2.f;
-}
-
-
-StoneBlockItemType::StoneBlockItemType()
-    : BasicBlockItemType( ID, "Stone", "blocks.ltdb/stone.png" )
-{}
-
-
-SandBlockType::SandBlockType()
-    : BasicBlockType( ID, "blocks.ltdb/sand.png" )
-{
-    hardness = 0.5f;
-}
-
-
-SandBlockItemType::SandBlockItemType()
-    : BasicBlockItemType( ID, "Sand", "blocks.ltdb/sand.png" )
-{}
-
-
-OakBlockType::OakBlockType()
-    : BasicBlockType( ID, "blocks.ltdb/oak.png" )
-{
-    hardness = 1.5f;
-}
-
-
-OakBlockItemType::OakBlockItemType()
-    : BasicBlockItemType( ID, "Oak Wood", "blocks.ltdb/oak.png" )
-{}
-
-
-LeavesBlockType::LeavesBlockType()
-    : BasicBlockType( ID, "blocks.ltdb/leaves.png" )
-{
-    hardness = 0.1f;
-}
-
-
-LeavesBlockItemType::LeavesBlockItemType()
-    : BasicBlockItemType( ID, "Leaves", "blocks.ltdb/leaves.png" )
-{}
-
-
-GravelBlockType::GravelBlockType()
-    : BasicBlockType( ID, "blocks.ltdb/gravel.png" )
-{
-    hardness = 0.75f;
-}
-
-
-GravelBlockItemType::GravelBlockItemType()
-    : BasicBlockItemType( ID, "Gravel", "blocks.ltdb/gravel.png" )
-{}
-
-
-GraniteBlockType::GraniteBlockType()
-    : BasicBlockType( ID, "blocks.ltdb/granite.png" )
-{
-    hardness = 3.f;
-}
-
-
-GraniteBlockItemType::GraniteBlockItemType()
-    : BasicBlockItemType( ID, "Granite", "blocks.ltdb/granite.png" )
-{}
-
-
-CobbleBlockType::CobbleBlockType()
-    : BasicBlockType( ID, "blocks.ltdb/cobble.png" )
-{
-    hardness = 1.f;
-}
-
-
-CobbleBlockItemType::CobbleBlockItemType()
-    : BasicBlockItemType( ID, "Cobble", "blocks.ltdb/cobble.png" )
-{}
-
-
-BirchBlockType::BirchBlockType()
-    : BasicBlockType( ID, "blocks.ltdb/birch.png" )
-{
-    hardness = 1.5f;
-}
-
-
-BirchBlockItemType::BirchBlockItemType()
-    : BasicBlockItemType( ID, "Birch Wood", "blocks.ltdb/birch.png" )
-{}
-
-
-BeechBlockType::BeechBlockType()
-    : BasicBlockType( ID, "blocks.ltdb/beech.png" )
-{
-    hardness = 1.5f;
-}
-
-
-BeechBlockItemType::BeechBlockItemType()
-    : BasicBlockItemType( ID, "Beech Wood", "blocks.ltdb/beech.png" )
-{}
-
-
-BasaltBlockType::BasaltBlockType()
-    : BasicBlockType( ID, "blocks.ltdb/basalt.png" )
-{
-    hardness = 2.f;
-}
-
-
-BasaltBlockItemType::BasaltBlockItemType()
-    : BasicBlockItemType( ID, "Basalt", "blocks.ltdb/basalt.png" )
-{}

+ 0 - 256
FactoryCraft/BasicBlocks.h

@@ -1,256 +0,0 @@
-#pragma once
-
-#include <Textur.h>
-
-#include "Block.h"
-#include "BlockType.h"
-#include "Item.h"
-
-class BlockType;
-class ItemType;
-class BasicBlockType;
-
-class BasicBlock : public Block
-{
-    Framework::Textur* breakTextur;
-public:
-    BasicBlock( const BlockType* zType, const char* texture, ItemType* zTool, Framework::Vec3<int> pos, Framework::Textur* t );
-    ~BasicBlock();
-    bool needRenderPolygon( int index ) override;
-    virtual Textur* zEffectTextur() override;
-    virtual float getEffectPercentage() override;
-
-    friend BasicBlockType;
-};
-
-class BasicBlockType : public BlockType
-{
-private:
-    const char* texturPath;
-
-protected:
-    bool transparent;
-    bool passable;
-    float maxHp;
-    float hardness;
-    ItemType* zTool;
-    float speedModifier;
-    bool interactable;
-
-    BasicBlockType( int id, const char* texturPath );
-public:
-    virtual Block* createBlock( Framework::Vec3<int> position ) override;
-    virtual void initializeSuperBlock( Block* zBlock )  override;
-    virtual bool needsInstance() const override;
-};
-
-// Dirt
-class DirtBlockType : public BasicBlockType
-{
-    REGISTRABLE( DirtBlockType )
-
-protected:
-    DirtBlockType();
-    Block* createBlock( Framework::Vec3<int> position ) override;
-};
-REGISTER( DirtBlockType, BlockType )
-
-class DirtBlockItemType : public BasicBlockItemType
-{
-    REGISTRABLE( DirtBlockItemType )
-
-protected:
-    DirtBlockItemType();
-};
-REGISTER( DirtBlockItemType, ItemType )
-
-
-// Stone
-class StoneBlockType : public BasicBlockType
-{
-    REGISTRABLE( StoneBlockType )
-
-protected:
-    StoneBlockType();
-};
-REGISTER( StoneBlockType, BlockType )
-
-class StoneBlockItemType : public BasicBlockItemType
-{
-    REGISTRABLE( StoneBlockItemType )
-
-protected:
-    StoneBlockItemType();
-};
-REGISTER( StoneBlockItemType, ItemType )
-
-// Sand
-class SandBlockType : public BasicBlockType
-{
-    REGISTRABLE( SandBlockType )
-
-protected:
-    SandBlockType();
-};
-REGISTER( SandBlockType, BlockType )
-
-class SandBlockItemType : public BasicBlockItemType
-{
-    REGISTRABLE( SandBlockItemType )
-
-protected:
-    SandBlockItemType();
-};
-REGISTER( SandBlockItemType, ItemType )
-
-// Oak Wood
-class OakBlockType : public BasicBlockType
-{
-    REGISTRABLE( OakBlockType )
-
-protected:
-    OakBlockType();
-};
-REGISTER( OakBlockType, BlockType )
-
-class OakBlockItemType : public BasicBlockItemType
-{
-    REGISTRABLE( OakBlockItemType )
-
-protected:
-    OakBlockItemType();
-};
-REGISTER( OakBlockItemType, ItemType )
-
-// Leaves
-class LeavesBlockType : public BasicBlockType
-{
-    REGISTRABLE( LeavesBlockType )
-
-protected:
-    LeavesBlockType();
-};
-REGISTER( LeavesBlockType, BlockType )
-
-class LeavesBlockItemType : public BasicBlockItemType
-{
-    REGISTRABLE( LeavesBlockItemType )
-
-protected:
-    LeavesBlockItemType();
-};
-REGISTER( LeavesBlockItemType, ItemType )
-
-// Gravel
-class GravelBlockType : public BasicBlockType
-{
-    REGISTRABLE( GravelBlockType )
-
-protected:
-    GravelBlockType();
-};
-REGISTER( GravelBlockType, BlockType )
-
-class GravelBlockItemType : public BasicBlockItemType
-{
-    REGISTRABLE( GravelBlockItemType )
-
-protected:
-    GravelBlockItemType();
-};
-REGISTER( GravelBlockItemType, ItemType )
-
-// Granite
-class GraniteBlockType : public BasicBlockType
-{
-    REGISTRABLE( GraniteBlockType )
-
-protected:
-    GraniteBlockType();
-};
-REGISTER( GraniteBlockType, BlockType )
-
-class GraniteBlockItemType : public BasicBlockItemType
-{
-    REGISTRABLE( GraniteBlockItemType )
-
-protected:
-    GraniteBlockItemType();
-};
-REGISTER( GraniteBlockItemType, ItemType )
-
-// Cobble
-class CobbleBlockType : public BasicBlockType
-{
-    REGISTRABLE( CobbleBlockType )
-
-protected:
-    CobbleBlockType();
-};
-REGISTER( CobbleBlockType, BlockType )
-
-class CobbleBlockItemType : public BasicBlockItemType
-{
-    REGISTRABLE( CobbleBlockItemType )
-
-protected:
-    CobbleBlockItemType();
-};
-REGISTER( CobbleBlockItemType, ItemType )
-
-// Birch Wood
-class BirchBlockType : public BasicBlockType
-{
-    REGISTRABLE( BirchBlockType )
-
-protected:
-    BirchBlockType();
-};
-REGISTER( BirchBlockType, BlockType )
-
-class BirchBlockItemType : public BasicBlockItemType
-{
-    REGISTRABLE( BirchBlockItemType )
-
-protected:
-    BirchBlockItemType();
-};
-REGISTER( BirchBlockItemType, ItemType )
-
-// Beech Wood
-class BeechBlockType : public BasicBlockType
-{
-    REGISTRABLE( BeechBlockType )
-
-protected:
-    BeechBlockType();
-};
-REGISTER( BeechBlockType, BlockType )
-
-class BeechBlockItemType : public BasicBlockItemType
-{
-    REGISTRABLE( BeechBlockItemType )
-
-protected:
-    BeechBlockItemType();
-};
-REGISTER( BeechBlockItemType, ItemType )
-
-// Basalt
-class BasaltBlockType : public BasicBlockType
-{
-    REGISTRABLE( BasaltBlockType )
-
-protected:
-    BasaltBlockType();
-};
-REGISTER( BasaltBlockType, BlockType )
-
-class BasaltBlockItemType : public BasicBlockItemType
-{
-    REGISTRABLE( BasaltBlockItemType )
-
-protected:
-    BasaltBlockItemType();
-};
-REGISTER( BasaltBlockItemType, ItemType )

+ 31 - 72
FactoryCraft/Block.cpp

@@ -1,30 +1,38 @@
+#include <Textur.h>
+
 #include "Block.h"
-#include "Inventory.h"
 #include "Globals.h"
 
 
-Block::Block(const BlockType* zType, ItemType* zTool, Framework::Vec3<int> pos, bool hasInventory)
-	: Inventory(pos, hasInventory),
-	Model3D(),
-	zType(zType)
+Block::Block(const BlockType* zType, Framework::Vec3<int> pos, Model3DData* model, Model3DTextur* texture, int maxHP)
+	: Model3D(),
+	zType(zType),
+	location(pos),
+	maxHP((float)maxHP)
 {
-	transparent = false;
-	passable = false;
-	hp = 1;
-	maxHP = 1;
-	hardness = 1;
-	this->zTool = zTool;
-	speedModifier = 1;
+	transparent = 0;
+	hp = maxHP;
 	memset(sideVisible, 1, 6);
 	Model3D::setPosition((Framework::Vec3<float>)pos + Framework::Vec3<float>{0.5f, 0.5f, 0.5f});
+	setModelDaten(model);
+	setModelTextur(texture);
+	breakTextur = uiFactory.initParam.bildschirm->zGraphicsApi()->createOrGetTextur("blocks.ltdb/crack.png", 0);
 }
 
 Block::~Block()
-{}
+{
+	breakTextur->release();
+}
 
 void Block::api(char* message)
 {
 	// TODO: implement api
+	switch (message[0])
+	{
+	case 0: // hp change
+		hp = *(float*)(message + 1);
+		break;
+	}
 }
 
 bool Block::isTransparent() const
@@ -32,78 +40,29 @@ bool Block::isTransparent() const
 	return transparent;
 }
 
-bool Block::isPassable() const
-{
-	return passable;
-}
-
 void Block::setSideVisible(Direction dir, bool visible)
 {
 	sideVisible[getDirectionIndex(dir)] = visible;
 }
 
-const BlockType* Block::zBlockType() const
+Vec3<int> Block::getLocation() const
 {
-	return zType;
+	return location;
 }
 
-
-BasicBlockItem::BasicBlockItem(const ItemType* zType, const char* name)
-	: Item(zType, name)
-{
-	placeable = 1;
-	transparent = 0;
-	passable = 0;
-	hp = 0;
-	maxHP = 0;
-	hardness = 0;
-	toolId = 0;
-	speedModifier = 0;
-	interactable = 0;
-}
-
-
-BasicBlockItemType::BasicBlockItemType(int id, const char* name, const char* texturPath)
-	: ItemType(id, name),
-	name(name),
-	texturPath(texturPath)
-{}
-
-void BasicBlockItemType::loadSuperItem(Item* zItem, Framework::StreamReader* zReader) const
-{
-	ItemType::loadSuperItem(zItem, zReader);
-	BasicBlockItem* item = dynamic_cast<BasicBlockItem*>(zItem);
-	if (!item)
-		throw "BasicBlockItemType::loadSuperItem was called with an invalid item";
-	zReader->lese((char*)&item->transparent, 1);
-	zReader->lese((char*)&item->passable, 1);
-	zReader->lese((char*)&item->hp, 4);
-	zReader->lese((char*)&item->maxHP, 4);
-	zReader->lese((char*)&item->hardness, 4);
-	zReader->lese((char*)&item->toolId, 4);
-	zReader->lese((char*)&item->speedModifier, 4);
-	zReader->lese((char*)&item->interactable, 1);
-}
-
-Framework::Model3DData* BasicBlockItemType::getItemModel() const
+const BlockType* Block::zBlockType() const
 {
-	return uiFactory.initParam.bildschirm->zGraphicsApi()->getModel("itemCube");
+	return zType;
 }
 
-Item* BasicBlockItemType::createItem() const
+Textur* Block::zEffectTextur()
 {
-	return new BasicBlockItem(this, name);
+	if (hp < maxHP)
+		return breakTextur;
+	return 0;
 }
 
-Framework::Model3DTextur* BasicBlockItemType::getItemTextur() const
+float Block::getEffectPercentage()
 {
-	Model3DTextur* textur = new Model3DTextur();
-	Textur* tex = uiFactory.initParam.bildschirm->zGraphicsApi()->createOrGetTextur(texturPath, 0);
-	textur->setPolygonTextur(0, dynamic_cast<Textur*>(tex->getThis()));
-	textur->setPolygonTextur(1, dynamic_cast<Textur*>(tex->getThis()));
-	textur->setPolygonTextur(2, dynamic_cast<Textur*>(tex->getThis()));
-	textur->setPolygonTextur(3, dynamic_cast<Textur*>(tex->getThis()));
-	textur->setPolygonTextur(4, dynamic_cast<Textur*>(tex->getThis()));
-	textur->setPolygonTextur(5, tex);
-	return textur;
+	return 1 - hp / maxHP;
 }

+ 8 - 46
FactoryCraft/Block.h

@@ -2,75 +2,37 @@
 
 #include <Model3D.h>
 
-#include "Inventory.h"
 #include "BlockType.h"
 #include "Registries.h"
+#include "Area.h"
 
 using namespace Framework;
 
-#define CONST_BLOCK(maybeBlock, type) (maybeBlock ? maybeBlock : STATIC_REGISTRY( BlockType ).zElement((int)type)->zDefault())
-
 class BasicBlockItemType;
 class Chunk;
 
-class Block : public Model3D, public Inventory
+class Block : public Model3D
 {
 protected:
 	bool transparent;
-	bool passable;
 	float hp;
 	float maxHP;
-	float hardness;
-	float speedModifier;
 	const BlockType* zType;
-	ItemType* zTool;
 	bool sideVisible[6];
+	Vec3<int> location;
+	Framework::Textur* breakTextur;
 
 public:
-	Block(const BlockType* zType, ItemType* zTool, Vec3<int> position, bool hasInventory);
+	Block(const BlockType* zType, Vec3<int> position, Model3DData* model, Model3DTextur* texture, int maxHp);
 	virtual ~Block();
 
 	void api(char* message);
 	bool isTransparent() const;
-	bool isPassable() const;
 	void setSideVisible(Direction dir, bool visible);
 
+	Vec3<int> getLocation() const;
 	const BlockType* zBlockType() const;
+	Textur* zEffectTextur() override;
+	float getEffectPercentage() override;
 	friend Chunk;
-	friend BlockType;
-};
-
-class BasicBlockItem : public Item
-{
-protected:
-	bool transparent;
-	bool passable;
-	float hp;
-	float maxHP;
-	float hardness;
-	int toolId;
-	float speedModifier;
-	bool interactable;
-
-public:
-	BasicBlockItem(const ItemType* zType, const char* name);
-
-	friend BasicBlockItemType;
-	friend BlockType;
-};
-
-class BasicBlockItemType : public ItemType
-{
-private:
-	const char* name;
-	const char* texturPath;
-
-protected:
-	BasicBlockItemType(int id, const char* name, const char* texturPath);
-	virtual void loadSuperItem(Item* zItem, Framework::StreamReader* zReader) const override;
-
-public:
-	virtual Framework::Model3DData* getItemModel() const override;
-	virtual Framework::Model3DTextur* getItemTextur() const override;
-	virtual Item* createItem() const override;
 };

+ 0 - 50
FactoryCraft/BlockChangedUpdate.cpp

@@ -1,50 +0,0 @@
-#include "BlockChangedUpdate.h"
-#include <Vec3.h>
-#include "Globals.h"
-#include "Registries.h"
-
-BlockChangedUpdateType::BlockChangedUpdateType()
-    : WorldUpdateType( ID )
-{}
-
-void BlockChangedUpdateType::applyUpdate( Framework::StreamReader* zReader )
-{
-    int dimension = 0;
-    zReader->lese( (char*)&dimension, 4 );
-    Framework::Vec3<int> pos;
-    zReader->lese( (char*)&pos.x, 4 );
-    zReader->lese( (char*)&pos.y, 4 );
-    zReader->lese( (char*)&pos.z, 4 );
-    unsigned short id;
-    zReader->lese( (char*)&id, 2 );
-    if( id )
-    {
-        bool d = 1;
-        zReader->lese( (char*)&d, 1 );
-        Block* b = currentGame->zBlockAt( pos, dimension );
-        if( !d )
-        {
-            if( !b || b->zBlockType()->getId() != id )
-            {
-                if( STATIC_REGISTRY( BlockType ).zElement( id )->needsInstance() )
-                {
-                    b = STATIC_REGISTRY( BlockType ).zElement( id )->createBlock( pos );
-                    currentGame->zDimension( dimension )->setBlock( b );
-                }
-                else if( b )
-                    currentGame->zDimension( dimension )->removeBlock( b );
-            }
-        }
-        else
-        {
-            if( b )
-                STATIC_REGISTRY( BlockType ).zElement( id )->updateBlock( b, zReader );
-            else
-            {
-                b = STATIC_REGISTRY( BlockType ).zElement( id )->createBlock( pos );
-                STATIC_REGISTRY( BlockType ).zElement( id )->updateBlock( b, zReader );
-                currentGame->zDimension( dimension )->setBlock( b );
-            }
-        }
-    }
-}

+ 0 - 14
FactoryCraft/BlockChangedUpdate.h

@@ -1,14 +0,0 @@
-#pragma once
-
-#include "WorldUpdate.h"
-
-class BlockChangedUpdateType : WorldUpdateType
-{
-    REGISTRABLE( BlockChangedUpdateType )
-
-protected:
-    BlockChangedUpdateType();
-    void applyUpdate( Framework::StreamReader* zReader ) override;
-};
-
-REGISTER( BlockChangedUpdateType, WorldUpdateType )

+ 9 - 12
FactoryCraft/BlockRemovedUpdate.cpp

@@ -3,19 +3,16 @@
 #include "Game.h"
 
 BlockRemovedUpdateType::BlockRemovedUpdateType()
-    : WorldUpdateType( ID )
+	: WorldUpdateType(ID)
 {}
 
-void BlockRemovedUpdateType::applyUpdate( Framework::StreamReader* zReader )
+void BlockRemovedUpdateType::applyUpdate(Framework::StreamReader* zReader)
 {
-    int dimension = 0;
-    zReader->lese( (char*)&dimension, 4 );
-    Framework::Vec3<int> pos;
-    zReader->lese( (char*)&pos.x, 4 );
-    zReader->lese( (char*)&pos.y, 4 );
-    zReader->lese( (char*)&pos.z, 4 );
-    Dimension* d = currentGame->zDimension( dimension );
-    Block* b = d->zBlock( pos );
-    if( b )
-        d->removeBlock( b );
+	Framework::Vec3<int> pos;
+	zReader->lese((char*)&pos.x, 4);
+	zReader->lese((char*)&pos.y, 4);
+	zReader->lese((char*)&pos.z, 4);
+	Block* b = currentGame->zBlockAt(pos);
+	if (b)
+		currentGame->zDimension()->removeBlock(b);
 }

+ 4 - 4
FactoryCraft/BlockRemovedUpdate.h

@@ -4,11 +4,11 @@
 
 class BlockRemovedUpdateType : WorldUpdateType
 {
-    REGISTRABLE( BlockRemovedUpdateType )
+	REGISTRABLE(BlockRemovedUpdateType)
 
 protected:
-    BlockRemovedUpdateType();
-    void applyUpdate( Framework::StreamReader* zReader ) override;
+	BlockRemovedUpdateType();
+	void applyUpdate(Framework::StreamReader* zReader) override;
 };
 
-REGISTER( BlockRemovedUpdateType, WorldUpdateType )
+REGISTER(BlockRemovedUpdateType, WorldUpdateType)

+ 13 - 42
FactoryCraft/BlockType.cpp

@@ -5,57 +5,28 @@
 
 using namespace Framework;
 
-BlockType::BlockType( int id )
-    : ReferenceCounter(),
-    id( id ),
-    defaultBlock( 0 )
-{
-    STATIC_REGISTRY( BlockType ).registerT( this, id );
-}
+BlockType::BlockType(int id, bool needsInstance, ModelInfo model, int initialMaxHP)
+	: ReferenceCounter(),
+	id(id),
+	needsInstance(needsInstance),
+	model(model),
+	initialMaxHP(initialMaxHP)
+{}
 
 BlockType::~BlockType()
-{
-    if( defaultBlock )
-        defaultBlock->release();
-}
-
-void BlockType::loadSuperBlock( Block* zBlock, Framework::StreamReader* zReader )
-{
-    zBlock->loadInventory( zReader );
-    zReader->lese( (char*)&zBlock->transparent, 1 );
-    zReader->lese( (char*)&zBlock->passable, 1 );
-    zReader->lese( (char*)&zBlock->hp, 4 );
-    zReader->lese( (char*)&zBlock->maxHP, 4 );
-    zReader->lese( (char*)&zBlock->hardness, 4 );
-    zReader->lese( (char*)&zBlock->speedModifier, 4 );
-    int effectiveToolId;
-    zReader->lese( (char*)&effectiveToolId, 4 );
-    if( effectiveToolId >= 0 )
-        zBlock->zTool = STATIC_REGISTRY( ItemType ).zElement( effectiveToolId );
-    else
-        zBlock->zTool = 0;
-}
-
-Block* BlockType::loadBlock( Framework::Vec3<int> position, Framework::StreamReader* zReader )
-{
-    Block* result = createBlock( position );
-    loadSuperBlock( result, zReader );
-    return result;
-}
+{}
 
-void BlockType::updateBlock( Block* zBlock, Framework::StreamReader* zReader )
+Block* BlockType::createBlock(Framework::Vec3<int> position)
 {
-    loadSuperBlock( zBlock, zReader );
+	return new Block(this, position, model.getModel(), model.getTexture(), initialMaxHP);
 }
 
 int BlockType::getId() const
 {
-    return id;
+	return id;
 }
 
-const Block* BlockType::zDefault()
+bool BlockType::doesNeedInstance() const
 {
-    if( !defaultBlock )
-        defaultBlock = createBlock( { 0, 0, 0 } );
-    return defaultBlock;
+	return needsInstance;
 }

+ 10 - 15
FactoryCraft/BlockType.h

@@ -5,28 +5,23 @@
 #include <Vec3.h>
 
 #include "StaticRegistry.h"
+#include "ModelInfo.h"
 
 class Block;
 
 class BlockType : public virtual Framework::ReferenceCounter
 {
 private:
-    const int id;
-    Block* defaultBlock;
-
-protected:
-    BlockType( int id );
-    virtual ~BlockType();
-
-    virtual void loadSuperBlock( Block* zBlock, Framework::StreamReader* zReader );
-    virtual void initializeSuperBlock( Block* zBlock ) = 0;
+	const int id;
+	bool needsInstance;
+	int initialMaxHP;
+	ModelInfo model;
 
 public:
-    virtual Block* createBlock( Framework::Vec3<int> position ) = 0;
-    virtual Block* loadBlock( Framework::Vec3<int> position, Framework::StreamReader* zReader );
-    virtual void updateBlock( Block* zBlock, Framework::StreamReader* zReader );
-    virtual const Block* zDefault();
-    virtual bool needsInstance() const = 0;
+	BlockType(int id, bool needsInstance, ModelInfo model, int initialMaxHP);
+	~BlockType();
+	Block* createBlock(Framework::Vec3<int> position);
+	bool doesNeedInstance() const;
 
-    int getId() const;
+	int getId() const;
 };

+ 6 - 20
FactoryCraft/Chunk.cpp

@@ -5,15 +5,14 @@
 #include "Registries.h"
 
 
-Chunk::Chunk(Framework::Punkt location, int dimensionId)
+Chunk::Chunk(Framework::Punkt location)
 	: ReferenceCounter(),
-	dimensionId(dimensionId),
 	location(location),
 	isLoading(0)
 {}
 
-Chunk::Chunk(Framework::Punkt location, int dimensionId, Framework::StreamReader* zReader)
-	: Chunk(location, dimensionId)
+Chunk::Chunk(Framework::Punkt location, Framework::StreamReader* zReader)
+	: Chunk(location)
 {
 	load(zReader);
 }
@@ -90,27 +89,14 @@ void Chunk::load(Framework::StreamReader* zReader)
 		zReader->lese((char*)&pos.x, 4);
 		zReader->lese((char*)&pos.y, 4);
 		zReader->lese((char*)&pos.z, 4);
-		bool d;
-		zReader->lese((char*)&d, 1);
-		if (d)
-		{
-			Block* block = STATIC_REGISTRY(BlockType).zElement(id)->loadBlock({ pos.x + location.x - CHUNK_SIZE / 2, pos.y + location.y - CHUNK_SIZE / 2, pos.z }, zReader);
-			if (block)
-				setBlock(block);
-		}
-		else if (STATIC_REGISTRY(BlockType).zElement(id)->needsInstance())
-			setBlock(STATIC_REGISTRY(BlockType).zElement(id)->createBlock({ pos.x + location.x - CHUNK_SIZE / 2, pos.y + location.y - CHUNK_SIZE / 2, pos.z }));
+		if (blockTypes[id]->doesNeedInstance())
+			setBlock(blockTypes[id]->createBlock({ pos.x + location.x - CHUNK_SIZE / 2, pos.y + location.y - CHUNK_SIZE / 2, pos.z }));
 		zReader->lese((char*)&id, 2);
 	}
 	isLoading = 0;
 	updateVisibility();
 }
 
-int Chunk::getDimensionId() const
-{
-	return dimensionId;
-}
-
 Framework::Punkt Chunk::getCenter() const
 {
 	return location;
@@ -143,7 +129,7 @@ void Chunk::updateVisibility()
 		for (int i = 0; i < 6; i++)
 		{
 			Block* c = zBlockAt(pos + getDirection(getDirectionFromIndex(i)));
-			b->setSideVisible(getDirectionFromIndex(i), !c || c->isTransparent() || c->isPassable());
+			b->setSideVisible(getDirectionFromIndex(i), !c || c->isTransparent());
 		}
 	}
 	cs.unlock();

+ 2 - 4
FactoryCraft/Chunk.h

@@ -13,22 +13,20 @@
 class Chunk : public Framework::Model3DCollection
 {
 private:
-	int dimensionId;
 	Framework::Punkt location;
 	Framework::RCArray<Block> blocks;
 	bool isLoading;
 	Framework::Critical cs;
 
 public:
-	Chunk(Framework::Punkt location, int dimensionId);
-	Chunk(Framework::Punkt location, int dimensionId, Framework::StreamReader* zReader);
+	Chunk(Framework::Punkt location);
+	Chunk(Framework::Punkt location, Framework::StreamReader* zReader);
 	~Chunk();
 	void api(char* message);
 	Block* zBlockAt(Framework::Vec3<int> cLocation);
 	void setBlock(Block* block);
 	void removeBlock(Block* zBlock);
 	void load(Framework::StreamReader* zReader);
-	int getDimensionId() const;
 	Framework::Punkt getCenter() const;
 	Framework::Vec3<int> getMin() const;
 	Framework::Vec3<int> getMax() const;

+ 1 - 1
FactoryCraft/Dialog.h

@@ -13,7 +13,7 @@ private:
 	std::function<void(UIMLDialog* self)> onClose;
 
 public:
-	UIMLDialog(Framework::Text uiml, std::function<void(UIMLDialog *self)> onClose);
+	UIMLDialog(Framework::Text uiml, std::function<void(UIMLDialog* self)> onClose);
 	~UIMLDialog();
 	void api(char* message) override;
 	const Framework::Text& getName() const;

+ 2 - 8
FactoryCraft/Dimension.cpp

@@ -9,9 +9,8 @@ using namespace Framework;
 
 #define MAX_VIEW_DISTANCE CHUNK_SIZE * 8
 
-Dimension::Dimension(int id)
-	: dimensionId(id),
-	chunks(new Trie<Chunk>()),
+Dimension::Dimension()
+	: chunks(new Trie<Chunk>()),
 	entities(new RCArray<Entity>())
 {}
 
@@ -138,11 +137,6 @@ void Dimension::setChunk(Chunk* chunk, Punkt center, World* zWorld)
 	cs.unlock();
 }
 
-int Dimension::getDimensionId() const
-{
-	return dimensionId;
-}
-
 bool Dimension::hasChunck(int x, int y) const
 {
 	return zChunk(Punkt(x, y));

+ 1 - 3
FactoryCraft/Dimension.h

@@ -12,7 +12,6 @@ class World;
 class Dimension : public virtual Framework::ReferenceCounter
 {
 private:
-	int dimensionId;
 	Framework::Trie<Chunk>* chunks;
 	Framework::Array<Chunk*> chunkList;
 	Framework::RCArray<Entity>* entities;
@@ -21,7 +20,7 @@ private:
 	void getAddrOfWorld(Framework::Punkt wPos, char* addr) const;
 
 public:
-	Dimension(int id);
+	Dimension();
 	~Dimension();
 
 	void api(char* message);
@@ -29,7 +28,6 @@ public:
 	Block* getBlock(Framework::Vec3<int> location);
 	void addEntity(Entity* entity);
 	void setChunk(Chunk* chunk, Framework::Punkt center, World* zWorld);
-	int getDimensionId() const;
 	bool hasChunck(int x, int y) const;
 	Chunk* zChunk(Framework::Punkt wPos) const;
 	void removeDistantChunks(Framework::Punkt wPos, World* zWorld);

+ 30 - 29
FactoryCraft/DirectConnect.cpp

@@ -2,34 +2,35 @@
 #include "Initialisierung.h"
 #include "Globals.h"
 
-DirectConnect::DirectConnect( Bildschirm* zScreen )
-    : Menu( zScreen )
+DirectConnect::DirectConnect(Bildschirm* zScreen)
+	: Menu(zScreen)
 {
-    elements.add( initTextFeld( 10, 10, 90, 20, TextFeld::Style::Text, "Adresse: " ) );
-    elements.add( initTextFeld( 10, 35, 90, 20, TextFeld::Style::Text, "Port: " ) );
-    address = initTextFeld( 100, 10, 200, 20, TextFeld::Style::TextFeld, "koljastrohm-games.com" );
-    port = initTextFeld( 100, 35, 200, 20, TextFeld::Style::TextFeld, "5425" );
-    port->setTastaturEreignis( _nurNummernTE );
-    elements.add( address );
-    elements.add( port );
-    Knopf* login = initKnopf( 200, 60, 100, 20, Knopf::Style::Normal, "Beitreten" );
-    login->setMausEreignis( [this, login, zScreen]( void* p, void* o, MausEreignis me ) {
-        if( me.id == ME_RLinks )
-        {
-            login->removeStyle( Knopf::Style::Erlaubt );
-            address->removeStyle( TextFeld::Style::Erlaubt );
-            port->removeStyle( TextFeld::Style::Erlaubt );
-            if( network->connect( address->zText()->getText(), (short)(int)*port->zText() ) )
-            {
-                currentGame = new World( dynamic_cast<Bildschirm3D*>(zScreen) );
-                hide();
-                menuRegister->get( "game" )->show();
-            }
-            address->addStyle( TextFeld::Style::Erlaubt );
-            port->addStyle( TextFeld::Style::Erlaubt );
-            login->addStyle( Knopf::Style::Erlaubt );
-        }
-        return 1;
-    } );
-    elements.add( login );
+	elements.add(initTextFeld(10, 10, 90, 20, TextFeld::Style::Text, "Adresse: "));
+	elements.add(initTextFeld(10, 35, 90, 20, TextFeld::Style::Text, "Port: "));
+	address = initTextFeld(100, 10, 200, 20, TextFeld::Style::TextFeld, "koljastrohm-games.com");
+	port = initTextFeld(100, 35, 200, 20, TextFeld::Style::TextFeld, "5425");
+	port->setTastaturEreignis(_nurNummernTE);
+	elements.add(address);
+	elements.add(port);
+	Knopf* login = initKnopf(200, 60, 100, 20, Knopf::Style::Normal, "Beitreten");
+	login->setMausEreignis([this, login, zScreen](void* p, void* o, MausEreignis me)
+		{
+			if (me.id == ME_RLinks)
+			{
+				login->removeStyle(Knopf::Style::Erlaubt);
+				address->removeStyle(TextFeld::Style::Erlaubt);
+				port->removeStyle(TextFeld::Style::Erlaubt);
+				if (network->connect(address->zText()->getText(), (short)(int)*port->zText()))
+				{
+					currentGame = new World(dynamic_cast<Bildschirm3D*>(zScreen));
+					hide();
+					menuRegister->get("game")->show();
+				}
+				address->addStyle(TextFeld::Style::Erlaubt);
+				port->addStyle(TextFeld::Style::Erlaubt);
+				login->addStyle(Knopf::Style::Erlaubt);
+			}
+			return 1;
+		});
+	elements.add(login);
 }

+ 3 - 3
FactoryCraft/DirectConnect.h

@@ -6,9 +6,9 @@
 class DirectConnect : public Menu
 {
 private:
-    TextFeld* address;
-    TextFeld* port;
+	TextFeld* address;
+	TextFeld* port;
 
 public:
-    DirectConnect( Bildschirm* zScreen );
+	DirectConnect(Bildschirm* zScreen);
 };

+ 22 - 89
FactoryCraft/Entity.cpp

@@ -1,100 +1,38 @@
 #include "Entity.h"
 #include "Globals.h"
 
-ActionTarget::ActionTarget(Framework::Vec3<int> blockPos, Direction blockSide)
-	: blockPos(blockPos),
-	targetBlockSide(blockSide),
-	entityId(-1)
-{}
-
-ActionTarget::ActionTarget(int entityId)
-	: entityId(entityId)
-{}
 
-ActionTarget* ActionTarget::load(Framework::StreamReader* zReader)
+Entity::Entity(const EntityType* zType, Framework::Model3DData* model, Framework::Model3DTextur* texture, int id)
+	: Model3D(), id(id), zType(zType)
 {
-	char b;
-	zReader->lese(&b, 1);
-	if (b == 1)
-	{
-		int id;
-		zReader->lese((char*)&id, 4);
-		return new ActionTarget(id);
-	}
-	else if (b == 2)
-	{
-		Framework::Vec3<int> pos;
-		Direction side;
-		zReader->lese((char*)&pos.x, 4);
-		zReader->lese((char*)&pos.y, 4);
-		zReader->lese((char*)&pos.z, 4);
-		zReader->lese((char*)&side, 4);
-		return new ActionTarget(pos, side);
-	}
-	return 0;
+	setModelDaten(model);
+	setModelTextur(texture);
 }
 
-bool ActionTarget::isBlock() const
-{
-	return entityId == -1;
-}
-
-bool ActionTarget::isEntity() const
-{
-	return entityId >= 0;
-}
-
-int ActionTarget::getEntityId() const
-{
-	return entityId;
-}
-
-Framework::Vec3<int> ActionTarget::getBlockPos() const
-{
-	return blockPos;
-}
-
-Direction ActionTarget::getBlockSide() const
-{
-	return targetBlockSide;
-}
-
-Framework::Either<Block*, Entity*> ActionTarget::zTarget(int dimension) const
-{
-	if (entityId >= 0)
-		return currentGame->zEntity(entityId);
-	else
-		return currentGame->zBlockAt(blockPos, dimension);
-}
-
-Framework::Either<Block*, Entity*> ActionTarget::getTarget(int dimension) const
-{
-	if (entityId >= 0)
-		return currentGame->getEntity(entityId);
-	else
-		return currentGame->getBlockAt(blockPos, dimension);
-}
-
-
-Entity::Entity(const EntityType* zType, bool hasInventory)
-	: Model3D(), Inventory({ 0.f, 0.f, 0.f }, hasInventory), zEntityType(zType), target(0)
-{}
-
 Entity::~Entity()
-{
-	if (target)
-		delete target;
-}
+{}
 
 void Entity::api(char* message)
 {
-	// TODO: implement api
+	switch (message[0])
+	{
+	case 0:
+	{ // update position
+		pos.x = *(float*)(message + 1);
+		pos.y = *(float*)(message + 5);
+		pos.z = *(float*)(message + 9);
+		break;
+	}
+	case 1:
+	{ // update rotation
+		// TODO
+		break;
+	}
+	}
 }
 
 bool Entity::tick(double time)
 {
-	setPosition(location);
-	// TODO: calculate rotation based on faceDir
 	return Model3D::tick(time);
 }
 
@@ -103,14 +41,9 @@ int Entity::getId() const
 	return id;
 }
 
-const EntityType* Entity::zType() const
-{
-	return zEntityType;
-}
-
-int Entity::getCurrentDimension() const
+const EntityType* Entity::zEntityType() const
 {
-	return currentDimensionId;
+	return zType;
 }
 
 void Entity::lock()

+ 7 - 45
FactoryCraft/Entity.h

@@ -3,66 +3,28 @@
 #include <Model3D.h>
 #include <Either.h>
 #include <Critical.h>
+
 #include "EntityType.h"
-#include "Inventory.h"
+#include "Area.h"
 
 class Block;
 
-class ActionTarget
+class Entity : public Framework::Model3D
 {
 private:
-	Framework::Vec3<int> blockPos;
-	Direction targetBlockSide;
-	int entityId;
-
-public:
-	ActionTarget(Framework::Vec3<int> blockPos, Direction blockSide);
-	ActionTarget(int entityId);
-
-	static ActionTarget* load(Framework::StreamReader* zReader);
-
-	bool isBlock() const;
-	bool isEntity() const;
-	int getEntityId() const;
-	Framework::Vec3<int> getBlockPos() const;
-	Direction getBlockSide() const;
-	Framework::Either<Block*, Entity*> zTarget(int dimensionId) const;
-	Framework::Either<Block*, Entity*> getTarget(int dimensionId) const;
-};
-
-class Entity : public Framework::Model3D, public Inventory
-{
-protected:
-	float maxHP;
-	float currentHP;
-	float stamina;
-	float maxStamina;
-	float hunger;
-	float maxHunger;
-	float thirst;
-	float maxThirst;
-	float targetDistanceLimit;
-	Framework::Vec3<float> speed;
-	Framework::Vec3<float> faceDir;
-	const EntityType* zEntityType;
-	int currentDimensionId;
-	float gravityMultiplier;
 	int id;
-	ActionTarget* target;
+	const EntityType* zType;
 	Framework::Critical cs;
 
 public:
-	Entity(const EntityType* zType, bool hasInventory);
+	Entity(const EntityType* zType, Framework::Model3DData* model, Framework::Model3DTextur* texture, int id);
 	~Entity();
 
 	void api(char* message);
-	virtual bool tick(double time) override;
+	bool tick(double time) override;
 
 	int getId() const;
-	const EntityType* zType() const;
-	int getCurrentDimension() const;
+	const EntityType* zEntityType() const;
 	void lock();
 	void unlock();
-
-	friend EntityType;
 };

+ 0 - 31
FactoryCraft/EntityChangedUpdate.cpp

@@ -1,31 +0,0 @@
-#include "EntityChangedUpdate.h"
-#include "Globals.h"
-#include "Registries.h"
-
-
-EntityChangedUpdateType::EntityChangedUpdateType()
-    : WorldUpdateType( ID )
-{}
-
-void EntityChangedUpdateType::applyUpdate( Framework::StreamReader* zReader )
-{
-    int id;
-    int type;
-    zReader->lese( (char*)&id, 4 );
-    if( id >= 0 )
-    {
-        zReader->lese( (char*)&type, 4 );
-        Entity* e = currentGame->zEntity( id );
-        if( !e )
-        {
-            e = STATIC_REGISTRY( EntityType ).zElement( type )->loadEntity( zReader );
-            currentGame->zDimensionOrCreate( e->getCurrentDimension() )->addEntity( e );
-        }
-        else
-        {
-            e->lock();
-            STATIC_REGISTRY( EntityType ).zElement( type )->updateEntity( e, zReader );
-            e->unlock();
-        }
-    }
-}

+ 0 - 14
FactoryCraft/EntityChangedUpdate.h

@@ -1,14 +0,0 @@
-#pragma once
-
-#include "WorldUpdate.h"
-
-class EntityChangedUpdateType : WorldUpdateType
-{
-    REGISTRABLE( EntityChangedUpdateType )
-
-protected:
-    EntityChangedUpdateType();
-    void applyUpdate( Framework::StreamReader* zReader ) override;
-};
-
-REGISTER( EntityChangedUpdateType, WorldUpdateType )

+ 5 - 5
FactoryCraft/EntityRemovedUpdate.cpp

@@ -3,12 +3,12 @@
 
 
 EntityRemovedUpdateType::EntityRemovedUpdateType()
-    : WorldUpdateType( ID )
+	: WorldUpdateType(ID)
 {}
 
-void EntityRemovedUpdateType::applyUpdate( Framework::StreamReader* zReader )
+void EntityRemovedUpdateType::applyUpdate(Framework::StreamReader* zReader)
 {
-    int id;
-    zReader->lese( (char*)&id, 4 );
-    currentGame->removeEntity( id );
+	int id;
+	zReader->lese((char*)&id, 4);
+	currentGame->removeEntity(id);
 }

+ 4 - 4
FactoryCraft/EntityRemovedUpdate.h

@@ -4,11 +4,11 @@
 
 class EntityRemovedUpdateType : WorldUpdateType
 {
-    REGISTRABLE( EntityRemovedUpdateType )
+	REGISTRABLE(EntityRemovedUpdateType)
 
 protected:
-    EntityRemovedUpdateType();
-    void applyUpdate( Framework::StreamReader* zReader ) override;
+	EntityRemovedUpdateType();
+	void applyUpdate(Framework::StreamReader* zReader) override;
 };
 
-REGISTER( EntityRemovedUpdateType, WorldUpdateType )
+REGISTER(EntityRemovedUpdateType, WorldUpdateType)

+ 19 - 44
FactoryCraft/EntityType.cpp

@@ -3,55 +3,30 @@
 #include "Registries.h"
 
 
-EntityType::EntityType( int id )
-    : id( id )
-{
-    STATIC_REGISTRY( EntityType ).registerT( this, id );
-}
-
-void EntityType::loadSuperEntity( Entity* zEntity, Framework::StreamReader* zReader ) const
-{
-    zEntity->loadInventory( zReader );
-    zReader->lese( (char*)&zEntity->id, 4 );
-    zReader->lese( (char*)&zEntity->maxHP, 4 );
-    zReader->lese( (char*)&zEntity->currentHP, 4 );
-    zReader->lese( (char*)&zEntity->stamina, 4 );
-    zReader->lese( (char*)&zEntity->maxStamina, 4 );
-    zReader->lese( (char*)&zEntity->hunger, 4 );
-    zReader->lese( (char*)&zEntity->maxHunger, 4 );
-    zReader->lese( (char*)&zEntity->thirst, 4 );
-    zReader->lese( (char*)&zEntity->maxThirst, 4 );
-    zReader->lese( (char*)&zEntity->speed.x, 4 );
-    zReader->lese( (char*)&zEntity->speed.y, 4 );
-    zReader->lese( (char*)&zEntity->speed.z, 4 );
-    zReader->lese( (char*)&zEntity->faceDir.x, 4 );
-    zReader->lese( (char*)&zEntity->faceDir.y, 4 );
-    zReader->lese( (char*)&zEntity->currentDimensionId, 4 );
-    zReader->lese( (char*)&zEntity->location.x, 4 );
-    zReader->lese( (char*)&zEntity->location.y, 4 );
-    zReader->lese( (char*)&zEntity->location.z, 4 );
-    if( zEntity->target )
-        delete zEntity->target;
-    zEntity->target = ActionTarget::load( zReader );
-}
-
-void EntityType::createSuperEntity( Entity* zEntity ) const
+EntityType::EntityType(int id, ModelInfo model)
+	: id(id),
+	model(model)
 {}
 
-Entity* EntityType::loadEntity( Framework::StreamReader* zReader ) const
-{
-    Entity* entity = createEntity();
-    createSuperEntity( entity );
-    loadSuperEntity( entity, zReader );
-    return entity;
-}
-
-void EntityType::updateEntity( Entity* e, Framework::StreamReader* zReader ) const
+Entity* EntityType::loadEntity(Framework::StreamReader* zReader) const
 {
-    loadSuperEntity( e, zReader );
+	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);
+	bool specialModel = 0;
+	zReader->lese((char*)&specialModel, 1);
+	if (specialModel)
+	{
+		ModelInfo model(zReader);
+		return new Entity(this, model.getModel(), model.getTexture(), id);;
+	}
+	return new Entity(this, model.getModel(), model.getTexture(), id);
 }
 
 int EntityType::getId() const
 {
-    return id;
+	return id;
 }

+ 7 - 12
FactoryCraft/EntityType.h

@@ -4,23 +4,18 @@
 #include <Reader.h>
 #include <Vec3.h>
 
+#include "ModelInfo.h"
+
 class Entity;
 
 class EntityType : public virtual Framework::ReferenceCounter
 {
 private:
-    const int id;
-
-protected:
-    EntityType( int id );
-
-    virtual void loadSuperEntity( Entity* zEntity, Framework::StreamReader* zReader ) const;
-    virtual void createSuperEntity( Entity* zEntity ) const;
-    virtual Entity* createEntity() const = 0;
+	const int id;
+	ModelInfo model;
 
 public:
-    virtual Entity* loadEntity( Framework::StreamReader* zReader ) const;
-    virtual void updateEntity( Entity* e, Framework::StreamReader* zReader ) const;
-
-    int getId() const;
+	EntityType(int id, ModelInfo model);
+	Entity* loadEntity(Framework::StreamReader* zReader) const;
+	int getId() const;
 };

+ 75 - 0
FactoryCraft/FactoryClient.cpp

@@ -1,6 +1,11 @@
+#include <Bild.h>
+#include <Textur.h>
+
 #include "FactoryClient.h"
+#include "Globals.h"
 
 using namespace Network;
+using namespace Framework;
 
 FactoryClient::FactoryClient()
 {
@@ -71,6 +76,76 @@ bool FactoryClient::connect(Text ip, short port, int accountId, Text secret)
 		return false;
 	backgroundReader = new NetworkReader(background);
 	client->trenne();
+	// receive type information
+	for (int i = 0; i < blockTypeCount; i++)
+		blockTypes[i]->release();
+	delete[] blockTypes;
+	for (int i = 0; i < itemTypeCount; i++)
+		itemTypes[i]->release();
+	delete[] itemTypes;
+	for (int i = 0; i < entityTypeCount; i++)
+		entityTypes[i]->release();
+	delete[] entityTypes;
+	foregroundReader->lese((char*)&blockTypeCount, 4);
+	blockTypes = new BlockType * [blockTypeCount];
+	for (int i = 0; i < blockTypeCount; i++)
+	{
+		int id;
+		foregroundReader->lese((char*)&id, 4);
+		bool needsInstance;
+		foregroundReader->lese((char*)&needsInstance, 1);
+		int maxHp;
+		foregroundReader->lese((char*)&maxHp, 4);
+		blockTypes[i] = new BlockType(id, needsInstance, ModelInfo(foregroundReader), maxHp);
+	}
+	foregroundReader->lese((char*)&itemTypeCount, 4);
+	itemTypes = new ItemType * [itemTypeCount];
+	for (int i = 0; i < itemTypeCount; i++)
+	{
+		int id;
+		foregroundReader->lese((char*)&id, 4);
+		itemTypes[i] = new ItemType(id, ModelInfo(foregroundReader));
+	}
+	foregroundReader->lese((char*)&entityTypeCount, 4);
+	entityTypes = new EntityType * [entityTypeCount];
+	for (int i = 0; i < entityTypeCount; i++)
+	{
+		int id;
+		foregroundReader->lese((char*)&id, 4);
+		entityTypes[i] = new EntityType(id, ModelInfo(foregroundReader));
+	}
+	// pre rendering item models
+	Kam3D* kam = new Kam3D();
+	Welt3D* w = new Welt3D();
+	w->addDiffuseLight(DiffuseLight{ Vec3<float>(0.5f, 0.5f, -1.f), Vec3<float>(1.f, 1.f, 1.f) });
+	kam->setWelt(w);
+	kam->setBildschirmPosition(0, 0);
+	kam->setBildschirmSize(50, 50);
+	kam->setPosition(Vec3<float>(0, 0, 0));
+	kam->setRotation({ 2.f, 0, -1.f });
+	Bild* b = new Bild();
+	b->neuBild(50, 50, 0);
+	for (int i = 0; i < itemTypeCount; i++)
+	{
+		Model3D* mdl = new Model3D();
+		mdl->setModelDaten(itemTypes[i]->getItemModel());
+		mdl->setModelTextur(itemTypes[i]->getItemTextur());
+		mdl->setPosition(Vec3<float>(-0.8f, -0.45f, -0.4f));
+		mdl->setSize(2.f);
+		w->addZeichnung(mdl);
+		w->tick(0);
+		window->zBildschirm()->lock();
+		DX11Textur* t = (DX11Textur*)window->zBildschirm()->zGraphicsApi()->createOrGetTextur(Text("rendered/items/") + i, dynamic_cast<Bild*>(b->getThis()));
+		window->zBildschirm()->zGraphicsApi()->renderKamera(kam, t);
+		Bild* result = new Bild();
+		t->copyToImage(result);
+		itemIcons->add(result);
+		t->release();
+		window->zBildschirm()->unlock();
+		w->removeZeichnung(mdl);
+	}
+	b->release();
+	kam->release();
 	return true;
 }
 

+ 2 - 20
FactoryCraft/FactoryCraft.vcxproj

@@ -173,9 +173,7 @@ copy "..\..\..\..\..\Allgemein\Network\x64\Release\Network.dll" "network.dll"</C
     <ClCompile Include="AddChunkUpdate.cpp" />
     <ClCompile Include="AddEntityUpdate.cpp" />
     <ClCompile Include="Area.cpp" />
-    <ClCompile Include="BasicBlocks.cpp" />
     <ClCompile Include="Block.cpp" />
-    <ClCompile Include="BlockChangedUpdate.cpp" />
     <ClCompile Include="BlockRemovedUpdate.cpp" />
     <ClCompile Include="BlockType.cpp" />
     <ClCompile Include="Chunk.cpp" />
@@ -184,7 +182,6 @@ copy "..\..\..\..\..\Allgemein\Network\x64\Release\Network.dll" "network.dll"</C
     <ClCompile Include="Dimension.cpp" />
     <ClCompile Include="DirectConnect.cpp" />
     <ClCompile Include="Entity.cpp" />
-    <ClCompile Include="EntityChangedUpdate.cpp" />
     <ClCompile Include="EntityRemovedUpdate.cpp" />
     <ClCompile Include="EntityType.cpp" />
     <ClCompile Include="Equipment.cpp" />
@@ -193,20 +190,14 @@ copy "..\..\..\..\..\Allgemein\Network\x64\Release\Network.dll" "network.dll"</C
     <ClCompile Include="Globals.cpp" />
     <ClCompile Include="Initialisierung.cpp" />
     <ClCompile Include="InventoryView.cpp" />
-    <ClCompile Include="Inventoty.cpp" />
-    <ClCompile Include="Item.cpp" />
-    <ClCompile Include="ItemEntity.cpp" />
-    <ClCompile Include="ItemSlot.cpp" />
-    <ClCompile Include="ItemStack.cpp" />
     <ClCompile Include="ItemType.cpp" />
     <ClCompile Include="Load.cpp" />
     <ClCompile Include="Login.cpp" />
     <ClCompile Include="Main.cpp" />
     <ClCompile Include="Menu.cpp" />
+    <ClCompile Include="ModelInfo.cpp" />
     <ClCompile Include="NetworkHandler.cpp" />
-    <ClCompile Include="NoBlock.cpp" />
     <ClCompile Include="PlaceBlockUpdate.cpp" />
-    <ClCompile Include="Player.cpp" />
     <ClCompile Include="PlayerKam.cpp" />
     <ClCompile Include="StaticInitializerOrder.cpp" />
     <ClCompile Include="World.cpp" />
@@ -215,9 +206,7 @@ copy "..\..\..\..\..\Allgemein\Network\x64\Release\Network.dll" "network.dll"</C
   <ItemGroup>
     <ClInclude Include="AddEntityUpdate.h" />
     <ClInclude Include="Area.h" />
-    <ClInclude Include="BasicBlocks.h" />
     <ClInclude Include="Block.h" />
-    <ClInclude Include="BlockChangedUpdate.h" />
     <ClInclude Include="BlockRemovedUpdate.h" />
     <ClInclude Include="BlockType.h" />
     <ClInclude Include="Chunk.h" />
@@ -227,7 +216,6 @@ copy "..\..\..\..\..\Allgemein\Network\x64\Release\Network.dll" "network.dll"</C
     <ClInclude Include="Dimension.h" />
     <ClInclude Include="DirectConnect.h" />
     <ClInclude Include="Entity.h" />
-    <ClInclude Include="EntityChangedUpdate.h" />
     <ClInclude Include="EntityRemovedUpdate.h" />
     <ClInclude Include="EntityType.h" />
     <ClInclude Include="Equipment.h" />
@@ -236,20 +224,14 @@ copy "..\..\..\..\..\Allgemein\Network\x64\Release\Network.dll" "network.dll"</C
     <ClInclude Include="Globals.h" />
     <ClInclude Include="AddChunkUpdate.h" />
     <ClInclude Include="Initialisierung.h" />
-    <ClInclude Include="Inventory.h" />
     <ClInclude Include="InventoryView.h" />
-    <ClInclude Include="Item.h" />
-    <ClInclude Include="ItemEntity.h" />
-    <ClInclude Include="ItemSlot.h" />
-    <ClInclude Include="ItemStack.h" />
     <ClInclude Include="ItemType.h" />
     <ClInclude Include="Load.h" />
     <ClInclude Include="Login.h" />
     <ClInclude Include="Menu.h" />
+    <ClInclude Include="ModelInfo.h" />
     <ClInclude Include="NetworkHandler.h" />
-    <ClInclude Include="NoBlock.h" />
     <ClInclude Include="PlaceBlockUpdate.h" />
-    <ClInclude Include="Player.h" />
     <ClInclude Include="PlayerKam.h" />
     <ClInclude Include="Registries.h" />
     <ClInclude Include="StaticRegistry.h" />

+ 9 - 66
FactoryCraft/FactoryCraft.vcxproj.filters

@@ -13,9 +13,6 @@
     <Filter Include="inventory">
       <UniqueIdentifier>{dcbc509e-a646-43ea-9b60-9c5e96e3ea34}</UniqueIdentifier>
     </Filter>
-    <Filter Include="world\blocks">
-      <UniqueIdentifier>{3a74980a-cc13-4580-9921-d32b06389e35}</UniqueIdentifier>
-    </Filter>
     <Filter Include="world\view">
       <UniqueIdentifier>{494659c8-0209-497f-9200-86215d7680bf}</UniqueIdentifier>
     </Filter>
@@ -61,24 +58,9 @@
     <ClCompile Include="BlockType.cpp">
       <Filter>world</Filter>
     </ClCompile>
-    <ClCompile Include="Inventoty.cpp">
-      <Filter>inventory</Filter>
-    </ClCompile>
-    <ClCompile Include="Item.cpp">
-      <Filter>inventory</Filter>
-    </ClCompile>
-    <ClCompile Include="ItemSlot.cpp">
-      <Filter>inventory</Filter>
-    </ClCompile>
-    <ClCompile Include="ItemStack.cpp">
-      <Filter>inventory</Filter>
-    </ClCompile>
     <ClCompile Include="ItemType.cpp">
       <Filter>inventory</Filter>
     </ClCompile>
-    <ClCompile Include="BasicBlocks.cpp">
-      <Filter>world\blocks</Filter>
-    </ClCompile>
     <ClCompile Include="Block.cpp">
       <Filter>world</Filter>
     </ClCompile>
@@ -97,9 +79,6 @@
     <ClCompile Include="PlayerKam.cpp">
       <Filter>world\view</Filter>
     </ClCompile>
-    <ClCompile Include="NoBlock.cpp">
-      <Filter>world\blocks</Filter>
-    </ClCompile>
     <ClCompile Include="Game.cpp">
       <Filter>Menu</Filter>
     </ClCompile>
@@ -121,9 +100,6 @@
     <ClCompile Include="Load.cpp">
       <Filter>Menu</Filter>
     </ClCompile>
-    <ClCompile Include="BlockChangedUpdate.cpp">
-      <Filter>world\update</Filter>
-    </ClCompile>
     <ClCompile Include="PlaceBlockUpdate.cpp">
       <Filter>world\update</Filter>
     </ClCompile>
@@ -136,18 +112,9 @@
     <ClCompile Include="Entity.cpp">
       <Filter>Entity</Filter>
     </ClCompile>
-    <ClCompile Include="Player.cpp">
-      <Filter>Entity</Filter>
-    </ClCompile>
     <ClCompile Include="AddEntityUpdate.cpp">
       <Filter>world\update</Filter>
     </ClCompile>
-    <ClCompile Include="ItemEntity.cpp">
-      <Filter>Entity</Filter>
-    </ClCompile>
-    <ClCompile Include="EntityChangedUpdate.cpp">
-      <Filter>world\update</Filter>
-    </ClCompile>
     <ClCompile Include="EntityRemovedUpdate.cpp">
       <Filter>world\update</Filter>
     </ClCompile>
@@ -163,6 +130,9 @@
     <ClCompile Include="CraftingGrid.cpp">
       <Filter>Menu\uiml\inventory</Filter>
     </ClCompile>
+    <ClCompile Include="ModelInfo.cpp">
+      <Filter>static</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Area.h">
@@ -192,30 +162,12 @@
     <ClInclude Include="Initialisierung.h">
       <Filter>static</Filter>
     </ClInclude>
-    <ClInclude Include="StaticRegistry.h">
-      <Filter>static</Filter>
-    </ClInclude>
     <ClInclude Include="BlockType.h">
       <Filter>world</Filter>
     </ClInclude>
-    <ClInclude Include="Inventory.h">
-      <Filter>inventory</Filter>
-    </ClInclude>
-    <ClInclude Include="ItemSlot.h">
-      <Filter>inventory</Filter>
-    </ClInclude>
-    <ClInclude Include="ItemStack.h">
-      <Filter>inventory</Filter>
-    </ClInclude>
-    <ClInclude Include="Item.h">
-      <Filter>inventory</Filter>
-    </ClInclude>
     <ClInclude Include="ItemType.h">
       <Filter>inventory</Filter>
     </ClInclude>
-    <ClInclude Include="BasicBlocks.h">
-      <Filter>world\blocks</Filter>
-    </ClInclude>
     <ClInclude Include="Constants.h">
       <Filter>static</Filter>
     </ClInclude>
@@ -225,9 +177,6 @@
     <ClInclude Include="PlayerKam.h">
       <Filter>world\view</Filter>
     </ClInclude>
-    <ClInclude Include="NoBlock.h">
-      <Filter>world\blocks</Filter>
-    </ClInclude>
     <ClInclude Include="Load.h">
       <Filter>Menu</Filter>
     </ClInclude>
@@ -249,9 +198,6 @@
     <ClInclude Include="FactoryClient.h">
       <Filter>Network</Filter>
     </ClInclude>
-    <ClInclude Include="BlockChangedUpdate.h">
-      <Filter>world\update</Filter>
-    </ClInclude>
     <ClInclude Include="PlaceBlockUpdate.h">
       <Filter>world\update</Filter>
     </ClInclude>
@@ -264,18 +210,9 @@
     <ClInclude Include="EntityType.h">
       <Filter>Entity</Filter>
     </ClInclude>
-    <ClInclude Include="Player.h">
-      <Filter>Entity</Filter>
-    </ClInclude>
     <ClInclude Include="AddEntityUpdate.h">
       <Filter>world\update</Filter>
     </ClInclude>
-    <ClInclude Include="ItemEntity.h">
-      <Filter>Entity</Filter>
-    </ClInclude>
-    <ClInclude Include="EntityChangedUpdate.h">
-      <Filter>world\update</Filter>
-    </ClInclude>
     <ClInclude Include="EntityRemovedUpdate.h">
       <Filter>world\update</Filter>
     </ClInclude>
@@ -291,5 +228,11 @@
     <ClInclude Include="InventoryView.h">
       <Filter>Menu\uiml\inventory</Filter>
     </ClInclude>
+    <ClInclude Include="ModelInfo.h">
+      <Filter>static</Filter>
+    </ClInclude>
+    <ClInclude Include="StaticRegistry.h">
+      <Filter>static</Filter>
+    </ClInclude>
   </ItemGroup>
 </Project>

+ 0 - 37
FactoryCraft/Game.cpp

@@ -33,11 +33,6 @@ Game::Game(Bildschirm* zScreen)
 	elements.add(logout);
 	debug = initTextFeld(10, 40, 500, 40, TextFeld::Style::Text | TextFeld::Style::Mehrzeilig, "");
 	elements.add(debug);
-	invB = new Bild();
-	invB->neuBild(zScreen->getBackBufferSize().x - 20, 50, 0);
-	invB->setAlpha3D(1);
-	inventory = initBildZ(10, zScreen->getBackBufferSize().y - 60, zScreen->getBackBufferSize().x - 20, 50, BildZ::Style::Sichtbar | BildZ::Style::Alpha, invB);
-	elements.add(inventory);
 }
 
 Game::~Game()
@@ -66,38 +61,6 @@ void Game::updatePosition(Vec3<float> position, bool target, Vec3<int> targetPos
 	debug->setText(txt);
 }
 
-void Game::updateInventory(Framework::Array<ItemSlot*>& itemBar, int pos)
-{
-	invB->fillRegion(0, 0, invB->getBreite(), invB->getHeight(), 0);
-	TextRenderer tr;
-	tr.setSchriftZ(dynamic_cast<Schrift*>(uiFactory.initParam.schrift->getThis()));
-	tr.setSchriftSize(12);
-	int index = 0;
-	for (auto slot : itemBar)
-	{
-		if (pos == index)
-		{
-			invB->fillRegion(50 * index, 0, 50, 50, 0x7F202020);
-		}
-		if (slot && slot->zStack() && slot->zStack()->zItem())
-		{
-			Bild* icon = itemIcons->z(slot->zStack()->zItem()->zItemType()->getId());
-			invB->alphaBild(50 * index, 0, 50, 50, *icon);
-			tr.renderText(5 + index * 50, 5, slot->zStack()->zItem()->getName(), *invB, 0xFFFFFFFF);
-			int size = slot->zStack()->getSize();
-			const char* units[] = { "", "K", "M", "G", "T", "P" };
-			int i = 0;
-			for (; i < 6 && size > 1024; i++)
-				size = size / 1024;
-			Text count = size;
-			count += units[i];
-			tr.renderText(45 - tr.getTextBreite(count) + index * 50, 45 - tr.getTextHeight(count), count, *invB, 0xFFFFFFFF);
-		}
-		index++;
-	}
-	inventory->setRender();
-}
-
 void Game::api(char* data)
 {
 	switch (data[0])

+ 0 - 4
FactoryCraft/Game.h

@@ -7,15 +7,12 @@
 #include "Dialog.h"
 
 class Player;
-class ItemSlot;
 
 class Game : public Menu
 {
 private:
 	Framework::Knopf* logout;
 	Framework::TextFeld* debug;
-	Framework::Bild* invB;
-	Framework::BildZ* inventory;
 	Framework::Array<UIMLDialog*> dialogs;
 
 public:
@@ -24,6 +21,5 @@ public:
 	~Game();
 
 	void updatePosition(Vec3<float> position, bool target, Vec3<int> targetPos);
-	void updateInventory(Framework::Array<ItemSlot*>& itemBar, int pos);
 	void api(char* data);
 };

+ 46 - 23
FactoryCraft/Globals.cpp

@@ -9,36 +9,59 @@
 
 void initVariables()
 {
-    dlls = new DLLRegister();
-    menuRegister = new HashMap<Framework::Text, Framework::RCPointer<Menu>>( 10, []( Text txt ) {
-        return txt.hashCode();
-    } );
-    fontRegister = new HashMap<Framework::Text, Framework::RCPointer<Schrift>>( 10, []( Text txt ) {
-        return txt.hashCode();
-    } );
-    network = new NetworkHandler();
-    currentGame = 0;
-    window = 0;
-    itemIcons = new RCArray<Bild>();
+	dlls = new DLLRegister();
+	menuRegister = new HashMap<Framework::Text, Framework::RCPointer<Menu>>(10, [](Text txt)
+		{
+			return txt.hashCode();
+		});
+	fontRegister = new HashMap<Framework::Text, Framework::RCPointer<Schrift>>(10, [](Text txt)
+		{
+			return txt.hashCode();
+		});
+	network = new NetworkHandler();
+	currentGame = 0;
+	window = 0;
+	itemIcons = new RCArray<Bild>();
+	blockTypes = 0;
+	blockTypeCount = 0;
+	itemTypes = 0;
+	itemTypeCount = 0;
+	entityTypes = 0;
+	entityTypeCount = 0;
 }
 
 void initMenus()
 {
-    menuRegister->put( "load", RCPointer<Menu>::of( new LoadMenu( uiFactory.initParam.bildschirm ) ) );
-    menuRegister->put( "login", RCPointer<Menu>::of( new LoginMenu( uiFactory.initParam.bildschirm ) ) );
-    menuRegister->put( "directConnect", RCPointer<Menu>::of( new DirectConnect( uiFactory.initParam.bildschirm ) ) );
-    menuRegister->put( "game", RCPointer<Menu>::of( new Game( uiFactory.initParam.bildschirm ) ) );
+	menuRegister->put("load", RCPointer<Menu>::of(new LoadMenu(uiFactory.initParam.bildschirm)));
+	menuRegister->put("login", RCPointer<Menu>::of(new LoginMenu(uiFactory.initParam.bildschirm)));
+	menuRegister->put("directConnect", RCPointer<Menu>::of(new DirectConnect(uiFactory.initParam.bildschirm)));
+	menuRegister->put("game", RCPointer<Menu>::of(new Game(uiFactory.initParam.bildschirm)));
 
-    menuRegister->get( "load" )->show();
+	menuRegister->get("load")->show();
 }
 
 void releaseVariables()
 {
-    if( currentGame )
-        currentGame->release();
-    menuRegister->release();
-    fontRegister->release();
-    network->release();
-    dlls->release();
-    itemIcons->release();
+	if (currentGame)
+		currentGame->release();
+	menuRegister->release();
+	fontRegister->release();
+	network->release();
+	dlls->release();
+	itemIcons->release();
+	for (int i = 0; i < blockTypeCount; i++)
+		blockTypes[i]->release();
+	delete[] blockTypes;
+	for (int i = 0; i < itemTypeCount; i++)
+		itemTypes[i]->release();
+	delete[] itemTypes;
+	for (int i = 0; i < entityTypeCount; i++)
+		entityTypes[i]->release();
+	delete[] entityTypes;
+	blockTypes = 0;
+	blockTypeCount = 0;
+	itemTypes = 0;
+	itemTypeCount = 0;
+	entityTypes = 0;
+	entityTypeCount = 0;
 }

+ 6 - 0
FactoryCraft/Globals.h

@@ -24,6 +24,12 @@ variable DLLRegister* dlls;
 variable World* currentGame;
 variable Framework::WFenster* window;
 variable RCArray<Bild>* itemIcons;
+variable BlockType** blockTypes;
+variable int blockTypeCount;
+variable ItemType** itemTypes;
+variable int itemTypeCount;
+variable EntityType** entityTypes;
+variable int entityTypeCount;
 
 
 void initVariables();

+ 110 - 110
FactoryCraft/Initialisierung.cpp

@@ -8,148 +8,148 @@
 #include <Liste.h>
 #include "Globals.h"
 
-Knopf* initKnopf( int x, int y, int br, int hö, __int64 style, char* titel )
+Knopf* initKnopf(int x, int y, int br, int hö, __int64 style, char* titel)
 {
-    Knopf* ret = uiFactory.createKnopf( uiFactory.initParam );
-    ret->addStyle( style );
-    ret->setPosition( x, y );
-    ret->setSize( br, hö );
-    ret->setText( titel );
-    return ret;
+	Knopf* ret = uiFactory.createKnopf(uiFactory.initParam);
+	ret->addStyle(style);
+	ret->setPosition(x, y);
+	ret->setSize(br, hö);
+	ret->setText(titel);
+	return ret;
 }
 
-KontrollKnopf* initKontrollKnopf( int x, int y, int br, int hö, __int64 style, char* txt )
+KontrollKnopf* initKontrollKnopf(int x, int y, int br, int hö, __int64 style, char* txt)
 {
-    KontrollKnopf* ret = uiFactory.createKontrollKnopf( uiFactory.initParam );
-    ret->addStyle( style );
-    ret->setText( txt );
-    ret->setSText( txt );
-    ret->setPosition( x, y );
-    ret->setSize( br, hö );
-    return ret;
+	KontrollKnopf* ret = uiFactory.createKontrollKnopf(uiFactory.initParam);
+	ret->addStyle(style);
+	ret->setText(txt);
+	ret->setSText(txt);
+	ret->setPosition(x, y);
+	ret->setSize(br, hö);
+	return ret;
 }
 
-Fenster* initFenster( int x, int y, int br, int hö, __int64 style, char* titel )
+Fenster* initFenster(int x, int y, int br, int hö, __int64 style, char* titel)
 {
-    Fenster* ret = uiFactory.createFenster( uiFactory.initParam );
-    ret->addStyle( style );
-    ret->setPosition( x, y );
-    ret->setSize( br, hö );
-    if( ret->hatStyle( Fenster::Style::Titel ) )
-    {
-        ret->setTitel( titel );
-    }
-    return ret;
+	Fenster* ret = uiFactory.createFenster(uiFactory.initParam);
+	ret->addStyle(style);
+	ret->setPosition(x, y);
+	ret->setSize(br, hö);
+	if (ret->hatStyle(Fenster::Style::Titel))
+	{
+		ret->setTitel(titel);
+	}
+	return ret;
 }
 
-TextFeld* initTextFeld( int x, int y, int br, int hö, __int64 style, char* txt )
+TextFeld* initTextFeld(int x, int y, int br, int hö, __int64 style, char* txt)
 {
-    TextFeld* ret = uiFactory.createTextFeld( uiFactory.initParam );
-    ret->addStyle( style );
-    ret->setText( txt );
-    ret->setPosition( x, y );
-    ret->setSize( br, hö );
-    return ret;
+	TextFeld* ret = uiFactory.createTextFeld(uiFactory.initParam);
+	ret->addStyle(style);
+	ret->setText(txt);
+	ret->setPosition(x, y);
+	ret->setSize(br, hö);
+	return ret;
 }
 
-BildZ* initBildZ( int x, int y, int br, int hö, __int64 style, Bild* b )
+BildZ* initBildZ(int x, int y, int br, int hö, __int64 style, Bild* b)
 {
-    BildZ* ret = uiFactory.createBildZ( uiFactory.initParam );
-    ret->setStyle( style );
-    ret->setPosition( x, y );
-    ret->setSize( br, hö );
-    if( b )
-        ret->setBildZ( b );
-    return ret;
+	BildZ* ret = uiFactory.createBildZ(uiFactory.initParam);
+	ret->setStyle(style);
+	ret->setPosition(x, y);
+	ret->setSize(br, hö);
+	if (b)
+		ret->setBildZ(b);
+	return ret;
 }
 
-AuswahlBox* initAuswahlBox( int x, int y, int br, int hö, __int64 style, std::initializer_list< char* > values )
+AuswahlBox* initAuswahlBox(int x, int y, int br, int hö, __int64 style, std::initializer_list< char* > values)
 {
-    AuswahlBox* ret = uiFactory.createAuswahlBox( uiFactory.initParam );
-    ret->addStyle( style );
-    ret->setPosition( x, y );
-    ret->setSize( br, hö );
-    for( auto i = values.begin(); i != values.end(); i++ )
-        ret->addEintrag( *i );
-    return ret;
+	AuswahlBox* ret = uiFactory.createAuswahlBox(uiFactory.initParam);
+	ret->addStyle(style);
+	ret->setPosition(x, y);
+	ret->setSize(br, hö);
+	for (auto i = values.begin(); i != values.end(); i++)
+		ret->addEintrag(*i);
+	return ret;
 }
 
-ObjTabelle* initObjTabelle( int x, int y, int br, int hö, __int64 style, std::initializer_list< OBJTabelleSpalteIni > spalten, int überschriftHöhe )
+ObjTabelle* initObjTabelle(int x, int y, int br, int hö, __int64 style, std::initializer_list< OBJTabelleSpalteIni > spalten, int überschriftHöhe)
 {
-    ObjTabelle* ret = uiFactory.createObjTabelle( uiFactory.initParam );
-    ret->addStyle( style );
-    ret->setPosition( x, y );
-    ret->setSize( br, hö );
-    for( auto i = spalten.begin(); i != spalten.end(); i++ )
-    {
-        ret->addSpalte( i->name );
-        ret->setSpaltenBreite( i->name, i->breite );
-        if( (style | ObjTabelle::Style::SpaltenBreiteMin) == style )
-            ret->setMinSpaltenBreite( i->name, i->minBreite );
-        if( (style | ObjTabelle::Style::SpaltenBreiteMax) == style )
-            ret->setMaxSpaltenBreite( i->name, i->maxBreite );
-        if( überschriftHöhe )
-        {
-            if( ret->getZeilenNummer( "Überschrift" ) < 0 )
-            {
-                ret->addZeile( 0, "Überschrift" );
-                ret->setZeilenHeight( 0, 20 );
-            }
-            ret->setZeichnungZ( i->name, "Überschrift", initTextFeld( 0, 0, i->breite, 20, TextFeld::Style::Text | TextFeld::Style::Center, i->name ) );
-        }
-    }
-    return ret;
+	ObjTabelle* ret = uiFactory.createObjTabelle(uiFactory.initParam);
+	ret->addStyle(style);
+	ret->setPosition(x, y);
+	ret->setSize(br, hö);
+	for (auto i = spalten.begin(); i != spalten.end(); i++)
+	{
+		ret->addSpalte(i->name);
+		ret->setSpaltenBreite(i->name, i->breite);
+		if ((style | ObjTabelle::Style::SpaltenBreiteMin) == style)
+			ret->setMinSpaltenBreite(i->name, i->minBreite);
+		if ((style | ObjTabelle::Style::SpaltenBreiteMax) == style)
+			ret->setMaxSpaltenBreite(i->name, i->maxBreite);
+		if (überschriftHöhe)
+		{
+			if (ret->getZeilenNummer("Überschrift") < 0)
+			{
+				ret->addZeile(0, "Überschrift");
+				ret->setZeilenHeight(0, 20);
+			}
+			ret->setZeichnungZ(i->name, "Überschrift", initTextFeld(0, 0, i->breite, 20, TextFeld::Style::Text | TextFeld::Style::Center, i->name));
+		}
+	}
+	return ret;
 }
 
-LDiag* initLinienDiagramm( int x, int y, int br, int hö, __int64 style, DiagDaten* data )
+LDiag* initLinienDiagramm(int x, int y, int br, int hö, __int64 style, DiagDaten* data)
 {
-    LDiag* ret = uiFactory.createLDiag( uiFactory.initParam );
-    ret->addStyle( style );
-    ret->setPosition( x, y );
-    ret->setSize( br, hö );
-    if( data )
-        ret->setDiagDatenZ( data );
-    return ret;
+	LDiag* ret = uiFactory.createLDiag(uiFactory.initParam);
+	ret->addStyle(style);
+	ret->setPosition(x, y);
+	ret->setSize(br, hö);
+	if (data)
+		ret->setDiagDatenZ(data);
+	return ret;
 }
 
-AuswahlListe* initAuswahlListe( int x, int y, int br, int hö, __int64 style, std::initializer_list< char* > values )
+AuswahlListe* initAuswahlListe(int x, int y, int br, int hö, __int64 style, std::initializer_list< char* > values)
 {
-    AuswahlListe* ret = uiFactory.createAuswahlListe( uiFactory.initParam );
-    ret->setPosition( x, y );
-    ret->setSize( br, hö );
-    ret->addStyle( style );
-    for( auto i = values.begin(); i != values.end(); i++ )
-        ret->addEintrag( *i );
-    ret->update();
-    return ret;
+	AuswahlListe* ret = uiFactory.createAuswahlListe(uiFactory.initParam);
+	ret->setPosition(x, y);
+	ret->setSize(br, hö);
+	ret->addStyle(style);
+	for (auto i = values.begin(); i != values.end(); i++)
+		ret->addEintrag(*i);
+	ret->update();
+	return ret;
 }
 
-ZeichnungHintergrund* initZeichnungHintergrund( int x, int y, int br, int hö, __int64 style, int farbe )
+ZeichnungHintergrund* initZeichnungHintergrund(int x, int y, int br, int hö, __int64 style, int farbe)
 {
-    ZeichnungHintergrund* ret = new ZeichnungHintergrund();
-    ret->setStyle( style );
-    ret->setHintergrundFarbe( farbe );
-    if( ret->hatStyle( ZeichnungHintergrund::Style::Rahmen ) )
-    {
-        ret->setRahmenBreite( 1 );
-        ret->setRahmenFarbe( 0xFF00FF00 );
-    }
-    ret->setPosition( x, y );
-    ret->setSize( br, hö );
-    return ret;
+	ZeichnungHintergrund* ret = new ZeichnungHintergrund();
+	ret->setStyle(style);
+	ret->setHintergrundFarbe(farbe);
+	if (ret->hatStyle(ZeichnungHintergrund::Style::Rahmen))
+	{
+		ret->setRahmenBreite(1);
+		ret->setRahmenFarbe(0xFF00FF00);
+	}
+	ret->setPosition(x, y);
+	ret->setSize(br, hö);
+	return ret;
 }
 
-void initToolTip( Zeichnung* obj, const char* txt )
+void initToolTip(Zeichnung* obj, const char* txt)
 {
-    obj->setToolTipText( txt, uiFactory.initParam.bildschirm, uiFactory.initParam.schrift );
-    obj->zToolTip()->addStyle( TextFeld::Style::Mehrzeilig );
+	obj->setToolTipText(txt, uiFactory.initParam.bildschirm, uiFactory.initParam.schrift);
+	obj->zToolTip()->addStyle(TextFeld::Style::Mehrzeilig);
 }
 
-FBalken* initFBalken( int x, int y, int br, int hö, __int64 style )
+FBalken* initFBalken(int x, int y, int br, int hö, __int64 style)
 {
-    FBalken* ret = uiFactory.createFBalken( uiFactory.initParam );
-    ret->addStyle( style );
-    ret->setPosition( x, y );
-    ret->setSize( br, hö );
-    return ret;
+	FBalken* ret = uiFactory.createFBalken(uiFactory.initParam);
+	ret->addStyle(style);
+	ret->setPosition(x, y);
+	ret->setSize(br, hö);
+	return ret;
 }

+ 12 - 12
FactoryCraft/Initialisierung.h

@@ -13,19 +13,19 @@ using namespace Framework;
 
 struct OBJTabelleSpalteIni
 {
-    char* name;
-    int breite;
-    int minBreite;
-    int maxBreite;
+	char* name;
+	int breite;
+	int minBreite;
+	int maxBreite;
 };
 
-Knopf* initKnopf( int x, int y, int br, int hö, __int64 style, char* titel );
-KontrollKnopf* initKontrollKnopf( int x, int y, int br, int hö, __int64 style, char* txt );
-TextFeld* initTextFeld( int x, int y, int br, int hö, __int64 style, char* txt );
-BildZ* initBildZ( int x, int y, int br, int hö, __int64 style, Bild* b );
-AuswahlBox* initAuswahlBox( int x, int y, int br, int hö, __int64 style, std::initializer_list< char* > values );
-ObjTabelle* initObjTabelle( int x, int y, int br, int hö, __int64 style, std::initializer_list< OBJTabelleSpalteIni > spalten, int überschriftHöhe );
-LDiag* initLinienDiagramm( int x, int y, int br, int hö, __int64 style, DiagDaten* data );
-FBalken* initFBalken( int x, int y, int br, int hö, __int64 style );
+Knopf* initKnopf(int x, int y, int br, int hö, __int64 style, char* titel);
+KontrollKnopf* initKontrollKnopf(int x, int y, int br, int hö, __int64 style, char* txt);
+TextFeld* initTextFeld(int x, int y, int br, int hö, __int64 style, char* txt);
+BildZ* initBildZ(int x, int y, int br, int hö, __int64 style, Bild* b);
+AuswahlBox* initAuswahlBox(int x, int y, int br, int hö, __int64 style, std::initializer_list< char* > values);
+ObjTabelle* initObjTabelle(int x, int y, int br, int hö, __int64 style, std::initializer_list< OBJTabelleSpalteIni > spalten, int überschriftHöhe);
+LDiag* initLinienDiagramm(int x, int y, int br, int hö, __int64 style, DiagDaten* data);
+FBalken* initFBalken(int x, int y, int br, int hö, __int64 style);
 
 #endif

+ 0 - 30
FactoryCraft/Inventory.h

@@ -1,30 +0,0 @@
-#pragma once
-
-#include <Vec3.h>
-#include <ReferenceCounter.h>
-#include <HashMap.h>
-
-#include "ItemSlot.h"
-#include "Area.h"
-
-class ItemFilter;
-class Inventory;
-
-class Inventory : public virtual Framework::ReferenceCounter
-{
-private:
-	Framework::RCArray<ItemSlot>* pullSlotsOrder;
-	Framework::RCArray<ItemSlot>* pushSlotsOrder;
-
-protected:
-	Framework::Vec3<float> location;
-	virtual void loadInventory(Framework::StreamReader* zReader);
-	void addSlot(ItemSlot* slot);
-
-
-public:
-	Inventory(const Framework::Vec3<float> location, bool hasInventory);
-	virtual ~Inventory();
-	Framework::Iterator<ItemSlot*> begin();
-	Framework::Iterator<ItemSlot*> end();
-};

+ 0 - 84
FactoryCraft/Inventoty.cpp

@@ -1,84 +0,0 @@
-#include "Inventory.h"
-#include "Area.h"
-
-#include "Registries.h"
-
-using namespace Framework;
-
-
-Inventory::Inventory(const Framework::Vec3<float> location, bool hasInventory)
-	: ReferenceCounter(),
-	location(location)
-{
-	if (hasInventory)
-	{
-		pullSlotsOrder = new Framework::RCArray<ItemSlot>();
-		pushSlotsOrder = new Framework::RCArray<ItemSlot>();
-	}
-	else
-	{
-		pullSlotsOrder = 0;
-		pushSlotsOrder = 0;
-	}
-}
-
-Inventory::~Inventory()
-{
-	if (pullSlotsOrder)
-		pullSlotsOrder->release();
-	if (pushSlotsOrder)
-		pushSlotsOrder->release();
-}
-
-void Inventory::loadInventory(Framework::StreamReader* zReader)
-{
-	if (pushSlotsOrder)
-	{
-		for (auto slot : *pushSlotsOrder)
-		{
-			int size = 0;
-			zReader->lese((char*)&size, 4);
-			if (size != 0)
-			{
-				int id = 0;
-				zReader->lese((char*)&id, 4);
-				Item* item = STATIC_REGISTRY(ItemType).zElement(id)->loadItem(zReader);
-				slot->setItems(new ItemStack(item, size));
-			}
-			else
-				slot->setItems(0);
-		}
-	}
-}
-
-void Inventory::addSlot(ItemSlot* slot)
-{
-	int pullPrio = slot->getPullPriority();
-	int pushPrio = slot->getPushPriority();
-	int index = 0;
-	for (auto stack : *pullSlotsOrder)
-	{
-		if (stack->getPullPriority() > pullPrio)
-			break;
-		index++;
-	}
-	pullSlotsOrder->add(dynamic_cast<ItemSlot*>(slot->getThis()), index);
-	index = 0;
-	for (auto stack : *pushSlotsOrder)
-	{
-		if (stack->getPushPriority() > pushPrio)
-			break;
-		index++;
-	}
-	pushSlotsOrder->add(slot, index);
-}
-
-Framework::Iterator<ItemSlot*> Inventory::begin()
-{
-	return pullSlotsOrder->begin();
-}
-
-Framework::Iterator<ItemSlot*> Inventory::end()
-{
-	return pullSlotsOrder->end();
-}

+ 0 - 78
FactoryCraft/Item.cpp

@@ -1,78 +0,0 @@
-#include "Item.h"
-
-
-Item::Item( const ItemType* zType, const char* name )
-    : ReferenceCounter(),
-    zType( zType ),
-    damage( 0 ),
-    maxDamage( 0 ),
-    durability( 0 ),
-    maxDurability( 0 ),
-    eatable( 0 ),
-    placeable( 0 ),
-    equippable( 0 ),
-    solid( 1 ),
-    usable( 0 ),
-    maxStackSize( 50 ),
-    name( name )
-{}
-
-const ItemType* Item::zItemType() const
-{
-    return zType;
-}
-
-float Item::getDamage() const
-{
-    return damage;
-}
-
-float Item::getDurability() const
-{
-    return durability;
-}
-
-bool Item::isUsable() const
-{
-    return usable;
-}
-
-bool Item::isEatable() const
-{
-    return eatable;
-}
-
-bool Item::isPlaceable() const
-{
-    return placeable;
-}
-
-bool Item::isEquippable() const
-{
-    return equippable;
-}
-
-bool Item::isSolid() const
-{
-    return solid;
-}
-
-float Item::getMaxDurability() const
-{
-    return maxDurability;
-}
-
-int Item::getMaxStackSize() const
-{
-    return maxStackSize;
-}
-
-float Item::getMaxDamage() const
-{
-    return maxDamage;
-}
-
-const char* Item::getName() const
-{
-    return name;
-}

+ 0 - 41
FactoryCraft/Item.h

@@ -1,41 +0,0 @@
-#pragma once
-
-#include "ItemType.h"
-#include "Reader.h"
-
-class ItemType;
-
-class Item : public virtual Framework::ReferenceCounter
-{
-protected:
-    const ItemType* zType;
-    float damage;
-    float maxDamage;
-    float durability;
-    float maxDurability;
-    bool eatable;
-    bool placeable;
-    bool equippable;
-    bool solid;
-    bool usable;
-    int maxStackSize;
-    Framework::Text name;
-    Item( const ItemType* zType, const char* name );
-
-public:
-
-    const ItemType* zItemType() const;
-    float getDamage() const;
-    float getDurability() const;
-    bool isUsable() const;
-    bool isEatable() const;
-    bool isPlaceable() const;
-    bool isEquippable() const;
-    bool isSolid() const;
-    float getMaxDurability() const;
-    int getMaxStackSize() const;
-    float getMaxDamage() const;
-    const char* getName() const;
-
-    friend ItemType;
-};

+ 0 - 35
FactoryCraft/ItemEntity.cpp

@@ -1,35 +0,0 @@
-#include "ItemEntity.h"
-#include "ItemSlot.h"
-#include "Globals.h"
-
-
-ItemEntity::ItemEntity()
-	: Entity(ItemEntityType::INSTANCE, 1)
-{
-	slot = new ItemSlot("", INT_MAX, 0, 0, 0, ANY_DIRECTION, 0);
-	addSlot(slot);
-	currentGame->setVisibility(this, 1);
-	// TODO: initialize model3d
-}
-
-bool ItemEntity::tick(double time)
-{
-	lock();
-	if (!model && slot->zStack())
-	{
-		setModelDaten(slot->zStack()->zItem()->zItemType()->getItemModel());
-		textur = slot->zStack()->zItem()->zItemType()->getItemTextur();
-	}
-	unlock();
-	return Entity::tick(time);
-}
-
-
-ItemEntityType::ItemEntityType()
-	: EntityType(ID)
-{}
-
-Entity* ItemEntityType::createEntity() const
-{
-	return new ItemEntity();
-}

+ 0 - 27
FactoryCraft/ItemEntity.h

@@ -1,27 +0,0 @@
-#pragma once
-
-#include "Entity.h"
-#include "StaticRegistry.h"
-
-class ItemSlot;
-
-class ItemEntity : public Entity
-{
-    ItemSlot* slot;
-public:
-    ItemEntity();
-
-    virtual bool tick( double time ) override;
-};
-
-class ItemEntityType : public EntityType
-{
-    REGISTRABLE( ItemEntityType )
-
-protected:
-    virtual Entity* createEntity() const override;
-
-public:
-    ItemEntityType();
-};
-REGISTER( ItemEntityType, EntityType )

+ 0 - 47
FactoryCraft/ItemSlot.cpp

@@ -1,47 +0,0 @@
-#include "ItemSlot.h"
-
-
-ItemSlot::ItemSlot(Framework::Text name, int maxSize, int pullPriority, int pushPriority, int allowedPullSide, int allowedPushSides, bool allowHigherStackSize )
-    : ReferenceCounter(),
-    items( 0 ),
-    maxSize( maxSize ),
-    allowedPullSide( allowedPullSide ),
-    allowedPushSides( allowedPushSides ),
-    pullPriority( pullPriority ),
-    pushPriority( pushPriority ),
-    allowHigherStackSize( allowHigherStackSize ),
-    name(name)
-{}
-
-ItemSlot::~ItemSlot()
-{
-    if( items )
-        items->release();
-}
-
-void ItemSlot::setItems( ItemStack* items )
-{
-    if( this->items )
-        this->items->release();
-    this->items = items;
-}
-
-int ItemSlot::getPullPriority() const
-{
-    return pullPriority;
-}
-
-int ItemSlot::getPushPriority() const
-{
-    return pushPriority;
-}
-
-ItemStack* ItemSlot::zStack() const
-{
-    return items;
-}
-
-const Framework::Text& ItemSlot::getName() const
-{
-    return name;
-}

+ 0 - 27
FactoryCraft/ItemSlot.h

@@ -1,27 +0,0 @@
-#pragma once
-
-#include "ItemStack.h"
-#include "Area.h"
-
-class ItemSlot : public virtual Framework::ReferenceCounter
-{
-private:
-	ItemStack* items;
-	int maxSize;
-	Directions allowedPullSide;
-	Directions allowedPushSides;
-	int pullPriority;
-	int pushPriority;
-	bool allowHigherStackSize;
-	Framework::Text name;
-
-public:
-	ItemSlot(Framework::Text name, int maxSize, int pullPriority, int pushPriority, int allowedPullSide, int allowedPushSides, bool allowHigherStackSize);
-	~ItemSlot();
-
-	void setItems(ItemStack* item);
-	int getPullPriority() const;
-	int getPushPriority() const;
-	ItemStack* zStack() const;
-	const Framework::Text& getName() const;
-};

+ 0 - 35
FactoryCraft/ItemStack.cpp

@@ -1,35 +0,0 @@
-#include "ItemStack.h"
-#include "Item.h"
-
-
-ItemStack::ItemStack( Item* item, int currentSize, int maxSize )
-    : ReferenceCounter(),
-    item( item ),
-    size( currentSize ),
-    maxSize( maxSize )
-{}
-
-ItemStack::ItemStack( Item* item, int currentSize )
-    : ItemStack( item, currentSize, item->getMaxStackSize() )
-{}
-
-ItemStack::~ItemStack()
-{
-    if( item )
-        item->release();
-}
-
-int ItemStack::getSize() const
-{
-    return size;
-}
-
-int ItemStack::getMaxSize() const
-{
-    return maxSize;
-}
-
-Item* ItemStack::zItem() const
-{
-    return item;
-}

+ 0 - 20
FactoryCraft/ItemStack.h

@@ -1,20 +0,0 @@
-#pragma once
-
-#include "Item.h"
-
-class ItemStack : public virtual Framework::ReferenceCounter
-{
-private:
-    Item* item;
-    int size;
-    int maxSize;
-
-public:
-    ItemStack( Item* item, int currentSize, int maxSize );
-    ItemStack( Item* item, int currentSize );
-    ~ItemStack();
-
-    int getSize() const;
-    int getMaxSize() const;
-    Item* zItem() const;
-};

+ 10 - 43
FactoryCraft/ItemType.cpp

@@ -2,61 +2,28 @@
 #include <InMemoryBuffer.h>
 
 #include "ItemType.h"
-#include "ItemStack.h"
 #include "Registries.h"
 
-ItemType::ItemType( int id, const char* defaultName )
-    : ReferenceCounter(),
-    id( id ),
-    defaultName( defaultName )
-{
-    STATIC_REGISTRY( ItemType ).registerT( this, id );
-}
+ItemType::ItemType(int id, ModelInfo model)
+	: ReferenceCounter(),
+	id(id),
+	model(model)
+{}
 
 ItemType::~ItemType()
 {}
 
-void ItemType::loadSuperItem( Item* zItem, Framework::StreamReader* zReader ) const
-{
-    zReader->lese( (char*)&zItem->damage, 4 );
-    zReader->lese( (char*)&zItem->maxDamage, 4 );
-    zReader->lese( (char*)&zItem->durability, 4 );
-    zReader->lese( (char*)&zItem->maxDurability, 4 );
-    unsigned char flags = 0;
-    zReader->lese( (char*)&flags, 1 );
-    zItem->eatable = (flags | 1) == flags;
-    zItem->placeable = (flags | 2) == flags;
-    zItem->equippable = (flags | 4) == flags;
-    zItem->solid = (flags | 8) == flags;
-    zItem->usable = (flags | 16) == flags;
-    zReader->lese( (char*)&zItem->maxStackSize, 1 );
-    unsigned char len = 0;
-    zReader->lese( (char*)&len, 1 );
-    zItem->name.fillText( ' ', len );
-    zReader->lese( zItem->name, len );
-}
-
 int ItemType::getId() const
 {
-    return id;
-}
-
-ItemStack* ItemType::createItemStack( int size ) const
-{
-    Item* item = createItem();
-    if( !item )
-        return 0;
-    return new ItemStack( item, MIN( size, item->getMaxStackSize() ) );
+	return id;
 }
 
-Item* ItemType::loadItem( Framework::StreamReader* zReader ) const
+Framework::Model3DData* ItemType::getItemModel() const
 {
-    Item* item = createItem();
-    loadSuperItem( item, zReader );
-    return item;
+	return model.getModel();
 }
 
-const char* ItemType::getDefaultItemName() const
+Framework::Model3DTextur* ItemType::getItemTextur() const
 {
-    return defaultName;
+	return model.getTexture();
 }

+ 8 - 25
FactoryCraft/ItemType.h

@@ -1,35 +1,18 @@
 #pragma once
 
-#include <Text.h>
-#include <JSON.h>
-#include <Trie.h>
-#include <Writer.h>
-#include <Model3D.h>
-#include <Textur.h>
-
-class Item;
-class ItemStack;
-class ItemSkill;
-class ItemSkillLevelUpRule;
+#include "ModelInfo.h"
 
 class ItemType : public virtual Framework::ReferenceCounter
 {
 protected:
-    const int id;
-    const char* defaultName;
-
-    ItemType( int id, const char* defaultName );
-
-    virtual void loadSuperItem( Item* zItem, Framework::StreamReader* zReader ) const;
+	const int id;
+	const ModelInfo model;
 
 public:
-    ~ItemType();
+	ItemType(int id, ModelInfo model);
+	~ItemType();
 
-    int getId() const;
-    virtual Item* createItem() const = 0;
-    virtual ItemStack* createItemStack( int size ) const;
-    virtual Item* loadItem( Framework::StreamReader* zReader ) const;
-    virtual Framework::Model3DData* getItemModel() const = 0;
-    virtual Framework::Model3DTextur* getItemTextur() const = 0;
-    const char* getDefaultItemName() const;
+	int getId() const;
+	Framework::Model3DData* getItemModel() const;
+	Framework::Model3DTextur* getItemTextur() const;
 };

+ 471 - 505
FactoryCraft/Load.cpp

@@ -10,536 +10,502 @@
 #include <GraphicsApi.h>
 #include "Login.h"
 
-void createDefaultCube( Bildschirm* zScreen )
+void createDefaultCube(Bildschirm* zScreen)
 {
-    Model3DData* data = zScreen->zGraphicsApi()->createModel( "cube" );
-    data->setAmbientFactor( 0.8f );
-    data->setDiffusFactor( 0.1f );
-    data->setSpecularFactor( 0.1f );
-    float size = 1;
-    float left, right, top, bottom;
-    // Calculate the screen coordinates of the left side of the bitmap.
-    left = (float)((size / 2.0) * -1);
-    // Calculate the screen coordinates of the right side of the bitmap.
-    right = left + (float)size;
-    // Calculate the screen coordinates of the top of the bitmap.
-    top = (float)(size / 2.0);
-    // Calculate the screen coordinates of the bottom of the bitmap.
-    bottom = top - (float)size;
-    float front = -size / 2;
-    float back = front + size;
+	Model3DData* data = zScreen->zGraphicsApi()->createModel("cube");
+	data->setAmbientFactor(0.8f);
+	data->setDiffusFactor(0.1f);
+	data->setSpecularFactor(0.1f);
+	float size = 1;
+	float left, right, top, bottom;
+	// Calculate the screen coordinates of the left side of the bitmap.
+	left = (float)((size / 2.0) * -1);
+	// Calculate the screen coordinates of the right side of the bitmap.
+	right = left + (float)size;
+	// Calculate the screen coordinates of the top of the bitmap.
+	top = (float)(size / 2.0);
+	// Calculate the screen coordinates of the bottom of the bitmap.
+	bottom = top - (float)size;
+	float front = -size / 2;
+	float back = front + size;
 
-    Vertex3D* vertecies = new Vertex3D[ 24 ];
-    for( int i = 0; i < 24; i++ )
-        vertecies[ i ].knochenId = 0;
-    vertecies[ 0 ].pos = Vec3<float >( left, top, front );
-    vertecies[ 0 ].tPos = Vec2< float >( 0.f, 0.f );
-    vertecies[ 1 ].pos = Vec3<float >( right, top, front );
-    vertecies[ 1 ].tPos = Vec2< float >( 1.f, 0.f );
-    vertecies[ 2 ].pos = Vec3<float >( left, bottom, front );
-    vertecies[ 2 ].tPos = Vec2< float >( 0.f, 1.f );
-    vertecies[ 3 ].pos = Vec3<float >( right, bottom, front );
-    vertecies[ 3 ].tPos = Vec2< float >( 1.f, 1.f );
-    vertecies[ 4 ].pos = Vec3<float >( left, top, back );
-    vertecies[ 4 ].tPos = Vec2< float >( 0.0f, 0.0f );
-    vertecies[ 5 ].pos = Vec3<float >( right, top, back );
-    vertecies[ 5 ].tPos = Vec2< float >( 1.0f, 0.0f );
-    vertecies[ 6 ].pos = Vec3<float >( left, bottom, back );
-    vertecies[ 6 ].tPos = Vec2< float >( 0.0f, 1.0f );
-    vertecies[ 7 ].pos = Vec3<float >( right, bottom, back );
-    vertecies[ 7 ].tPos = Vec2< float >( 1.0f, 1.0f );
+	Vertex3D* vertecies = new Vertex3D[24];
+	for (int i = 0; i < 24; i++)
+		vertecies[i].knochenId = 0;
+	vertecies[0].pos = Vec3<float >(left, top, front);
+	vertecies[0].tPos = Vec2< float >(0.f, 0.f);
+	vertecies[1].pos = Vec3<float >(right, top, front);
+	vertecies[1].tPos = Vec2< float >(1.f, 0.f);
+	vertecies[2].pos = Vec3<float >(left, bottom, front);
+	vertecies[2].tPos = Vec2< float >(0.f, 1.f);
+	vertecies[3].pos = Vec3<float >(right, bottom, front);
+	vertecies[3].tPos = Vec2< float >(1.f, 1.f);
+	vertecies[4].pos = Vec3<float >(left, top, back);
+	vertecies[4].tPos = Vec2< float >(0.0f, 0.0f);
+	vertecies[5].pos = Vec3<float >(right, top, back);
+	vertecies[5].tPos = Vec2< float >(1.0f, 0.0f);
+	vertecies[6].pos = Vec3<float >(left, bottom, back);
+	vertecies[6].tPos = Vec2< float >(0.0f, 1.0f);
+	vertecies[7].pos = Vec3<float >(right, bottom, back);
+	vertecies[7].tPos = Vec2< float >(1.0f, 1.0f);
 
-    vertecies[ 8 ].pos = Vec3<float >( left, top, front );
-    vertecies[ 8 ].tPos = Vec2< float >( 1.f, 0.f );
-    vertecies[ 9 ].pos = Vec3<float >( right, top, front );
-    vertecies[ 9 ].tPos = Vec2< float >( 0.f, 0.f );
-    vertecies[ 10 ].pos = Vec3<float >( left, bottom, front );
-    vertecies[ 10 ].tPos = Vec2< float >( 1.f, 1.f );
-    vertecies[ 11 ].pos = Vec3<float >( right, bottom, front );
-    vertecies[ 11 ].tPos = Vec2< float >( 0.f, 1.f );
-    vertecies[ 12 ].pos = Vec3<float >( left, top, back );
-    vertecies[ 12 ].tPos = Vec2< float >( 0.0f, 0.0f );
-    vertecies[ 13 ].pos = Vec3<float >( right, top, back );
-    vertecies[ 13 ].tPos = Vec2< float >( 1.0f, 0.0f );
-    vertecies[ 14 ].pos = Vec3<float >( left, bottom, back );
-    vertecies[ 14 ].tPos = Vec2< float >( 0.0f, 1.0f );
-    vertecies[ 15 ].pos = Vec3<float >( right, bottom, back );
-    vertecies[ 15 ].tPos = Vec2< float >( 1.0f, 1.0f );
+	vertecies[8].pos = Vec3<float >(left, top, front);
+	vertecies[8].tPos = Vec2< float >(1.f, 0.f);
+	vertecies[9].pos = Vec3<float >(right, top, front);
+	vertecies[9].tPos = Vec2< float >(0.f, 0.f);
+	vertecies[10].pos = Vec3<float >(left, bottom, front);
+	vertecies[10].tPos = Vec2< float >(1.f, 1.f);
+	vertecies[11].pos = Vec3<float >(right, bottom, front);
+	vertecies[11].tPos = Vec2< float >(0.f, 1.f);
+	vertecies[12].pos = Vec3<float >(left, top, back);
+	vertecies[12].tPos = Vec2< float >(0.0f, 0.0f);
+	vertecies[13].pos = Vec3<float >(right, top, back);
+	vertecies[13].tPos = Vec2< float >(1.0f, 0.0f);
+	vertecies[14].pos = Vec3<float >(left, bottom, back);
+	vertecies[14].tPos = Vec2< float >(0.0f, 1.0f);
+	vertecies[15].pos = Vec3<float >(right, bottom, back);
+	vertecies[15].tPos = Vec2< float >(1.0f, 1.0f);
 
-    vertecies[ 16 ].pos = Vec3<float >( left, top, front );
-    vertecies[ 16 ].tPos = Vec2< float >( 0.f, 1.f );
-    vertecies[ 17 ].pos = Vec3<float >( right, top, front );
-    vertecies[ 17 ].tPos = Vec2< float >( 1.f, 1.f );
-    vertecies[ 18 ].pos = Vec3<float >( left, bottom, front );
-    vertecies[ 18 ].tPos = Vec2< float >( 0.f, 0.f );
-    vertecies[ 19 ].pos = Vec3<float >( right, bottom, front );
-    vertecies[ 19 ].tPos = Vec2< float >( 1.f, 0.f );
-    vertecies[ 20 ].pos = Vec3<float >( left, top, back );
-    vertecies[ 20 ].tPos = Vec2< float >( 0.0f, 0.0f );
-    vertecies[ 21 ].pos = Vec3<float >( right, top, back );
-    vertecies[ 21 ].tPos = Vec2< float >( 1.0f, 0.0f );
-    vertecies[ 22 ].pos = Vec3<float >( left, bottom, back );
-    vertecies[ 22 ].tPos = Vec2< float >( 0.0f, 1.0f );
-    vertecies[ 23 ].pos = Vec3<float >( right, bottom, back );
-    vertecies[ 23 ].tPos = Vec2< float >( 1.0f, 1.0f );
+	vertecies[16].pos = Vec3<float >(left, top, front);
+	vertecies[16].tPos = Vec2< float >(0.f, 1.f);
+	vertecies[17].pos = Vec3<float >(right, top, front);
+	vertecies[17].tPos = Vec2< float >(1.f, 1.f);
+	vertecies[18].pos = Vec3<float >(left, bottom, front);
+	vertecies[18].tPos = Vec2< float >(0.f, 0.f);
+	vertecies[19].pos = Vec3<float >(right, bottom, front);
+	vertecies[19].tPos = Vec2< float >(1.f, 0.f);
+	vertecies[20].pos = Vec3<float >(left, top, back);
+	vertecies[20].tPos = Vec2< float >(0.0f, 0.0f);
+	vertecies[21].pos = Vec3<float >(right, top, back);
+	vertecies[21].tPos = Vec2< float >(1.0f, 0.0f);
+	vertecies[22].pos = Vec3<float >(left, bottom, back);
+	vertecies[22].tPos = Vec2< float >(0.0f, 1.0f);
+	vertecies[23].pos = Vec3<float >(right, bottom, back);
+	vertecies[23].tPos = Vec2< float >(1.0f, 1.0f);
 
-    data->setVertecies( vertecies, 24 );
-    // the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
-    // down side
-    Polygon3D* p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 6 + 16;
-    p->indexList[ 1 ] = 2 + 16;
-    p->indexList[ 2 ] = 3 + 16;
-    p->indexList[ 3 ] = 6 + 16;
-    p->indexList[ 4 ] = 3 + 16;
-    p->indexList[ 5 ] = 7 + 16;
-    data->addPolygon( p );
-    // right side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 1 + 8;
-    p->indexList[ 1 ] = 7 + 8;
-    p->indexList[ 2 ] = 3 + 8;
-    p->indexList[ 3 ] = 1 + 8;
-    p->indexList[ 4 ] = 5 + 8;
-    p->indexList[ 5 ] = 7 + 8;
-    data->addPolygon( p );
-    // top side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 4 + 16;
-    p->indexList[ 1 ] = 1 + 16;
-    p->indexList[ 2 ] = 0 + 16;
-    p->indexList[ 3 ] = 4 + 16;
-    p->indexList[ 4 ] = 5 + 16;
-    p->indexList[ 5 ] = 1 + 16;
-    data->addPolygon( p );
-    // left side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 0 + 8;
-    p->indexList[ 1 ] = 2 + 8;
-    p->indexList[ 2 ] = 6 + 8;
-    p->indexList[ 3 ] = 0 + 8;
-    p->indexList[ 4 ] = 6 + 8;
-    p->indexList[ 5 ] = 4 + 8;
-    data->addPolygon( p );
-    // back side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 4;
-    p->indexList[ 1 ] = 6;
-    p->indexList[ 2 ] = 7;
-    p->indexList[ 3 ] = 4;
-    p->indexList[ 4 ] = 7;
-    p->indexList[ 5 ] = 5;
-    data->addPolygon( p );
-    // front side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 0;
-    p->indexList[ 1 ] = 3;
-    p->indexList[ 2 ] = 2;
-    p->indexList[ 3 ] = 0;
-    p->indexList[ 4 ] = 1;
-    p->indexList[ 5 ] = 3;
-    data->addPolygon( p );
-    data->calculateNormals();
-    data->release();
+	data->setVertecies(vertecies, 24);
+	// the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
+	// down side
+	Polygon3D* p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 6 + 16;
+	p->indexList[1] = 2 + 16;
+	p->indexList[2] = 3 + 16;
+	p->indexList[3] = 6 + 16;
+	p->indexList[4] = 3 + 16;
+	p->indexList[5] = 7 + 16;
+	data->addPolygon(p);
+	// right side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 1 + 8;
+	p->indexList[1] = 7 + 8;
+	p->indexList[2] = 3 + 8;
+	p->indexList[3] = 1 + 8;
+	p->indexList[4] = 5 + 8;
+	p->indexList[5] = 7 + 8;
+	data->addPolygon(p);
+	// top side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 4 + 16;
+	p->indexList[1] = 1 + 16;
+	p->indexList[2] = 0 + 16;
+	p->indexList[3] = 4 + 16;
+	p->indexList[4] = 5 + 16;
+	p->indexList[5] = 1 + 16;
+	data->addPolygon(p);
+	// left side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 0 + 8;
+	p->indexList[1] = 2 + 8;
+	p->indexList[2] = 6 + 8;
+	p->indexList[3] = 0 + 8;
+	p->indexList[4] = 6 + 8;
+	p->indexList[5] = 4 + 8;
+	data->addPolygon(p);
+	// back side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 4;
+	p->indexList[1] = 6;
+	p->indexList[2] = 7;
+	p->indexList[3] = 4;
+	p->indexList[4] = 7;
+	p->indexList[5] = 5;
+	data->addPolygon(p);
+	// front side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 0;
+	p->indexList[1] = 3;
+	p->indexList[2] = 2;
+	p->indexList[3] = 0;
+	p->indexList[4] = 1;
+	p->indexList[5] = 3;
+	data->addPolygon(p);
+	data->calculateNormals();
+	data->release();
 }
 
-void createCubeItem( Bildschirm* zScreen )
+void createCubeItem(Bildschirm* zScreen)
 {
-    Framework::Model3DData* data = window->zBildschirm()->zGraphicsApi()->createModel( "itemCube" );
-    data->setAmbientFactor( 0.8f );
-    data->setDiffusFactor( 0.1f );
-    data->setSpecularFactor( 0.1f );
-    float size = 0.2f;
-    float left, right, top, bottom;
-    // Calculate the screen coordinates of the left side of the bitmap.
-    left = (float)((size / 2.0) * -1);
-    // Calculate the screen coordinates of the right side of the bitmap.
-    right = left + (float)size;
-    // Calculate the screen coordinates of the top of the bitmap.
-    top = (float)(size / 2.0);
-    // Calculate the screen coordinates of the bottom of the bitmap.
-    bottom = top - (float)size;
-    float front = -size / 2;
-    float back = front + size;
+	Framework::Model3DData* data = window->zBildschirm()->zGraphicsApi()->createModel("itemCube");
+	data->setAmbientFactor(0.8f);
+	data->setDiffusFactor(0.1f);
+	data->setSpecularFactor(0.1f);
+	float size = 0.2f;
+	float left, right, top, bottom;
+	// Calculate the screen coordinates of the left side of the bitmap.
+	left = (float)((size / 2.0) * -1);
+	// Calculate the screen coordinates of the right side of the bitmap.
+	right = left + (float)size;
+	// Calculate the screen coordinates of the top of the bitmap.
+	top = (float)(size / 2.0);
+	// Calculate the screen coordinates of the bottom of the bitmap.
+	bottom = top - (float)size;
+	float front = -size / 2;
+	float back = front + size;
 
-    Vertex3D* vertecies = new Vertex3D[ 24 ];
-    for( int i = 0; i < 24; i++ )
-        vertecies[ i ].knochenId = 0;
-    vertecies[ 0 ].pos = Vec3<float >( left, top, front );
-    vertecies[ 0 ].tPos = Vec2< float >( 0.f, 0.f );
-    vertecies[ 1 ].pos = Vec3<float >( right, top, front );
-    vertecies[ 1 ].tPos = Vec2< float >( 1.f, 0.f );
-    vertecies[ 2 ].pos = Vec3<float >( left, bottom, front );
-    vertecies[ 2 ].tPos = Vec2< float >( 0.f, 1.f );
-    vertecies[ 3 ].pos = Vec3<float >( right, bottom, front );
-    vertecies[ 3 ].tPos = Vec2< float >( 1.f, 1.f );
-    vertecies[ 4 ].pos = Vec3<float >( left, top, back );
-    vertecies[ 4 ].tPos = Vec2< float >( 0.0f, 0.0f );
-    vertecies[ 5 ].pos = Vec3<float >( right, top, back );
-    vertecies[ 5 ].tPos = Vec2< float >( 1.0f, 0.0f );
-    vertecies[ 6 ].pos = Vec3<float >( left, bottom, back );
-    vertecies[ 6 ].tPos = Vec2< float >( 0.0f, 1.0f );
-    vertecies[ 7 ].pos = Vec3<float >( right, bottom, back );
-    vertecies[ 7 ].tPos = Vec2< float >( 1.0f, 1.0f );
+	Vertex3D* vertecies = new Vertex3D[24];
+	for (int i = 0; i < 24; i++)
+		vertecies[i].knochenId = 0;
+	vertecies[0].pos = Vec3<float >(left, top, front);
+	vertecies[0].tPos = Vec2< float >(0.f, 0.f);
+	vertecies[1].pos = Vec3<float >(right, top, front);
+	vertecies[1].tPos = Vec2< float >(1.f, 0.f);
+	vertecies[2].pos = Vec3<float >(left, bottom, front);
+	vertecies[2].tPos = Vec2< float >(0.f, 1.f);
+	vertecies[3].pos = Vec3<float >(right, bottom, front);
+	vertecies[3].tPos = Vec2< float >(1.f, 1.f);
+	vertecies[4].pos = Vec3<float >(left, top, back);
+	vertecies[4].tPos = Vec2< float >(0.0f, 0.0f);
+	vertecies[5].pos = Vec3<float >(right, top, back);
+	vertecies[5].tPos = Vec2< float >(1.0f, 0.0f);
+	vertecies[6].pos = Vec3<float >(left, bottom, back);
+	vertecies[6].tPos = Vec2< float >(0.0f, 1.0f);
+	vertecies[7].pos = Vec3<float >(right, bottom, back);
+	vertecies[7].tPos = Vec2< float >(1.0f, 1.0f);
 
-    vertecies[ 8 ].pos = Vec3<float >( left, top, front );
-    vertecies[ 8 ].tPos = Vec2< float >( 1.f, 0.f );
-    vertecies[ 9 ].pos = Vec3<float >( right, top, front );
-    vertecies[ 9 ].tPos = Vec2< float >( 0.f, 0.f );
-    vertecies[ 10 ].pos = Vec3<float >( left, bottom, front );
-    vertecies[ 10 ].tPos = Vec2< float >( 1.f, 1.f );
-    vertecies[ 11 ].pos = Vec3<float >( right, bottom, front );
-    vertecies[ 11 ].tPos = Vec2< float >( 0.f, 1.f );
-    vertecies[ 12 ].pos = Vec3<float >( left, top, back );
-    vertecies[ 12 ].tPos = Vec2< float >( 0.0f, 0.0f );
-    vertecies[ 13 ].pos = Vec3<float >( right, top, back );
-    vertecies[ 13 ].tPos = Vec2< float >( 1.0f, 0.0f );
-    vertecies[ 14 ].pos = Vec3<float >( left, bottom, back );
-    vertecies[ 14 ].tPos = Vec2< float >( 0.0f, 1.0f );
-    vertecies[ 15 ].pos = Vec3<float >( right, bottom, back );
-    vertecies[ 15 ].tPos = Vec2< float >( 1.0f, 1.0f );
+	vertecies[8].pos = Vec3<float >(left, top, front);
+	vertecies[8].tPos = Vec2< float >(1.f, 0.f);
+	vertecies[9].pos = Vec3<float >(right, top, front);
+	vertecies[9].tPos = Vec2< float >(0.f, 0.f);
+	vertecies[10].pos = Vec3<float >(left, bottom, front);
+	vertecies[10].tPos = Vec2< float >(1.f, 1.f);
+	vertecies[11].pos = Vec3<float >(right, bottom, front);
+	vertecies[11].tPos = Vec2< float >(0.f, 1.f);
+	vertecies[12].pos = Vec3<float >(left, top, back);
+	vertecies[12].tPos = Vec2< float >(0.0f, 0.0f);
+	vertecies[13].pos = Vec3<float >(right, top, back);
+	vertecies[13].tPos = Vec2< float >(1.0f, 0.0f);
+	vertecies[14].pos = Vec3<float >(left, bottom, back);
+	vertecies[14].tPos = Vec2< float >(0.0f, 1.0f);
+	vertecies[15].pos = Vec3<float >(right, bottom, back);
+	vertecies[15].tPos = Vec2< float >(1.0f, 1.0f);
 
-    vertecies[ 16 ].pos = Vec3<float >( left, top, front );
-    vertecies[ 16 ].tPos = Vec2< float >( 0.f, 1.f );
-    vertecies[ 17 ].pos = Vec3<float >( right, top, front );
-    vertecies[ 17 ].tPos = Vec2< float >( 1.f, 1.f );
-    vertecies[ 18 ].pos = Vec3<float >( left, bottom, front );
-    vertecies[ 18 ].tPos = Vec2< float >( 0.f, 0.f );
-    vertecies[ 19 ].pos = Vec3<float >( right, bottom, front );
-    vertecies[ 19 ].tPos = Vec2< float >( 1.f, 0.f );
-    vertecies[ 20 ].pos = Vec3<float >( left, top, back );
-    vertecies[ 20 ].tPos = Vec2< float >( 0.0f, 0.0f );
-    vertecies[ 21 ].pos = Vec3<float >( right, top, back );
-    vertecies[ 21 ].tPos = Vec2< float >( 1.0f, 0.0f );
-    vertecies[ 22 ].pos = Vec3<float >( left, bottom, back );
-    vertecies[ 22 ].tPos = Vec2< float >( 0.0f, 1.0f );
-    vertecies[ 23 ].pos = Vec3<float >( right, bottom, back );
-    vertecies[ 23 ].tPos = Vec2< float >( 1.0f, 1.0f );
+	vertecies[16].pos = Vec3<float >(left, top, front);
+	vertecies[16].tPos = Vec2< float >(0.f, 1.f);
+	vertecies[17].pos = Vec3<float >(right, top, front);
+	vertecies[17].tPos = Vec2< float >(1.f, 1.f);
+	vertecies[18].pos = Vec3<float >(left, bottom, front);
+	vertecies[18].tPos = Vec2< float >(0.f, 0.f);
+	vertecies[19].pos = Vec3<float >(right, bottom, front);
+	vertecies[19].tPos = Vec2< float >(1.f, 0.f);
+	vertecies[20].pos = Vec3<float >(left, top, back);
+	vertecies[20].tPos = Vec2< float >(0.0f, 0.0f);
+	vertecies[21].pos = Vec3<float >(right, top, back);
+	vertecies[21].tPos = Vec2< float >(1.0f, 0.0f);
+	vertecies[22].pos = Vec3<float >(left, bottom, back);
+	vertecies[22].tPos = Vec2< float >(0.0f, 1.0f);
+	vertecies[23].pos = Vec3<float >(right, bottom, back);
+	vertecies[23].tPos = Vec2< float >(1.0f, 1.0f);
 
-    data->setVertecies( vertecies, 24 );
-    // the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
-    // down side
-    Polygon3D* p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 6 + 16;
-    p->indexList[ 1 ] = 2 + 16;
-    p->indexList[ 2 ] = 3 + 16;
-    p->indexList[ 3 ] = 6 + 16;
-    p->indexList[ 4 ] = 3 + 16;
-    p->indexList[ 5 ] = 7 + 16;
-    data->addPolygon( p );
-    // right side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 1 + 8;
-    p->indexList[ 1 ] = 7 + 8;
-    p->indexList[ 2 ] = 3 + 8;
-    p->indexList[ 3 ] = 1 + 8;
-    p->indexList[ 4 ] = 5 + 8;
-    p->indexList[ 5 ] = 7 + 8;
-    data->addPolygon( p );
-    // top side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 4 + 16;
-    p->indexList[ 1 ] = 1 + 16;
-    p->indexList[ 2 ] = 0 + 16;
-    p->indexList[ 3 ] = 4 + 16;
-    p->indexList[ 4 ] = 5 + 16;
-    p->indexList[ 5 ] = 1 + 16;
-    data->addPolygon( p );
-    // left side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 0 + 8;
-    p->indexList[ 1 ] = 2 + 8;
-    p->indexList[ 2 ] = 6 + 8;
-    p->indexList[ 3 ] = 0 + 8;
-    p->indexList[ 4 ] = 6 + 8;
-    p->indexList[ 5 ] = 4 + 8;
-    data->addPolygon( p );
-    // back side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 4;
-    p->indexList[ 1 ] = 6;
-    p->indexList[ 2 ] = 7;
-    p->indexList[ 3 ] = 4;
-    p->indexList[ 4 ] = 7;
-    p->indexList[ 5 ] = 5;
-    data->addPolygon( p );
-    // front side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 0;
-    p->indexList[ 1 ] = 3;
-    p->indexList[ 2 ] = 2;
-    p->indexList[ 3 ] = 0;
-    p->indexList[ 4 ] = 1;
-    p->indexList[ 5 ] = 3;
-    data->addPolygon( p );
-    data->calculateNormals();
-    data->release();
+	data->setVertecies(vertecies, 24);
+	// the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
+	// down side
+	Polygon3D* p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 6 + 16;
+	p->indexList[1] = 2 + 16;
+	p->indexList[2] = 3 + 16;
+	p->indexList[3] = 6 + 16;
+	p->indexList[4] = 3 + 16;
+	p->indexList[5] = 7 + 16;
+	data->addPolygon(p);
+	// right side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 1 + 8;
+	p->indexList[1] = 7 + 8;
+	p->indexList[2] = 3 + 8;
+	p->indexList[3] = 1 + 8;
+	p->indexList[4] = 5 + 8;
+	p->indexList[5] = 7 + 8;
+	data->addPolygon(p);
+	// top side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 4 + 16;
+	p->indexList[1] = 1 + 16;
+	p->indexList[2] = 0 + 16;
+	p->indexList[3] = 4 + 16;
+	p->indexList[4] = 5 + 16;
+	p->indexList[5] = 1 + 16;
+	data->addPolygon(p);
+	// left side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 0 + 8;
+	p->indexList[1] = 2 + 8;
+	p->indexList[2] = 6 + 8;
+	p->indexList[3] = 0 + 8;
+	p->indexList[4] = 6 + 8;
+	p->indexList[5] = 4 + 8;
+	data->addPolygon(p);
+	// back side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 4;
+	p->indexList[1] = 6;
+	p->indexList[2] = 7;
+	p->indexList[3] = 4;
+	p->indexList[4] = 7;
+	p->indexList[5] = 5;
+	data->addPolygon(p);
+	// front side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 0;
+	p->indexList[1] = 3;
+	p->indexList[2] = 2;
+	p->indexList[3] = 0;
+	p->indexList[4] = 1;
+	p->indexList[5] = 3;
+	data->addPolygon(p);
+	data->calculateNormals();
+	data->release();
 }
 
-void createPlayer( Bildschirm* zScreen )
+void createPlayer(Bildschirm* zScreen)
 {
-    Framework::Model3DData* data = window->zBildschirm()->zGraphicsApi()->createModel( "player" );
-    data->setAmbientFactor( 0.8f );
-    data->setDiffusFactor( 0.1f );
-    data->setSpecularFactor( 0.1f );
-    float size = 0.8f;
-    float left, right, top, bottom;
-    // Calculate the screen coordinates of the left side of the bitmap.
-    left = (float)((size / 2.0) * -1);
-    // Calculate the screen coordinates of the right side of the bitmap.
-    right = left + (float)size;
-    // Calculate the screen coordinates of the top of the bitmap.
-    top = (float)(size / 2.0);
-    // Calculate the screen coordinates of the bottom of the bitmap.
-    bottom = top - (float)size;
-    float front = -1.5f / 2;
-    float back = front + 1.5f;
+	Framework::Model3DData* data = window->zBildschirm()->zGraphicsApi()->createModel("player");
+	data->setAmbientFactor(0.8f);
+	data->setDiffusFactor(0.1f);
+	data->setSpecularFactor(0.1f);
+	float size = 0.8f;
+	float left, right, top, bottom;
+	// Calculate the screen coordinates of the left side of the bitmap.
+	left = (float)((size / 2.0) * -1);
+	// Calculate the screen coordinates of the right side of the bitmap.
+	right = left + (float)size;
+	// Calculate the screen coordinates of the top of the bitmap.
+	top = (float)(size / 2.0);
+	// Calculate the screen coordinates of the bottom of the bitmap.
+	bottom = top - (float)size;
+	float front = -1.5f / 2;
+	float back = front + 1.5f;
 
-    Vertex3D* vertecies = new Vertex3D[ 24 ];
-    for( int i = 0; i < 24; i++ )
-        vertecies[ i ].knochenId = 0;
-    vertecies[ 0 ].pos = Vec3<float >( left, top, front );
-    vertecies[ 0 ].tPos = Vec2< float >( 0.f, 0.f );
-    vertecies[ 1 ].pos = Vec3<float >( right, top, front );
-    vertecies[ 1 ].tPos = Vec2< float >( 1.f, 0.f );
-    vertecies[ 2 ].pos = Vec3<float >( left, bottom, front );
-    vertecies[ 2 ].tPos = Vec2< float >( 0.f, 1.f );
-    vertecies[ 3 ].pos = Vec3<float >( right, bottom, front );
-    vertecies[ 3 ].tPos = Vec2< float >( 1.f, 1.f );
-    vertecies[ 4 ].pos = Vec3<float >( left, top, back );
-    vertecies[ 4 ].tPos = Vec2< float >( 0.0f, 0.0f );
-    vertecies[ 5 ].pos = Vec3<float >( right, top, back );
-    vertecies[ 5 ].tPos = Vec2< float >( 1.0f, 0.0f );
-    vertecies[ 6 ].pos = Vec3<float >( left, bottom, back );
-    vertecies[ 6 ].tPos = Vec2< float >( 0.0f, 1.0f );
-    vertecies[ 7 ].pos = Vec3<float >( right, bottom, back );
-    vertecies[ 7 ].tPos = Vec2< float >( 1.0f, 1.0f );
+	Vertex3D* vertecies = new Vertex3D[24];
+	for (int i = 0; i < 24; i++)
+		vertecies[i].knochenId = 0;
+	vertecies[0].pos = Vec3<float >(left, top, front);
+	vertecies[0].tPos = Vec2< float >(0.f, 0.f);
+	vertecies[1].pos = Vec3<float >(right, top, front);
+	vertecies[1].tPos = Vec2< float >(1.f, 0.f);
+	vertecies[2].pos = Vec3<float >(left, bottom, front);
+	vertecies[2].tPos = Vec2< float >(0.f, 1.f);
+	vertecies[3].pos = Vec3<float >(right, bottom, front);
+	vertecies[3].tPos = Vec2< float >(1.f, 1.f);
+	vertecies[4].pos = Vec3<float >(left, top, back);
+	vertecies[4].tPos = Vec2< float >(0.0f, 0.0f);
+	vertecies[5].pos = Vec3<float >(right, top, back);
+	vertecies[5].tPos = Vec2< float >(1.0f, 0.0f);
+	vertecies[6].pos = Vec3<float >(left, bottom, back);
+	vertecies[6].tPos = Vec2< float >(0.0f, 1.0f);
+	vertecies[7].pos = Vec3<float >(right, bottom, back);
+	vertecies[7].tPos = Vec2< float >(1.0f, 1.0f);
 
-    vertecies[ 8 ].pos = Vec3<float >( left, top, front );
-    vertecies[ 8 ].tPos = Vec2< float >( 1.f, 0.f );
-    vertecies[ 9 ].pos = Vec3<float >( right, top, front );
-    vertecies[ 9 ].tPos = Vec2< float >( 0.f, 0.f );
-    vertecies[ 10 ].pos = Vec3<float >( left, bottom, front );
-    vertecies[ 10 ].tPos = Vec2< float >( 1.f, 1.f );
-    vertecies[ 11 ].pos = Vec3<float >( right, bottom, front );
-    vertecies[ 11 ].tPos = Vec2< float >( 0.f, 1.f );
-    vertecies[ 12 ].pos = Vec3<float >( left, top, back );
-    vertecies[ 12 ].tPos = Vec2< float >( 0.0f, 0.0f );
-    vertecies[ 13 ].pos = Vec3<float >( right, top, back );
-    vertecies[ 13 ].tPos = Vec2< float >( 1.0f, 0.0f );
-    vertecies[ 14 ].pos = Vec3<float >( left, bottom, back );
-    vertecies[ 14 ].tPos = Vec2< float >( 0.0f, 1.0f );
-    vertecies[ 15 ].pos = Vec3<float >( right, bottom, back );
-    vertecies[ 15 ].tPos = Vec2< float >( 1.0f, 1.0f );
+	vertecies[8].pos = Vec3<float >(left, top, front);
+	vertecies[8].tPos = Vec2< float >(1.f, 0.f);
+	vertecies[9].pos = Vec3<float >(right, top, front);
+	vertecies[9].tPos = Vec2< float >(0.f, 0.f);
+	vertecies[10].pos = Vec3<float >(left, bottom, front);
+	vertecies[10].tPos = Vec2< float >(1.f, 1.f);
+	vertecies[11].pos = Vec3<float >(right, bottom, front);
+	vertecies[11].tPos = Vec2< float >(0.f, 1.f);
+	vertecies[12].pos = Vec3<float >(left, top, back);
+	vertecies[12].tPos = Vec2< float >(0.0f, 0.0f);
+	vertecies[13].pos = Vec3<float >(right, top, back);
+	vertecies[13].tPos = Vec2< float >(1.0f, 0.0f);
+	vertecies[14].pos = Vec3<float >(left, bottom, back);
+	vertecies[14].tPos = Vec2< float >(0.0f, 1.0f);
+	vertecies[15].pos = Vec3<float >(right, bottom, back);
+	vertecies[15].tPos = Vec2< float >(1.0f, 1.0f);
 
-    vertecies[ 16 ].pos = Vec3<float >( left, top, front );
-    vertecies[ 16 ].tPos = Vec2< float >( 0.f, 1.f );
-    vertecies[ 17 ].pos = Vec3<float >( right, top, front );
-    vertecies[ 17 ].tPos = Vec2< float >( 1.f, 1.f );
-    vertecies[ 18 ].pos = Vec3<float >( left, bottom, front );
-    vertecies[ 18 ].tPos = Vec2< float >( 0.f, 0.f );
-    vertecies[ 19 ].pos = Vec3<float >( right, bottom, front );
-    vertecies[ 19 ].tPos = Vec2< float >( 1.f, 0.f );
-    vertecies[ 20 ].pos = Vec3<float >( left, top, back );
-    vertecies[ 20 ].tPos = Vec2< float >( 0.0f, 0.0f );
-    vertecies[ 21 ].pos = Vec3<float >( right, top, back );
-    vertecies[ 21 ].tPos = Vec2< float >( 1.0f, 0.0f );
-    vertecies[ 22 ].pos = Vec3<float >( left, bottom, back );
-    vertecies[ 22 ].tPos = Vec2< float >( 0.0f, 1.0f );
-    vertecies[ 23 ].pos = Vec3<float >( right, bottom, back );
-    vertecies[ 23 ].tPos = Vec2< float >( 1.0f, 1.0f );
+	vertecies[16].pos = Vec3<float >(left, top, front);
+	vertecies[16].tPos = Vec2< float >(0.f, 1.f);
+	vertecies[17].pos = Vec3<float >(right, top, front);
+	vertecies[17].tPos = Vec2< float >(1.f, 1.f);
+	vertecies[18].pos = Vec3<float >(left, bottom, front);
+	vertecies[18].tPos = Vec2< float >(0.f, 0.f);
+	vertecies[19].pos = Vec3<float >(right, bottom, front);
+	vertecies[19].tPos = Vec2< float >(1.f, 0.f);
+	vertecies[20].pos = Vec3<float >(left, top, back);
+	vertecies[20].tPos = Vec2< float >(0.0f, 0.0f);
+	vertecies[21].pos = Vec3<float >(right, top, back);
+	vertecies[21].tPos = Vec2< float >(1.0f, 0.0f);
+	vertecies[22].pos = Vec3<float >(left, bottom, back);
+	vertecies[22].tPos = Vec2< float >(0.0f, 1.0f);
+	vertecies[23].pos = Vec3<float >(right, bottom, back);
+	vertecies[23].tPos = Vec2< float >(1.0f, 1.0f);
 
-    data->setVertecies( vertecies, 24 );
-    // the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
-    // down side
-    Polygon3D* p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 6 + 16;
-    p->indexList[ 1 ] = 2 + 16;
-    p->indexList[ 2 ] = 3 + 16;
-    p->indexList[ 3 ] = 6 + 16;
-    p->indexList[ 4 ] = 3 + 16;
-    p->indexList[ 5 ] = 7 + 16;
-    data->addPolygon( p );
-    // right side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 1 + 8;
-    p->indexList[ 1 ] = 7 + 8;
-    p->indexList[ 2 ] = 3 + 8;
-    p->indexList[ 3 ] = 1 + 8;
-    p->indexList[ 4 ] = 5 + 8;
-    p->indexList[ 5 ] = 7 + 8;
-    data->addPolygon( p );
-    // top side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 4 + 16;
-    p->indexList[ 1 ] = 1 + 16;
-    p->indexList[ 2 ] = 0 + 16;
-    p->indexList[ 3 ] = 4 + 16;
-    p->indexList[ 4 ] = 5 + 16;
-    p->indexList[ 5 ] = 1 + 16;
-    data->addPolygon( p );
-    // left side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 0 + 8;
-    p->indexList[ 1 ] = 2 + 8;
-    p->indexList[ 2 ] = 6 + 8;
-    p->indexList[ 3 ] = 0 + 8;
-    p->indexList[ 4 ] = 6 + 8;
-    p->indexList[ 5 ] = 4 + 8;
-    data->addPolygon( p );
-    // back side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 4;
-    p->indexList[ 1 ] = 6;
-    p->indexList[ 2 ] = 7;
-    p->indexList[ 3 ] = 4;
-    p->indexList[ 4 ] = 7;
-    p->indexList[ 5 ] = 5;
-    data->addPolygon( p );
-    // front side
-    p = new Polygon3D();
-    p->indexAnz = 6;
-    p->indexList = new int[ p->indexAnz ];
-    p->indexList[ 0 ] = 0;
-    p->indexList[ 1 ] = 3;
-    p->indexList[ 2 ] = 2;
-    p->indexList[ 3 ] = 0;
-    p->indexList[ 4 ] = 1;
-    p->indexList[ 5 ] = 3;
-    data->addPolygon( p );
-    data->calculateNormals();
-    data->release();
+	data->setVertecies(vertecies, 24);
+	// the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
+	// down side
+	Polygon3D* p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 6 + 16;
+	p->indexList[1] = 2 + 16;
+	p->indexList[2] = 3 + 16;
+	p->indexList[3] = 6 + 16;
+	p->indexList[4] = 3 + 16;
+	p->indexList[5] = 7 + 16;
+	data->addPolygon(p);
+	// right side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 1 + 8;
+	p->indexList[1] = 7 + 8;
+	p->indexList[2] = 3 + 8;
+	p->indexList[3] = 1 + 8;
+	p->indexList[4] = 5 + 8;
+	p->indexList[5] = 7 + 8;
+	data->addPolygon(p);
+	// top side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 4 + 16;
+	p->indexList[1] = 1 + 16;
+	p->indexList[2] = 0 + 16;
+	p->indexList[3] = 4 + 16;
+	p->indexList[4] = 5 + 16;
+	p->indexList[5] = 1 + 16;
+	data->addPolygon(p);
+	// left side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 0 + 8;
+	p->indexList[1] = 2 + 8;
+	p->indexList[2] = 6 + 8;
+	p->indexList[3] = 0 + 8;
+	p->indexList[4] = 6 + 8;
+	p->indexList[5] = 4 + 8;
+	data->addPolygon(p);
+	// back side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 4;
+	p->indexList[1] = 6;
+	p->indexList[2] = 7;
+	p->indexList[3] = 4;
+	p->indexList[4] = 7;
+	p->indexList[5] = 5;
+	data->addPolygon(p);
+	// front side
+	p = new Polygon3D();
+	p->indexAnz = 6;
+	p->indexList = new int[p->indexAnz];
+	p->indexList[0] = 0;
+	p->indexList[1] = 3;
+	p->indexList[2] = 2;
+	p->indexList[3] = 0;
+	p->indexList[4] = 1;
+	p->indexList[5] = 3;
+	data->addPolygon(p);
+	data->calculateNormals();
+	data->release();
 }
 
-void createModels( Bildschirm* zScreen )
+void createModels(Bildschirm* zScreen)
 {
-    createDefaultCube( zScreen );
-    createCubeItem( zScreen );
-    createPlayer( zScreen );
+	createDefaultCube(zScreen);
+	createCubeItem(zScreen);
+	createPlayer(zScreen);
 }
 
 
-LoadMenu::LoadMenu( Bildschirm* zScreen )
-    : Menu( zScreen )
+LoadMenu::LoadMenu(Bildschirm* zScreen)
+	: Menu(zScreen)
 {
-    step = initFBalken( 10, 90, 200, 30, FBalken::Style::normal );
-    stage = initFBalken( 10, 50, 200, 30, FBalken::Style::normal );
-    all = initFBalken( 10, 10, 200, 30, FBalken::Style::normal );
-    elements.add( step );
-    elements.add( stage );
-    elements.add( all );
+	step = initFBalken(10, 90, 200, 30, FBalken::Style::normal);
+	stage = initFBalken(10, 50, 200, 30, FBalken::Style::normal);
+	all = initFBalken(10, 10, 200, 30, FBalken::Style::normal);
+	elements.add(step);
+	elements.add(stage);
+	elements.add(all);
 
-    new AsynchronCall( "Load Menu", [this, zScreen]() {
-        Sleep( 1000 );
-        all->setAktionAnzahl( 2 );
-        all->reset();
-        // loading textures
-        Datei texturF;
-        texturF.setDatei( "data/textures" );
-        RCArray<Text>* files = texturF.getDateiListe();
-        if( files )
-        {
-            int count = 0;
-            for( Text* fileName : *files )
-            {
-                LTDBDatei dat;
-                dat.setDatei( new Text( Text( "data/textures/" ) + *fileName ) );
-                dat.leseDaten( 0 );
-                count += dat.getBildAnzahl();
-            }
-            stage->setAktionAnzahl( count );
-            stage->reset();
-            for( Text* fileName : *files )
-            {
-                LTDBDatei dat;
-                dat.setDatei( new Text( Text( "data/textures/" ) + *fileName ) );
-                dat.leseDaten( 0 );
-                for( Text* name : *dat.zBildListe() )
-                {
-                    step->reset();
-                    Bild* b = dat.laden( step, new Text( *name ) );
-                    zScreen->zGraphicsApi()->createOrGetTextur( *fileName + "/" + *name, b )->release();
-                    stage->aktionPlus();
-                }
-            }
-            files->release();
-        }
-        createModels( zScreen );
-        all->aktionPlus();
-        stage->reset();
-        stage->setAktionAnzahl( STATIC_REGISTRY( ItemType ).getCount() );
-        // pre rendering item icons
-        Kam3D* kam = new Kam3D();
-        Welt3D* w = new Welt3D();
-        w->addDiffuseLight( DiffuseLight{ Vec3<float>( 0.5f, 0.5f, -1.f ), Vec3<float>( 1.f, 1.f, 1.f ) } );
-        kam->setWelt( w );
-        kam->setBildschirmPosition( 0, 0 );
-        kam->setBildschirmSize( 50, 50 );
-        kam->setPosition( Vec3<float>( 0, 0, 0 ) );
-        kam->setRotation( { 2.f, 0, -1.f } );
-        Bild* b = new Bild();
-        b->neuBild( 50, 50, 0 );
-        for( int i = 0; i < STATIC_REGISTRY( ItemType ).getCount(); i++ )
-        {
-            Model3D* mdl = new Model3D();
-            mdl->setModelDaten( STATIC_REGISTRY( ItemType ).zElement( i )->getItemModel() );
-            mdl->setModelTextur( STATIC_REGISTRY( ItemType ).zElement( i )->getItemTextur() );
-            mdl->setPosition( Vec3<float>( -0.8f, -0.45f, -0.4f ) );
-            mdl->setSize( 2.f );
-            w->addZeichnung( mdl );
-            w->tick( 0 );
-            zScreen->lock();
-            DX11Textur* t = (DX11Textur*)zScreen->zGraphicsApi()->createOrGetTextur( Text( "rendered/items/" ) + STATIC_REGISTRY( ItemType ).zElement( i )->getDefaultItemName(), dynamic_cast<Bild*>(b->getThis()) );
-            zScreen->zGraphicsApi()->renderKamera( kam, t );
-            Bild* result = new Bild();
-            t->copyToImage( result );
-            itemIcons->add( result );
-            t->release();
-            zScreen->unlock();
-            w->removeZeichnung( mdl );
-            stage->aktionPlus();
-        }
-        b->release();
-        kam->release();
-        all->aktionPlus();
-        zScreen->lock();
-        hide();
-        ((LoginMenu*)(Menu*)menuRegister->get( "login" ))->onLoadingFinished();
-        menuRegister->get( "login" )->show();
-        zScreen->unlock();
-    } );
+	new AsynchronCall("Load Menu", [this, zScreen]()
+		{
+			Sleep(1000);
+			all->setAktionAnzahl(1);
+			all->reset();
+			// loading textures
+			Datei texturF;
+			texturF.setDatei("data/textures");
+			RCArray<Text>* files = texturF.getDateiListe();
+			if (files)
+			{
+				int count = 0;
+				for (Text* fileName : *files)
+				{
+					LTDBDatei dat;
+					dat.setDatei(new Text(Text("data/textures/") + *fileName));
+					dat.leseDaten(0);
+					count += dat.getBildAnzahl();
+				}
+				stage->setAktionAnzahl(count);
+				stage->reset();
+				for (Text* fileName : *files)
+				{
+					LTDBDatei dat;
+					dat.setDatei(new Text(Text("data/textures/") + *fileName));
+					dat.leseDaten(0);
+					for (Text* name : *dat.zBildListe())
+					{
+						step->reset();
+						Bild* b = dat.laden(step, new Text(*name));
+						zScreen->zGraphicsApi()->createOrGetTextur(*fileName + "/" + *name, b)->release();
+						stage->aktionPlus();
+					}
+				}
+				files->release();
+			}
+			createModels(zScreen);
+			all->aktionPlus();
+			stage->reset();
+			zScreen->lock();
+			hide();
+			((LoginMenu*)(Menu*)menuRegister->get("login"))->onLoadingFinished();
+			menuRegister->get("login")->show();
+			zScreen->unlock();
+		});
 }

+ 4 - 4
FactoryCraft/Load.h

@@ -7,10 +7,10 @@
 class LoadMenu : public Menu
 {
 private:
-    FBalken* step;
-    FBalken* stage;
-    FBalken* all;
+	FBalken* step;
+	FBalken* stage;
+	FBalken* all;
 
 public:
-    LoadMenu( Bildschirm* zScreen );
+	LoadMenu(Bildschirm* zScreen);
 };

+ 29 - 28
FactoryCraft/Login.cpp

@@ -2,35 +2,36 @@
 #include "Initialisierung.h"
 #include "Globals.h"
 
-LoginMenu::LoginMenu( Bildschirm* zScreen )
-    : Menu( zScreen )
+LoginMenu::LoginMenu(Bildschirm* zScreen)
+	: Menu(zScreen)
 {
-    elements.add( initTextFeld( 10, 10, 90, 20, TextFeld::Style::Text, "Name: " ) );
-    elements.add( initTextFeld( 10, 35, 90, 20, TextFeld::Style::Text, "Passwort: " ) );
-    name = initTextFeld( 100, 10, 200, 20, TextFeld::Style::TextFeld, "Kolja" );
-    password = initTextFeld( 100, 35, 200, 20, TextFeld::Style::TextFeld, "1rg3ndw13" );
-    password->setSchowChar( '*' );
-    elements.add( name );
-    elements.add( password );
-    Knopf* login = initKnopf( 200, 60, 100, 20, Knopf::Style::Normal, "Login" );
-    login->setMausEreignis( [this, login]( void* p, void* o, MausEreignis me ) {
-        if( me.id == ME_RLinks )
-        {
-            login->removeStyle( Knopf::Style::Erlaubt );
-            name->removeStyle( TextFeld::Style::Erlaubt );
-            password->removeStyle( TextFeld::Style::Erlaubt );
-            if( network->login( name->zText()->getText(), password->zText()->getText() ) )
-            {
-                hide();
-                menuRegister->get( "directConnect" )->show();
-            }
-            name->addStyle( TextFeld::Style::Erlaubt );
-            password->addStyle( TextFeld::Style::Erlaubt );
-            login->addStyle( Knopf::Style::Erlaubt );
-        }
-        return 1;
-    } );
-    elements.add( login );
+	elements.add(initTextFeld(10, 10, 90, 20, TextFeld::Style::Text, "Name: "));
+	elements.add(initTextFeld(10, 35, 90, 20, TextFeld::Style::Text, "Passwort: "));
+	name = initTextFeld(100, 10, 200, 20, TextFeld::Style::TextFeld, "Kolja");
+	password = initTextFeld(100, 35, 200, 20, TextFeld::Style::TextFeld, "1rg3ndw13");
+	password->setSchowChar('*');
+	elements.add(name);
+	elements.add(password);
+	Knopf* login = initKnopf(200, 60, 100, 20, Knopf::Style::Normal, "Login");
+	login->setMausEreignis([this, login](void* p, void* o, MausEreignis me)
+		{
+			if (me.id == ME_RLinks)
+			{
+				login->removeStyle(Knopf::Style::Erlaubt);
+				name->removeStyle(TextFeld::Style::Erlaubt);
+				password->removeStyle(TextFeld::Style::Erlaubt);
+				if (network->login(name->zText()->getText(), password->zText()->getText()))
+				{
+					hide();
+					menuRegister->get("directConnect")->show();
+				}
+				name->addStyle(TextFeld::Style::Erlaubt);
+				password->addStyle(TextFeld::Style::Erlaubt);
+				login->addStyle(Knopf::Style::Erlaubt);
+			}
+			return 1;
+		});
+	elements.add(login);
 }
 
 void LoginMenu::onLoadingFinished()

+ 4 - 4
FactoryCraft/Login.h

@@ -7,10 +7,10 @@
 class LoginMenu : public Menu
 {
 private:
-    TextFeld* name;
-    TextFeld* password;
+	TextFeld* name;
+	TextFeld* password;
 
 public:
-    LoginMenu( Bildschirm* zScreen );
-    void onLoadingFinished();
+	LoginMenu(Bildschirm* zScreen);
+	void onLoadingFinished();
 };

+ 45 - 44
FactoryCraft/Main.cpp

@@ -12,54 +12,55 @@
 #include "Globals.h"
 
 
-int KSGStart Framework::Start( Framework::Startparam p )
+int KSGStart Framework::Start(Framework::Startparam p)
 {
-    Network::Start( 20 );
-    initVariables();
-    setDebugDX( 0 );
+	Network::Start(20);
+	initVariables();
+	setDebugDX(0);
 
-    Datei d;
-    d.setDatei( "data/schriften" );
-    auto list = d.getDateiListe();
-    for( Text* fontFile : *list )
-    {
-        LTDSDatei dat;
-        dat.setPfad( new Text( Text( "data/schriften/" ).operator+( fontFile->getText() ) ) );
-        dat.leseDaten();
-        Text* name = fontFile->getTeilText( 0, fontFile->getLength() - 5 );
-        fontRegister->put( *name, RCPointer<Schrift>::of( dat.ladeSchrift() ) );
-        name->release();
-    }
-    list->release();
+	Datei d;
+	d.setDatei("data/schriften");
+	auto list = d.getDateiListe();
+	for (Text* fontFile : *list)
+	{
+		LTDSDatei dat;
+		dat.setPfad(new Text(Text("data/schriften/").operator+(fontFile->getText())));
+		dat.leseDaten();
+		Text* name = fontFile->getTeilText(0, fontFile->getLength() - 5);
+		fontRegister->put(*name, RCPointer<Schrift>::of(dat.ladeSchrift()));
+		name->release();
+	}
+	list->release();
 
-    WFenster window;
-    ::window = &window;
-    WNDCLASS wc = Framework::F_Normal( p.hinst );
-    wc.lpszClassName = "Factory Craft";
-    window.erstellen( WS_POPUPWINDOW, wc );
-    Monitor m = Framework::getMonitor( 0 );
-    window.setBounds( Punkt( m.x, m.y ), Punkt( m.breite, m.height ) );
-    window.setAnzeigeModus( SW_SHOWNORMAL );
-    window.setVSchließAktion( [&window]( void* p, void* f ) {
-        StopNachrichtenSchleife( window.getFensterHandle() );
-    } );
-    window.setMausAktion( _ret1ME );
-    window.setTastaturAktion( _ret1TE );
-    Bildschirm3D screen( dynamic_cast<WFenster*>(window.getThis()), GraphicApiType::DIRECTX11 );
-    window.setBildschirm( dynamic_cast<Bildschirm*>(screen.getThis()) );
-    screen.setFillFarbe( 0 );
+	WFenster window;
+	::window = &window;
+	WNDCLASS wc = Framework::F_Normal(p.hinst);
+	wc.lpszClassName = "Factory Craft";
+	window.erstellen(WS_POPUPWINDOW, wc);
+	Monitor m = Framework::getMonitor(0);
+	window.setBounds(Punkt(m.x, m.y), Punkt(m.breite, m.height));
+	window.setAnzeigeModus(SW_SHOWNORMAL);
+	window.setVSchließAktion([&window](void* p, void* f)
+		{
+			StopNachrichtenSchleife(window.getFensterHandle());
+		});
+	window.setMausAktion(_ret1ME);
+	window.setTastaturAktion(_ret1TE);
+	Bildschirm3D screen(dynamic_cast<WFenster*>(window.getThis()), GraphicApiType::DIRECTX11);
+	window.setBildschirm(dynamic_cast<Bildschirm*>(screen.getThis()));
+	screen.setFillFarbe(0);
 
-    uiFactory = Framework::defaultUI( fontRegister->get( "normal" ), &screen );
-    initMenus();
+	uiFactory = Framework::defaultUI(fontRegister->get("normal"), &screen);
+	initMenus();
 
-    RenderTh rTh;
-    rTh.setMaxFps( 120 );
-    rTh.setBildschirm( dynamic_cast<Bildschirm*>(screen.getThis()) );
+	RenderTh rTh;
+	rTh.setMaxFps(120);
+	rTh.setBildschirm(dynamic_cast<Bildschirm*>(screen.getThis()));
 
-    rTh.beginn();
-    StartNachrichtenSchleife();
-    rTh.beenden();
-    releaseVariables();
-    Network::Exit();
-    return 0;
+	rTh.beginn();
+	StartNachrichtenSchleife();
+	rTh.beenden();
+	releaseVariables();
+	Network::Exit();
+	return 0;
 }

+ 10 - 9
FactoryCraft/Menu.cpp

@@ -1,21 +1,22 @@
 #include "Menu.h"
 #include <AsynchronCall.h>
 
-Menu::Menu( Bildschirm* zScreen )
-    : ReferenceCounter(),
-    zScreen( zScreen )
+Menu::Menu(Bildschirm* zScreen)
+	: ReferenceCounter(),
+	zScreen(zScreen)
 {}
 
 void Menu::show()
 {
-    for( auto member : elements )
-        zScreen->addMember( dynamic_cast<Zeichnung*>(member->getThis()) );
+	for (auto member : elements)
+		zScreen->addMember(dynamic_cast<Zeichnung*>(member->getThis()));
 }
 
 void Menu::hide()
 {
-    new AsynchronCall( [this]() {
-        for( auto member : elements )
-            zScreen->removeMember( dynamic_cast<Zeichnung*>(member->getThis()) );
-    } );
+	new AsynchronCall([this]()
+		{
+			for (auto member : elements)
+				zScreen->removeMember(dynamic_cast<Zeichnung*>(member->getThis()));
+		});
 }

+ 5 - 5
FactoryCraft/Menu.h

@@ -8,12 +8,12 @@ using namespace Framework;
 class Menu : public ReferenceCounter
 {
 protected:
-    RCArray<Zeichnung> elements;
-    Bildschirm* zScreen;
+	RCArray<Zeichnung> elements;
+	Bildschirm* zScreen;
 
 public:
-    Menu( Bildschirm* zScreen );
+	Menu(Bildschirm* zScreen);
 
-    void show();
-    void hide();
+	void show();
+	void hide();
 };

+ 45 - 0
FactoryCraft/ModelInfo.cpp

@@ -0,0 +1,45 @@
+#include <Textur.h>
+
+#include "ModelInfo.h"
+#include "Globals.h"
+
+using namespace Framework;
+
+ModelInfo::ModelInfo(Framework::StreamReader* reader)
+{
+	char len;
+	reader->lese(&len, 1);
+	char* path = new char[len + 1];
+	reader->lese(path, len);
+	path[len] = 0;
+	modelPath = path;
+	delete[] path;
+	short count;
+	reader->lese((char*)&count, 2);
+	for (int i = 0; i < count; i++)
+	{
+		reader->lese(&len, 1);
+		path = new char[len + 1];
+		reader->lese(path, len);
+		path[len] = 0;
+		texturPaths.add(new Text(path));
+		delete[] path;
+	}
+}
+
+Framework::Model3DData* ModelInfo::getModel() const
+{
+	return uiFactory.initParam.bildschirm->zGraphicsApi()->getModel(modelPath);
+}
+
+Framework::Model3DTextur* ModelInfo::getTexture() const
+{
+	Model3DTextur* textur = new Model3DTextur();
+	int index = 0;
+	for (Text* texturPath : texturPaths)
+	{
+		Textur* tex = uiFactory.initParam.bildschirm->zGraphicsApi()->createOrGetTextur(texturPath->getText(), 0);
+		textur->setPolygonTextur(index++, dynamic_cast<Textur*>(tex));
+	}
+	return textur;
+}

+ 19 - 0
FactoryCraft/ModelInfo.h

@@ -0,0 +1,19 @@
+#pragma once
+
+#include <Text.h>
+#include <Array.h>
+#include <Reader.h>
+#include <Model3D.h>
+
+class ModelInfo
+{
+private:
+	Framework::Text modelPath;
+	Framework::RCArray<Framework::Text> texturPaths;
+
+public:
+	ModelInfo(Framework::StreamReader* reader);
+
+	Framework::Model3DData* getModel() const;
+	Framework::Model3DTextur* getTexture() const;
+};

+ 97 - 97
FactoryCraft/NetworkHandler.cpp

@@ -4,120 +4,120 @@
 #include "Globals.h"
 
 NetworkHandler::NetworkHandler()
-    : ReferenceCounter()
+	: ReferenceCounter()
 {
-    HINSTANCE dll = dlls->ladeDLL( "KSGClient", "data/bin/KSGNetwork.dll" );
-    if( !dll )
-        throw "DLL not found: 'data/bin/KSGNetwork.dll'";
-    KSGClient::KSGNetworkCreateMain getMainClient = (KSGClient::KSGNetworkCreateMain)GetProcAddress( dll, KSGNETWORK_CREATE_MAIN );
-    if( !getMainClient )
-        throw "Entry point '" KSGNETWORK_CREATE_MAIN "' not found in DLL 'data/bin/KSGNetwork.dll'";
-    msc = getMainClient();
-    if( !msc )
-        throw "Could not create Main Server Client from DLL 'data/bin/KSGNetwork.dll'";
-    InitDatei* iDat = new InitDatei( "data/optionen.ini" );
-    iDat->laden();
-    if( !iDat->zWert( "ServerIP" ) )
-        iDat->addWert( "ServerIP", "127.0.0.1" );
-    if( !iDat->zWert( "ServerPort" ) )
-        iDat->addWert( "ServerPort", "4225" );
-    iDat->speichern();
-    Text* ipT = iDat->zWert( "ServerIP" );
-    unsigned short port = (unsigned short)TextZuInt( iDat->zWert( "ServerPort" )->getText(), 10 );
-    esc = 0;
-    if( msc->registerSSL( ipT->getText(), port ) )
-    {
-        esc = msc->createErhaltungServerClient();
-        esc->verbinde();
-    }
-    iDat->release();
-    fc = 0;
-    lsc = 0;
-    gsc = 0;
+	HINSTANCE dll = dlls->ladeDLL("KSGClient", "data/bin/KSGNetwork.dll");
+	if (!dll)
+		throw "DLL not found: 'data/bin/KSGNetwork.dll'";
+	KSGClient::KSGNetworkCreateMain getMainClient = (KSGClient::KSGNetworkCreateMain)GetProcAddress(dll, KSGNETWORK_CREATE_MAIN);
+	if (!getMainClient)
+		throw "Entry point '" KSGNETWORK_CREATE_MAIN "' not found in DLL 'data/bin/KSGNetwork.dll'";
+	msc = getMainClient();
+	if (!msc)
+		throw "Could not create Main Server Client from DLL 'data/bin/KSGNetwork.dll'";
+	InitDatei* iDat = new InitDatei("data/optionen.ini");
+	iDat->laden();
+	if (!iDat->zWert("ServerIP"))
+		iDat->addWert("ServerIP", "127.0.0.1");
+	if (!iDat->zWert("ServerPort"))
+		iDat->addWert("ServerPort", "4225");
+	iDat->speichern();
+	Text* ipT = iDat->zWert("ServerIP");
+	unsigned short port = (unsigned short)TextZuInt(iDat->zWert("ServerPort")->getText(), 10);
+	esc = 0;
+	if (msc->registerSSL(ipT->getText(), port))
+	{
+		esc = msc->createErhaltungServerClient();
+		esc->verbinde();
+	}
+	iDat->release();
+	fc = 0;
+	lsc = 0;
+	gsc = 0;
 }
 
 NetworkHandler::~NetworkHandler()
 {
-    if( gsc )
-    {
-        gsc->release();
-        gsc = 0;
-    }
-    if( fc )
-        fc->release();
-    if( esc )
-    {
-        esc->abmelden();
-        esc->release();
-    }
-    if( lsc )
-    {
-        lsc->verbinde();
-        lsc->logout();
-        lsc->trenne( 1 );
-        lsc->release();
-    }
-    if( msc )
-    {
-        msc->unregister();
-        msc->release();
-    }
+	if (gsc)
+	{
+		gsc->release();
+		gsc = 0;
+	}
+	if (fc)
+		fc->release();
+	if (esc)
+	{
+		esc->abmelden();
+		esc->release();
+	}
+	if (lsc)
+	{
+		lsc->verbinde();
+		lsc->logout();
+		lsc->trenne(1);
+		lsc->release();
+	}
+	if (msc)
+	{
+		msc->unregister();
+		msc->release();
+	}
 }
 
-bool NetworkHandler::login( Framework::Text name, Framework::Text password )
+bool NetworkHandler::login(Framework::Text name, Framework::Text password)
 {
-    if( !lsc )
-        lsc = msc->createLoginServerClient();
-    else
-    {
-        if( gsc )
-        {
-            gsc->release();
-            gsc = 0;
-        }
-        lsc->logout();
-    }
-    if( !lsc )
-        return 0;
-    lsc->verbinde();
-    bool ok = lsc->login( name, password );
-    lsc->trenne( ok );
-    if( ok )
-    {
-        accountId = lsc->getAccountId();
-        lsc->release();
-        lsc = 0;
-    }
-    return ok;
+	if (!lsc)
+		lsc = msc->createLoginServerClient();
+	else
+	{
+		if (gsc)
+		{
+			gsc->release();
+			gsc = 0;
+		}
+		lsc->logout();
+	}
+	if (!lsc)
+		return 0;
+	lsc->verbinde();
+	bool ok = lsc->login(name, password);
+	lsc->trenne(ok);
+	if (ok)
+	{
+		accountId = lsc->getAccountId();
+		lsc->release();
+		lsc = 0;
+	}
+	return ok;
 }
 
-bool NetworkHandler::connect( Text ip, short port )
+bool NetworkHandler::connect(Text ip, short port)
 {
-    if( !gsc )
-        gsc = msc->createMinigameServerClient();
-    if( !gsc )
-        return 0;
-    Text* secret = gsc->getSecret();
-    if( !secret )
-        return 0;
-    if( !fc )
-        fc = new FactoryClient();
-    bool ok = fc->connect( ip, port, accountId, *secret );
-    secret->release();
-    return ok;
+	if (!gsc)
+		gsc = msc->createMinigameServerClient();
+	if (!gsc)
+		return 0;
+	Text* secret = gsc->getSecret();
+	if (!secret)
+		return 0;
+	if (!fc)
+		fc = new FactoryClient();
+	bool ok = fc->connect(ip, port, accountId, *secret);
+	secret->release();
+	return ok;
 }
 
 FactoryClient* NetworkHandler::zFactoryClient() const
 {
-    return fc;
+	return fc;
 }
 
 bool NetworkHandler::leaveGame()
 {
-    if( fc )
-    {
-        fc->release();
-        fc = 0;
-    }
-    return 1;
+	if (fc)
+	{
+		fc->release();
+		fc = 0;
+	}
+	return 1;
 }

+ 12 - 12
FactoryCraft/NetworkHandler.h

@@ -7,19 +7,19 @@
 class NetworkHandler : public virtual Framework::ReferenceCounter
 {
 private:
-    KSGClient::MainServerClient* msc;
-    KSGClient::LoginServerClient* lsc;
-    KSGClient::MinigameServerClient* gsc;
-    KSGClient::ErhaltungServerClient* esc;
-    FactoryClient* fc;
-    int accountId;
+	KSGClient::MainServerClient* msc;
+	KSGClient::LoginServerClient* lsc;
+	KSGClient::MinigameServerClient* gsc;
+	KSGClient::ErhaltungServerClient* esc;
+	FactoryClient* fc;
+	int accountId;
 
 public:
-    NetworkHandler();
-    ~NetworkHandler();
+	NetworkHandler();
+	~NetworkHandler();
 
-    bool login( Framework::Text name, Framework::Text password );
-    bool connect( Text ip, short port );
-    FactoryClient* zFactoryClient() const;
-    bool leaveGame();
+	bool login(Framework::Text name, Framework::Text password);
+	bool connect(Text ip, short port);
+	FactoryClient* zFactoryClient() const;
+	bool leaveGame();
 };

+ 0 - 69
FactoryCraft/NoBlock.cpp

@@ -1,69 +0,0 @@
-#include "NoBlock.h"
-
-NoBlock::NoBlock()
-    : Block( NoBlockBlockType::INSTANCE, 0, { 0,0,0 }, false )
-{
-    transparent = 0;
-    passable = 0;
-    hp = 0;
-    maxHP = 0;
-    hardness = 0;
-}
-
-const NoBlock NoBlock::INSTANCE;
-
-
-NoBlockBlockType::NoBlockBlockType()
-    : BlockType( ID )
-{}
-
-NoBlockBlockType::NoBlockBlockType( int id )
-    : BlockType( id )
-{}
-
-Block* NoBlockBlockType::createBlock( Framework::Vec3<int> position )
-{
-    assert( false );
-    return 0;
-}
-
-Block* NoBlockBlockType::loadBlock( Framework::Vec3<int> position, Framework::StreamReader* zReader )
-{
-    return 0;
-}
-
-void NoBlockBlockType::initializeSuperBlock( Block* zBlock )
-{}
-
-const Block* NoBlockBlockType::zDefault()
-{
-    return &NoBlock::INSTANCE;
-}
-
-bool NoBlockBlockType::needsInstance() const
-{
-    return 0;
-}
-
-
-AirBlock::AirBlock()
-    : Block( AirBlockBlockType::INSTANCE, 0, { 0,0,0 }, false )
-{
-    transparent = 1;
-    passable = 1;
-    hp = 0;
-    maxHP = 0;
-    hardness = 0;
-}
-
-const AirBlock AirBlock::INSTANCE;
-
-
-AirBlockBlockType::AirBlockBlockType()
-    : NoBlockBlockType( ID )
-{}
-
-const Block* AirBlockBlockType::zDefault()
-{
-    return &AirBlock::INSTANCE;
-}

+ 0 - 51
FactoryCraft/NoBlock.h

@@ -1,51 +0,0 @@
-#pragma once
-
-#include "BlockType.h"
-#include "Block.h"
-
-class NoBlockBlockType;
-
-class NoBlock : public Block
-{
-public:
-    static const NoBlock INSTANCE;
-
-protected:
-    NoBlock();
-
-    friend NoBlockBlockType;
-};
-
-class NoBlockBlockType : public BlockType
-{
-    REGISTRABLE( NoBlockBlockType )
-
-protected:
-    NoBlockBlockType();
-    NoBlockBlockType( int id );
-    virtual Block* createBlock( Framework::Vec3<int> position ) override;
-    virtual Block* loadBlock( Framework::Vec3<int> position, Framework::StreamReader* zReader ) override;
-    virtual void initializeSuperBlock( Block* zBlock ) override;
-    virtual const Block* zDefault() override;
-    virtual bool needsInstance() const override;
-};
-REGISTER( NoBlockBlockType, BlockType )
-
-class AirBlock : public Block
-{
-public:
-    static const AirBlock INSTANCE;
-
-protected:
-    AirBlock();
-};
-
-class AirBlockBlockType : public NoBlockBlockType
-{
-    REGISTRABLE( AirBlockBlockType )
-
-protected:
-    AirBlockBlockType();
-    virtual const Block* zDefault() override;
-};
-REGISTER( AirBlockBlockType, BlockType )

+ 10 - 19
FactoryCraft/PlaceBlockUpdate.cpp

@@ -6,26 +6,17 @@
 #include "Globals.h"
 
 PlaceBlockUpdateType::PlaceBlockUpdateType()
-    : WorldUpdateType( ID )
+	: WorldUpdateType(ID)
 {}
 
-void PlaceBlockUpdateType::applyUpdate( Framework::StreamReader* zReader )
+void PlaceBlockUpdateType::applyUpdate(Framework::StreamReader* zReader)
 {
-    int dimension = 0;
-    zReader->lese( (char*)&dimension, 4 );
-    Framework::Vec3<int> pos;
-    zReader->lese( (char*)&pos.x, 4 );
-    zReader->lese( (char*)&pos.y, 4 );
-    zReader->lese( (char*)&pos.z, 4 );
-    unsigned short id;
-    zReader->lese( (char*)&id, 2 );
-    bool d = 1;
-    zReader->lese( (char*)&d, 1 );
-    if( !d )
-    {
-        if( STATIC_REGISTRY( BlockType ).zElement( id )->needsInstance() )
-            currentGame->zDimension( dimension )->setBlock( STATIC_REGISTRY( BlockType ).zElement( id )->createBlock( pos ) );
-    }
-    else
-        currentGame->zDimension( dimension )->setBlock( STATIC_REGISTRY( BlockType ).zElement( id )->loadBlock( pos, zReader ) );
+	Framework::Vec3<int> pos;
+	zReader->lese((char*)&pos.x, 4);
+	zReader->lese((char*)&pos.y, 4);
+	zReader->lese((char*)&pos.z, 4);
+	unsigned short id;
+	zReader->lese((char*)&id, 2);
+	if (blockTypes[id]->doesNeedInstance())
+		currentGame->zDimension()->setBlock(blockTypes[id]->createBlock(pos));
 }

+ 4 - 4
FactoryCraft/PlaceBlockUpdate.h

@@ -3,11 +3,11 @@
 
 class PlaceBlockUpdateType : WorldUpdateType
 {
-    REGISTRABLE( PlaceBlockUpdateType )
+	REGISTRABLE(PlaceBlockUpdateType)
 
 protected:
-    PlaceBlockUpdateType();
-    void applyUpdate( Framework::StreamReader* zReader ) override;
+	PlaceBlockUpdateType();
+	void applyUpdate(Framework::StreamReader* zReader) override;
 };
 
-REGISTER( PlaceBlockUpdateType, WorldUpdateType )
+REGISTER(PlaceBlockUpdateType, WorldUpdateType)

+ 0 - 102
FactoryCraft/Player.cpp

@@ -1,102 +0,0 @@
-#include <Bild.h>
-
-#include "Player.h"
-#include "Area.h"
-#include "Globals.h"
-#include "Menu.h"
-#include "Game.h"
-
-
-Player::Player()
-	: Entity(PlayerEntityType::INSTANCE, 1),
-	leftHandPosition(0)
-{
-	setModelDaten(uiFactory.initParam.bildschirm->zGraphicsApi()->getModel("player"));
-	Bild* b = new Bild();
-	b->neuBild(10, 10, 0xFFFFFFFF);
-	Textur* tex = uiFactory.initParam.bildschirm->zGraphicsApi()->createOrGetTextur("player", 0);
-	if (!tex->zBild())
-		tex->setBildZ(b);
-	else
-		b->release();
-	Model3DTextur* textur = new Model3DTextur();
-	textur->setPolygonTextur(0, dynamic_cast<Textur*>(tex->getThis()));
-	textur->setPolygonTextur(1, dynamic_cast<Textur*>(tex->getThis()));
-	textur->setPolygonTextur(2, dynamic_cast<Textur*>(tex->getThis()));
-	textur->setPolygonTextur(3, dynamic_cast<Textur*>(tex->getThis()));
-	textur->setPolygonTextur(4, dynamic_cast<Textur*>(tex->getThis()));
-	textur->setPolygonTextur(5, tex);
-	setModelTextur(textur);
-	for (int i = 0; i < 9; i++)
-	{
-		ItemSlot* slot = new ItemSlot("Crafting", 1, INT_MAX, INT_MAX, INSIDE, INSIDE, 0);
-		addSlot(slot);
-	}
-	for (int i = 0; i < 10; i++)
-	{
-		ItemSlot* slot = new ItemSlot("ItemBar", 50, 0, i, 0, ANY_DIRECTION, 0);
-		itemBar.add(slot);
-		addSlot(slot);
-	}
-	for (int i = 0; i < 30; i++)
-	{
-		ItemSlot* slot = new ItemSlot("Inventory", 50, 0, i + 10, 0, ANY_DIRECTION, 0);
-		addSlot(slot);
-	}
-	currentGame->setVisibility(this, 1);
-}
-
-Player::~Player()
-{}
-
-bool Player::tick(double time)
-{
-	cs.lock();
-	if (currentGame->getCurrentPlayerId() == id)
-	{
-		currentGame->zKamera()->setPosition(pos + Vec3<float>(0.f, 0.f, 1.5f));
-		if (target)
-		{
-			auto t = target->getTarget(currentDimensionId);
-			if (t.isA() && t.getA())
-				currentGame->setTarget(t.getA());
-			if (t.isB() && t.getB())
-				currentGame->setTarget(t.getB());
-			if ((t.isA() && t.getA()) || (t.isB() && t.getB()))
-				((Game*)(Menu*)menuRegister->get("game"))->updatePosition(pos, 1, t.isA() ? t.getA()->getPos() : t.getB()->getPos());
-			else
-				((Game*)(Menu*)menuRegister->get("game"))->updatePosition(pos, 0, { 0, 0, 0 });
-			if (t.isA() && t.getA())
-				t.getA()->release();
-			if (t.isB() && t.getB())
-				t.getB()->release();
-		}
-		else
-		{
-			currentGame->setTarget(0);
-			((Game*)(Menu*)menuRegister->get("game"))->updatePosition(pos, 0, { 0, 0, 0 });
-		}
-		((Game*)(Menu*)menuRegister->get("game"))->updateInventory(itemBar, leftHandPosition);
-	}
-	cs.unlock();
-	return Entity::tick(time);
-}
-
-
-PlayerEntityType::PlayerEntityType()
-	: EntityType(ID)
-{}
-
-void PlayerEntityType::loadSuperEntity(Entity* zEntity, Framework::StreamReader* zReader) const
-{
-	Player* zPlayer = dynamic_cast<Player*>(zEntity);
-	if (!zPlayer)
-		throw "PlayerEntityType::loadSuperEntity was called with an entity witch is not an instance of Player";
-	zReader->lese((char*)&zPlayer->leftHandPosition, 4);
-	EntityType::loadSuperEntity(zEntity, zReader);
-}
-
-Entity* PlayerEntityType::createEntity() const
-{
-	return new Player();
-}

+ 0 - 38
FactoryCraft/Player.h

@@ -1,38 +0,0 @@
-#pragma once
-
-#include <Text.h>
-#include "Entity.h"
-#include "StaticRegistry.h"
-
-class ItemSlot;
-class PlayerEntityType;
-
-class Player : public Entity
-{
-private:
-    Framework::Text name;
-    Framework::Array<ItemSlot*> itemBar;
-    int leftHandPosition;
-
-public:
-    Player();
-    ~Player();
-
-    virtual bool tick( double time ) override;
-
-    friend PlayerEntityType;
-};
-
-class PlayerEntityType : public EntityType
-{
-    REGISTRABLE( PlayerEntityType )
-
-protected:
-    virtual void loadSuperEntity( Entity* zEntity, Framework::StreamReader* zReader ) const override;
-    virtual Entity* createEntity() const override;
-
-public:
-    PlayerEntityType();
-};
-
-REGISTER( PlayerEntityType, EntityType )

+ 16 - 0
FactoryCraft/PlayerKam.cpp

@@ -10,6 +10,7 @@ PlayerKam::PlayerKam(Framework::Bildschirm3D* zScreen)
 	setBildschirmSize(zScreen->getBackBufferSize());
 	setStyle(Kam3D::Style::Tick | Kam3D::Style::Movable | Kam3D::Style::Rotatable);
 	setRotation({ (float)PI / 2.f, 0, 0 });
+	entityId = -1;
 }
 
 void PlayerKam::setDirection(Framework::Vec3<float> direction)
@@ -213,5 +214,20 @@ bool PlayerKam::tick(double time)
 	removeStyle(Style::Movable | Style::Rotatable | Style::Zoomable);
 	bool result = Kam3D::tick(time);
 	addStyle(style);
+	if (entityId >= 0)
+	{
+		Entity* entity = currentGame->zEntity(entityId);
+		if (entity)
+		{
+			// update camera position
+			setPosition(entity->getPos() + Vec3<float>(0.f, 0.f, 1.5f));
+			((Game*)(Menu*)menuRegister->get("game"))->updatePosition(entity->getPos(), 0, { 0, 0, 0 });
+		}
+	}
 	return result;
+}
+
+void PlayerKam::setEntityId(int id)
+{
+	entityId = id;
 }

+ 9 - 7
FactoryCraft/PlayerKam.h

@@ -6,13 +6,15 @@
 class PlayerKam : public Framework::Kam3D
 {
 private:
-    bool kameraControll;
-    Framework::Punkt lastMousePos;
+	bool kameraControll;
+	Framework::Punkt lastMousePos;
+	int entityId;
 
 public:
-    PlayerKam( Framework::Bildschirm3D* zScreen );
-    void setDirection( Framework::Vec3<float> direction );
-    void doTastaturEreignis( Framework::TastaturEreignis& te ) override;
-    void doMausEreignis( Framework::MausEreignis& me ) override;
-    bool tick( double time ) override;
+	PlayerKam(Framework::Bildschirm3D* zScreen);
+	void setDirection(Framework::Vec3<float> direction);
+	void doTastaturEreignis(Framework::TastaturEreignis& te) override;
+	void doMausEreignis(Framework::MausEreignis& me) override;
+	bool tick(double time) override;
+	void setEntityId(int id);
 };

+ 0 - 11
FactoryCraft/StaticInitializerOrder.cpp

@@ -2,10 +2,7 @@
 
 #include "Registries.h"
 
-int count_ItemType = 0;
-int count_BlockType = 0;
 int count_WorldUpdateType = 0;
-int count_EntityType = 0;
 
 #undef REGISTER
 #define REGISTER(c, typ)               \
@@ -14,17 +11,9 @@ const c *c::INSTANCE = new c();
 
 // order of includes determines the ids
 
-// block types
-#include "NoBlock.h" // must be first
-#include "BasicBlocks.h"
-// entities
-#include "Player.h"
-#include "ItemEntity.h"
 // world updates
 #include "AddChunkUpdate.h"
 #include "PlaceBlockUpdate.h"
-#include "BlockChangedUpdate.h"
 #include "BlockRemovedUpdate.h"
 #include "AddEntityUpdate.h"
-#include "EntityChangedUpdate.h"
 #include "EntityRemovedUpdate.h"

+ 44 - 44
FactoryCraft/StaticRegistry.h

@@ -14,55 +14,55 @@ template<typename T>
 class StaticRegistry
 {
 private:
-    T** registry;
-    int count;
+	T** registry;
+	int count;
 
 public:
-    StaticRegistry()
-    {
-        count = 1;
-        registry = new T * [ count ];
-        memset( registry, 0, sizeof( T* ) * count );
-    }
+	StaticRegistry()
+	{
+		count = 1;
+		registry = new T * [count];
+		memset(registry, 0, sizeof(T*) * count);
+	}
 
-    ~StaticRegistry()
-    {
-        for( int index = 0; index < count; index++ )
-        {
-            if( registry[ index ] )
-            {
-                registry[ index ]->release();
-                registry[ index ] = 0;
-            }
-        }
-        delete[]registry;
-    }
+	~StaticRegistry()
+	{
+		for (int index = 0; index < count; index++)
+		{
+			if (registry[index])
+			{
+				registry[index]->release();
+				registry[index] = 0;
+			}
+		}
+		delete[]registry;
+	}
 
-    void registerT( T* type, int id )
-    {
-        if( id >= count )
-        {
-            T** temp = new T * [ id + 1 ];
-            memcpy( temp, registry, sizeof( T* ) * count );
-            memset( temp + count, 0, sizeof( T* ) * (id + 1 - count) );
-            delete[]registry;
-            registry = temp;
-            count = id + 1;
-        }
-        registry[ id ] = type;
-    }
+	void registerT(T* type, int id)
+	{
+		if (id >= count)
+		{
+			T** temp = new T * [id + 1];
+			memcpy(temp, registry, sizeof(T*) * count);
+			memset(temp + count, 0, sizeof(T*) * (id + 1 - count));
+			delete[]registry;
+			registry = temp;
+			count = id + 1;
+		}
+		registry[id] = type;
+	}
 
-    T* zElement( int id )
-    {
-        if( id < 0 || id >= count )
-            return 0;
-        return registry[ id ];
-    }
+	T* zElement(int id)
+	{
+		if (id < 0 || id >= count)
+			return 0;
+		return registry[id];
+	}
 
-    int getCount() const
-    {
-        return count;
-    }
+	int getCount() const
+	{
+		return count;
+	}
 
-    friend T;
+	friend T;
 };

+ 21 - 66
FactoryCraft/World.cpp

@@ -7,7 +7,6 @@
 #include "WorldUpdate.h"
 #include "Constants.h"
 #include "Registries.h"
-#include "BasicBlocks.h"
 #include "Game.h"
 #include <AsynchronCall.h>
 
@@ -20,7 +19,7 @@ World::World(Bildschirm3D* zScreen)
 {
 	renderedWorld = new Welt3D();
 	renderedWorld->addDiffuseLight(DiffuseLight{ Vec3<float>(0.5f, 0.5f, -1.f), Vec3<float>(1.f, 1.f, 1.f) });
-	dimensions = new RCArray<Dimension>();
+	currentDimension = new Dimension();
 	zScreenPtr = zScreen;
 	kam = new PlayerKam(zScreen);
 	kam->setWelt(renderedWorld);
@@ -36,7 +35,7 @@ World::World(Bildschirm3D* zScreen)
 World::~World()
 {
 	zScreenPtr->removeKamera(kam);
-	dimensions->release();
+	currentDimension->release();
 	if (currentTarget)
 		currentTarget->release();
 }
@@ -64,10 +63,7 @@ void World::update(bool background)
 			{
 			case 1: // dimension message
 			{
-				int dimId = *(int*)(data + 1);
-				Dimension* dim = zDimension(dimId);
-				if (dim)
-					dim->api(data + 5);
+				currentDimension->api(data + 1);
 				break;
 			}
 			case 2: // gui message
@@ -80,6 +76,7 @@ void World::update(bool background)
 		if (type == 4) // POSITION UPDATE
 		{
 			serverMessageReader->lese((char*)&ownEntityId, 4);
+			kam->setEntityId(ownEntityId);
 		}
 		network->zFactoryClient()->endMessageReading(background);
 	}
@@ -88,23 +85,16 @@ void World::update(bool background)
 	if (player)
 	{
 		renderedWorld->lock();
-		for (Dimension* dim : *dimensions)
-			dim->removeDistantChunks({ (int)player->getPos().x, (int)player->getPos().y }, this);
+		currentDimension->removeDistantChunks({ (int)player->getPos().x, (int)player->getPos().y }, this);
 		renderedWorld->unlock();
 	}
 }
 
-void World::setChunk(Chunk* chunk, int dimensionId)
+void World::setChunk(Chunk* chunk)
 {
 	zScreenPtr->lock();
 	renderedWorld->lock();
-	Dimension* zDim = zDimension(dimensionId);
-	if (!zDim)
-	{
-		zDim = new Dimension(dimensionId);
-		dimensions->add(zDim);
-	}
-	zDim->setChunk(chunk, chunk->getCenter(), this);
+	currentDimension->setChunk(chunk, chunk->getCenter(), this);
 	renderedWorld->unlock();
 	zScreenPtr->unlock();
 }
@@ -140,43 +130,21 @@ void World::thread()
 	}
 }
 
-Block* World::zBlockAt(Framework::Vec3<int> location, int dimension) const
+Block* World::zBlockAt(Framework::Vec3<int> location) const
 {
-	Dimension* dim = zDimension(dimension);
-	if (dim)
-		return dim->zBlock(location);
+	return currentDimension->zBlock(location);
 	return 0;
 }
 
-Block* World::getBlockAt(Framework::Vec3<int> location, int dimension) const
+Block* World::getBlockAt(Framework::Vec3<int> location) const
 {
-	Dimension* dim = zDimension(dimension);
-	if (dim)
-		return dim->getBlock(location);
+	return currentDimension->getBlock(location);
 	return 0;
 }
 
-Dimension* World::zDimension(int id) const
+Dimension* World::zDimension() const
 {
-	for (auto dim : *dimensions)
-	{
-		if (dim->getDimensionId() == id)
-			return dim;
-	}
-	return 0;
-}
-
-Dimension* World::zDimensionOrCreate(int id)
-{
-	zScreenPtr->lock();
-	Dimension* d = zDimension(id);
-	if (!d)
-	{
-		d = new Dimension(id);
-		dimensions->add(d);
-	}
-	zScreenPtr->unlock();
-	return d;
+	return currentDimension;
 }
 
 void World::setVisibility(Chunk* zChunk, bool visible)
@@ -206,30 +174,23 @@ Framework::Punkt World::getChunkCenter(int x, int y) const
 
 Entity* World::zEntity(int id) const
 {
-	for (Dimension* d : *dimensions)
-	{
-		Entity* e = d->zEntity(id);
-		if (e)
-			return e;
-	}
+	Entity* e = currentDimension->zEntity(id);
+	if (e)
+		return e;
 	return 0;
 }
 
 Entity* World::getEntity(int id) const
 {
-	for (Dimension* d : *dimensions)
-	{
-		Entity* e = d->getEntity(id);
-		if (e)
-			return e;
-	}
+	Entity* e = currentDimension->getEntity(id);
+	if (e)
+		return e;
 	return 0;
 }
 
 void World::removeEntity(int id)
 {
-	for (Dimension* d : *dimensions)
-		d->removeEntity(id);
+	currentDimension->removeEntity(id);
 }
 
 PlayerKam* World::zKamera() const
@@ -244,13 +205,7 @@ int World::getCurrentPlayerId() const
 
 Entity* World::getCurrentPlayerEntity() const
 {
-	for (Dimension* d : *dimensions)
-	{
-		Entity* e = d->zEntity(ownEntityId);
-		if (e)
-			return e;
-	}
-	return 0;
+	return zEntity(ownEntityId);
 }
 
 void World::setTarget(Framework::Model3D* zTarget)

+ 5 - 6
FactoryCraft/World.h

@@ -11,7 +11,7 @@
 class World : public Framework::Thread
 {
 private:
-	Framework::RCArray<Dimension>* dimensions;
+	Dimension* currentDimension;
 	Framework::Welt3D* renderedWorld;
 	Framework::Bildschirm3D* zScreenPtr;
 	PlayerKam* kam;
@@ -26,13 +26,12 @@ public:
 	World(Framework::Bildschirm3D* zScreen);
 	~World();
 	void update(bool background);
-	void setChunk(Chunk* chunk, int dimensionId);
+	void setChunk(Chunk* chunk);
 	void thread() override;
 
-	Block* zBlockAt(Framework::Vec3<int> location, int dimension) const;
-	Block* getBlockAt(Framework::Vec3<int> location, int dimension) const;
-	Dimension* zDimension(int id) const;
-	Dimension* zDimensionOrCreate(int id);
+	Block* zBlockAt(Framework::Vec3<int> location) const;
+	Block* getBlockAt(Framework::Vec3<int> location) const;
+	Dimension* zDimension() const;
 	void setVisibility(Chunk* zChunk, bool visible);
 	void setVisibility(Entity* zEntity, bool visible);
 	Framework::Punkt getChunkCenter(int x, int y) const;

+ 16 - 16
FactoryCraft/WorldUpdate.cpp

@@ -3,24 +3,24 @@
 #include "Registries.h"
 #include <Text.h>
 
-WorldUpdateType::WorldUpdateType( int id )
-    : ReferenceCounter(),
-    id( id )
+WorldUpdateType::WorldUpdateType(int id)
+	: ReferenceCounter(),
+	id(id)
 {
-    STATIC_REGISTRY( WorldUpdateType ).registerT( this, id );
+	STATIC_REGISTRY(WorldUpdateType).registerT(this, id);
 }
 
-void WorldUpdateType::applyUpdateAndCheck( Framework::StreamReader* zReader )
+void WorldUpdateType::applyUpdateAndCheck(Framework::StreamReader* zReader)
 {
-    this->applyUpdate( zReader );
-    int id;
-    zReader->lese( (char*)&id, 4 );
-    if( id != this->id )
-    {
-        Framework::Text* t = new Framework::Text( "asynchony after world update of type " );
-        t->append( this->id );
-        t->append( ". ID received from server was: " );
-        t->append( id );
-        throw t->getText();
-    }
+	this->applyUpdate(zReader);
+	int id;
+	zReader->lese((char*)&id, 4);
+	if (id != this->id)
+	{
+		Framework::Text* t = new Framework::Text("asynchony after world update of type ");
+		t->append(this->id);
+		t->append(". ID received from server was: ");
+		t->append(id);
+		throw t->getText();
+	}
 }

+ 4 - 4
FactoryCraft/WorldUpdate.h

@@ -8,12 +8,12 @@
 class WorldUpdateType : public Framework::ReferenceCounter
 {
 private:
-    int id;
+	int id;
 
 protected:
-    WorldUpdateType( int id );
-    virtual void applyUpdate( Framework::StreamReader* zReader ) = 0;
+	WorldUpdateType(int id);
+	virtual void applyUpdate(Framework::StreamReader* zReader) = 0;
 
 public:
-    void applyUpdateAndCheck( Framework::StreamReader* zReader );
+	void applyUpdateAndCheck(Framework::StreamReader* zReader);
 };