Merge branch 'GameLogic-LevelFormat' of https://github.com/dean11/Danbias into GameLogic-LevelFormat
Conflicts: Code/Dokumentation/LevelLoader.uxf Code/Game/GameLogic/GameLogic.vcxproj
This commit is contained in:
commit
3c1d66e3f8
|
@ -2,22 +2,21 @@
|
||||||
<diagram program="umlet" version="12.0">
|
<diagram program="umlet" version="12.0">
|
||||||
<zoom_level>8</zoom_level>
|
<zoom_level>8</zoom_level>
|
||||||
<element>
|
<element>
|
||||||
<type>com.umlet.element.Class</type>
|
<type>com.umlet.element.Relation</type>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>624</x>
|
<x>640</x>
|
||||||
<y>208</y>
|
<y>256</y>
|
||||||
<w>80</w>
|
<w>40</w>
|
||||||
<h>24</h>
|
<h>168</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>LevelLoader
|
<panel_attributes>lt=<<.</panel_attributes>
|
||||||
</panel_attributes>
|
<additional_attributes>24;24;24;152</additional_attributes>
|
||||||
<additional_attributes/>
|
|
||||||
</element>
|
</element>
|
||||||
<element>
|
<element>
|
||||||
<type>com.umlet.element.Relation</type>
|
<type>com.umlet.element.Relation</type>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>840</x>
|
<x>840</x>
|
||||||
<y>208</y>
|
<y>256</y>
|
||||||
<w>88</w>
|
<w>88</w>
|
||||||
<h>168</h>
|
<h>168</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
|
@ -25,150 +24,11 @@
|
||||||
<Uses</panel_attributes>
|
<Uses</panel_attributes>
|
||||||
<additional_attributes>24;24;24;64;72;64;72;152</additional_attributes>
|
<additional_attributes>24;24;24;64;72;64;72;152</additional_attributes>
|
||||||
</element>
|
</element>
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Class</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>928</x>
|
|
||||||
<y>560</y>
|
|
||||||
<w>200</w>
|
|
||||||
<h>120</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>Collection of functions
|
|
||||||
<<lots of functions>>
|
|
||||||
--
|
|
||||||
functions for creating the right structs</panel_attributes>
|
|
||||||
<additional_attributes/>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Class</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>440</x>
|
|
||||||
<y>88</y>
|
|
||||||
<w>128</w>
|
|
||||||
<h>40</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>GameLogic
|
|
||||||
<<Erik>></panel_attributes>
|
|
||||||
<additional_attributes/>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Relation</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>680</x>
|
|
||||||
<y>176</y>
|
|
||||||
<w>152</w>
|
|
||||||
<h>56</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>lt=-
|
|
||||||
m1=1..1
|
|
||||||
m2=1..1
|
|
||||||
Uses></panel_attributes>
|
|
||||||
<additional_attributes>24;40;136;40</additional_attributes>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Class</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>800</x>
|
|
||||||
<y>360</y>
|
|
||||||
<w>208</w>
|
|
||||||
<h>136</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes><<Interface>>
|
|
||||||
Loader
|
|
||||||
--
|
|
||||||
Functions:
|
|
||||||
wchar* LoadFile(string fileName);
|
|
||||||
//Model* LoadHitBoxes(string modelName);
|
|
||||||
//Model* LoadHitBoxes(int modelID);
|
|
||||||
-
|
|
||||||
Privates:</panel_attributes>
|
|
||||||
<additional_attributes/>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Relation</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>344</x>
|
|
||||||
<y>208</y>
|
|
||||||
<w>40</w>
|
|
||||||
<h>168</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>lt=<<.</panel_attributes>
|
|
||||||
<additional_attributes>24;24;24;152</additional_attributes>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Relation</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>768</x>
|
|
||||||
<y>576</y>
|
|
||||||
<w>176</w>
|
|
||||||
<h>56</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>lt=-
|
|
||||||
m1=1..1
|
|
||||||
m2=1..1
|
|
||||||
Uses></panel_attributes>
|
|
||||||
<additional_attributes>24;40;160;40</additional_attributes>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Class</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>816</x>
|
|
||||||
<y>192</y>
|
|
||||||
<w>128</w>
|
|
||||||
<h>40</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>Resource Loader
|
|
||||||
<<Dennis>><<Singleton></panel_attributes>
|
|
||||||
<additional_attributes/>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Relation</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>768</x>
|
|
||||||
<y>472</y>
|
|
||||||
<w>136</w>
|
|
||||||
<h>104</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>lt=<<<<-</panel_attributes>
|
|
||||||
<additional_attributes>120;24;120;88;24;88</additional_attributes>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Relation</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>384</x>
|
|
||||||
<y>176</y>
|
|
||||||
<w>256</w>
|
|
||||||
<h>56</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>lt=->>>>
|
|
||||||
m1=1..1
|
|
||||||
m2=1..1
|
|
||||||
<Knows about</panel_attributes>
|
|
||||||
<additional_attributes>240;40;24;40</additional_attributes>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Class</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>256</x>
|
|
||||||
<y>360</y>
|
|
||||||
<w>232</w>
|
|
||||||
<h>104</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>Defines.h
|
|
||||||
<<Header file>>
|
|
||||||
--
|
|
||||||
Enum ObjectType(static, dynamic, specials);
|
|
||||||
.
|
|
||||||
Struct static;
|
|
||||||
Struct dynamic;
|
|
||||||
Struct specials</panel_attributes>
|
|
||||||
<additional_attributes/>
|
|
||||||
</element>
|
|
||||||
<element>
|
<element>
|
||||||
<type>com.umlet.element.Class</type>
|
<type>com.umlet.element.Class</type>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>560</x>
|
<x>560</x>
|
||||||
<y>360</y>
|
<y>408</y>
|
||||||
<w>232</w>
|
<w>232</w>
|
||||||
<h>136</h>
|
<h>136</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
|
@ -184,69 +44,34 @@ Privates:
|
||||||
</panel_attributes>
|
</panel_attributes>
|
||||||
<additional_attributes/>
|
<additional_attributes/>
|
||||||
</element>
|
</element>
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Relation</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>640</x>
|
|
||||||
<y>208</y>
|
|
||||||
<w>40</w>
|
|
||||||
<h>168</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>lt=<<.</panel_attributes>
|
|
||||||
<additional_attributes>24;24;24;152</additional_attributes>
|
|
||||||
</element>
|
|
||||||
<element>
|
<element>
|
||||||
<type>com.umlet.element.Class</type>
|
<type>com.umlet.element.Class</type>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>328</x>
|
<x>440</x>
|
||||||
<y>208</y>
|
<y>136</y>
|
||||||
<w>80</w>
|
<w>128</w>
|
||||||
<h>24</h>
|
<h>40</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>Defines</panel_attributes>
|
<panel_attributes>GameLogic
|
||||||
|
<<Erik>></panel_attributes>
|
||||||
<additional_attributes/>
|
<additional_attributes/>
|
||||||
</element>
|
</element>
|
||||||
<element>
|
<element>
|
||||||
<type>com.umlet.element.Package</type>
|
<type>com.umlet.element.Package</type>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>248</x>
|
<x>552</x>
|
||||||
<y>320</y>
|
<y>368</y>
|
||||||
<w>248</w>
|
<w>584</w>
|
||||||
<h>160</h>
|
<h>368</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>Defines</panel_attributes>
|
<panel_attributes>LevelLoader</panel_attributes>
|
||||||
<additional_attributes/>
|
<additional_attributes/>
|
||||||
</element>
|
</element>
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Relation</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>544</x>
|
|
||||||
<y>64</y>
|
|
||||||
<w>136</w>
|
|
||||||
<h>160</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>lt=lt=->>>>
|
|
||||||
m1=1..1
|
|
||||||
m2=1..1
|
|
||||||
Uses></panel_attributes>
|
|
||||||
<additional_attributes>24;40;80;40;120;40;120;144</additional_attributes>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<type>com.umlet.element.Relation</type>
|
|
||||||
<coordinates>
|
|
||||||
<x>656</x>
|
|
||||||
<y>472</y>
|
|
||||||
<w>40</w>
|
|
||||||
<h>88</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>lt=<<<<-</panel_attributes>
|
|
||||||
<additional_attributes>24;72;24;24</additional_attributes>
|
|
||||||
</element>
|
|
||||||
<element>
|
<element>
|
||||||
<type>com.umlet.element.Class</type>
|
<type>com.umlet.element.Class</type>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>560</x>
|
<x>560</x>
|
||||||
<y>544</y>
|
<y>592</y>
|
||||||
<w>232</w>
|
<w>232</w>
|
||||||
<h>136</h>
|
<h>136</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
|
@ -263,15 +88,190 @@ const int FileVersion;
|
||||||
</panel_attributes>
|
</panel_attributes>
|
||||||
<additional_attributes/>
|
<additional_attributes/>
|
||||||
</element>
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Class</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>928</x>
|
||||||
|
<y>608</y>
|
||||||
|
<w>200</w>
|
||||||
|
<h>120</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes>Collection of functions
|
||||||
|
<<lots of functions>>
|
||||||
|
--
|
||||||
|
functions for creating the right structs</panel_attributes>
|
||||||
|
<additional_attributes/>
|
||||||
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Relation</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>768</x>
|
||||||
|
<y>520</y>
|
||||||
|
<w>136</w>
|
||||||
|
<h>104</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes>lt=<<<<-</panel_attributes>
|
||||||
|
<additional_attributes>120;24;120;88;24;88</additional_attributes>
|
||||||
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Class</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>800</x>
|
||||||
|
<y>408</y>
|
||||||
|
<w>208</w>
|
||||||
|
<h>136</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes><<Interface>>
|
||||||
|
Loader
|
||||||
|
--
|
||||||
|
Functions:
|
||||||
|
wchar* LoadFile(string fileName);
|
||||||
|
//Model* LoadHitBoxes(string modelName);
|
||||||
|
//Model* LoadHitBoxes(int modelID);
|
||||||
|
-
|
||||||
|
Privates:</panel_attributes>
|
||||||
|
<additional_attributes/>
|
||||||
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Relation</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>656</x>
|
||||||
|
<y>520</y>
|
||||||
|
<w>40</w>
|
||||||
|
<h>88</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes>lt=<<<<-</panel_attributes>
|
||||||
|
<additional_attributes>24;72;24;24</additional_attributes>
|
||||||
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Class</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>328</x>
|
||||||
|
<y>256</y>
|
||||||
|
<w>80</w>
|
||||||
|
<h>24</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes>Defines</panel_attributes>
|
||||||
|
<additional_attributes/>
|
||||||
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Relation</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>680</x>
|
||||||
|
<y>224</y>
|
||||||
|
<w>152</w>
|
||||||
|
<h>56</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes>lt=-
|
||||||
|
m1=1..1
|
||||||
|
m2=1..1
|
||||||
|
Uses></panel_attributes>
|
||||||
|
<additional_attributes>24;40;136;40</additional_attributes>
|
||||||
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Class</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>624</x>
|
||||||
|
<y>256</y>
|
||||||
|
<w>80</w>
|
||||||
|
<h>24</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes>LevelLoader
|
||||||
|
</panel_attributes>
|
||||||
|
<additional_attributes/>
|
||||||
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Relation</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>344</x>
|
||||||
|
<y>256</y>
|
||||||
|
<w>40</w>
|
||||||
|
<h>168</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes>lt=<<.</panel_attributes>
|
||||||
|
<additional_attributes>24;24;24;152</additional_attributes>
|
||||||
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Relation</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>384</x>
|
||||||
|
<y>224</y>
|
||||||
|
<w>256</w>
|
||||||
|
<h>56</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes>lt=->>>>
|
||||||
|
m1=1..1
|
||||||
|
m2=1..1
|
||||||
|
<Knows about</panel_attributes>
|
||||||
|
<additional_attributes>240;40;24;40</additional_attributes>
|
||||||
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Relation</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>544</x>
|
||||||
|
<y>112</y>
|
||||||
|
<w>136</w>
|
||||||
|
<h>160</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes>lt=lt=->>>>
|
||||||
|
m1=1..1
|
||||||
|
m2=1..1
|
||||||
|
Uses></panel_attributes>
|
||||||
|
<additional_attributes>24;40;80;40;120;40;120;144</additional_attributes>
|
||||||
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Relation</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>768</x>
|
||||||
|
<y>624</y>
|
||||||
|
<w>176</w>
|
||||||
|
<h>56</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes>lt=-
|
||||||
|
m1=1..1
|
||||||
|
m2=1..1
|
||||||
|
Uses></panel_attributes>
|
||||||
|
<additional_attributes>24;40;160;40</additional_attributes>
|
||||||
|
</element>
|
||||||
<element>
|
<element>
|
||||||
<type>com.umlet.element.Package</type>
|
<type>com.umlet.element.Package</type>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>552</x>
|
<x>248</x>
|
||||||
<y>320</y>
|
<y>368</y>
|
||||||
<w>584</w>
|
<w>248</w>
|
||||||
<h>368</h>
|
<h>160</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>LevelLoader</panel_attributes>
|
<panel_attributes>Defines</panel_attributes>
|
||||||
|
<additional_attributes/>
|
||||||
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Class</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>256</x>
|
||||||
|
<y>408</y>
|
||||||
|
<w>232</w>
|
||||||
|
<h>104</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes>Defines.h
|
||||||
|
<<Header file>>
|
||||||
|
--
|
||||||
|
Enum ObjectType(static, dynamic, specials);
|
||||||
|
.
|
||||||
|
Struct static;
|
||||||
|
Struct dynamic;
|
||||||
|
Struct specials</panel_attributes>
|
||||||
|
<additional_attributes/>
|
||||||
|
</element>
|
||||||
|
<element>
|
||||||
|
<type>com.umlet.element.Class</type>
|
||||||
|
<coordinates>
|
||||||
|
<x>816</x>
|
||||||
|
<y>240</y>
|
||||||
|
<w>128</w>
|
||||||
|
<h>40</h>
|
||||||
|
</coordinates>
|
||||||
|
<panel_attributes>Resource Loader
|
||||||
|
<<Dennis>><<Singleton></panel_attributes>
|
||||||
<additional_attributes/>
|
<additional_attributes/>
|
||||||
</element>
|
</element>
|
||||||
</diagram>
|
</diagram>
|
||||||
|
|
|
@ -187,6 +187,8 @@
|
||||||
<ClInclude Include="LevelLoader.h" />
|
<ClInclude Include="LevelLoader.h" />
|
||||||
<ClInclude Include="Loader.h" />
|
<ClInclude Include="Loader.h" />
|
||||||
<ClInclude Include="Object.h" />
|
<ClInclude Include="Object.h" />
|
||||||
|
<ClInclude Include="ObjectDefines.h" />
|
||||||
|
<ClInclude Include="LevelParser.h" />
|
||||||
<ClInclude Include="Player.h" />
|
<ClInclude Include="Player.h" />
|
||||||
<ClInclude Include="StaticObject.h" />
|
<ClInclude Include="StaticObject.h" />
|
||||||
<ClInclude Include="Team.h" />
|
<ClInclude Include="Team.h" />
|
||||||
|
@ -206,6 +208,7 @@
|
||||||
<ClCompile Include="Level.cpp" />
|
<ClCompile Include="Level.cpp" />
|
||||||
<ClCompile Include="LevelLoader.cpp" />
|
<ClCompile Include="LevelLoader.cpp" />
|
||||||
<ClCompile Include="Loader.cpp" />
|
<ClCompile Include="Loader.cpp" />
|
||||||
|
<ClCompile Include="LevelParser.cpp" />
|
||||||
<ClCompile Include="Object.cpp" />
|
<ClCompile Include="Object.cpp" />
|
||||||
<ClCompile Include="Player.cpp" />
|
<ClCompile Include="Player.cpp" />
|
||||||
<ClCompile Include="StaticObject.cpp" />
|
<ClCompile Include="StaticObject.cpp" />
|
||||||
|
|
|
@ -4,14 +4,15 @@
|
||||||
|
|
||||||
#include "LevelLoader.h"
|
#include "LevelLoader.h"
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
using namespace GameLogic::LevelLoader;
|
using namespace GameLogic::LevelFileLoader;
|
||||||
|
|
||||||
|
|
||||||
std::vector<ObjectTypeHeader> LevelLoader::LoadLevel(std::string fileName)
|
std::vector<ObjectTypeHeader> LevelLoader::LoadLevel(std::string fileName)
|
||||||
{
|
{
|
||||||
Parser->parse(fileName);
|
return parser->Parse(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ObjectTypeHeader> LevelLoader::LoadLevelHeader(std::string fileName)
|
ObjectTypeHeader LevelLoader::LoadLevelHeader(std::string fileName)
|
||||||
{
|
{
|
||||||
parser->parseHeader(fileName);
|
return parser->ParseHeader(fileName);
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@
|
||||||
#ifndef LEVELLOADER_H
|
#ifndef LEVELLOADER_H
|
||||||
#define LEVELLOADER_H
|
#define LEVELLOADER_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <Vector.h>
|
#include <Vector.h>
|
||||||
#include "ObjectDefines.h"
|
#include "ObjectDefines.h"
|
||||||
|
@ -16,13 +17,13 @@ namespace GameLogic
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LevelLoader(){this->parser = new Parser()};
|
LevelLoader(){this->parser = new GameLogic::LevelFileLoader::LevelParser(); }
|
||||||
~LevelLoader(){};
|
~LevelLoader(){}
|
||||||
std::vector<ObjectTypeHeader> LoadLevel(std::string fileName); //loads the level and objects from file
|
std::vector<ObjectTypeHeader> LoadLevel(std::string fileName); //loads the level and objects from file
|
||||||
std::vector<ObjectTypeHeader> LoadLevelHeader(std::string fileName); //just for fast access for the meta information about the level.
|
ObjectTypeHeader LoadLevelHeader(std::string fileName); //just for fast access for the meta information about the level.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LevelParser parser;
|
GameLogic::LevelFileLoader::LevelParser *parser;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
#include "LevelParser.h"
|
||||||
|
|
||||||
|
using namespace GameLogic;
|
||||||
|
using namespace ::LevelFileLoader;
|
||||||
|
|
||||||
|
LevelParser::LevelParser()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LevelParser::~LevelParser()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
std::vector<ObjectTypeHeader> LevelParser::Parse(std::string filename)
|
||||||
|
{
|
||||||
|
//Read entire level file.
|
||||||
|
|
||||||
|
std::vector<ObjectTypeHeader> objects;
|
||||||
|
|
||||||
|
unsigned int counter = 0;
|
||||||
|
unsigned int stringSize = 0;
|
||||||
|
while(counter < stringSize)
|
||||||
|
{
|
||||||
|
//Get typeID
|
||||||
|
int typeID = 0;
|
||||||
|
|
||||||
|
|
||||||
|
switch(typeID)
|
||||||
|
{
|
||||||
|
case TypeID_LevelHeader:
|
||||||
|
//Call function
|
||||||
|
counter += LevelHeaderSize;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeID_Object:
|
||||||
|
//Call function
|
||||||
|
counter += ObjectHeaderSize;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//Couldn't find typeID. FAIL!!!!!!
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ObjectTypeHeader LevelParser::ParseHeader(std::string filename)
|
||||||
|
{
|
||||||
|
//Read entire level file.
|
||||||
|
|
||||||
|
//Find the header in the returned string.
|
||||||
|
unsigned int counter = 0;
|
||||||
|
unsigned int stringSize = 0;
|
||||||
|
|
||||||
|
ObjectTypeHeader header;
|
||||||
|
header.typeID = ObjectType_Level;
|
||||||
|
|
||||||
|
while(counter < stringSize)
|
||||||
|
{
|
||||||
|
int typeID = 0;
|
||||||
|
switch(typeID)
|
||||||
|
{
|
||||||
|
case TypeID_LevelHeader:
|
||||||
|
//Call function
|
||||||
|
|
||||||
|
break;
|
||||||
|
case TypeID_Object:
|
||||||
|
//Call function
|
||||||
|
counter += ObjectHeaderSize;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
//Couldn't find typeID. FAIL!!!!!!
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return header;
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
#ifndef LEVEL_PARSER_H
|
||||||
|
#define LEVEL_PARSER_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include "ObjectDefines.h"
|
||||||
|
|
||||||
|
namespace GameLogic
|
||||||
|
{
|
||||||
|
namespace LevelFileLoader
|
||||||
|
{
|
||||||
|
class LevelParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LevelParser();
|
||||||
|
~LevelParser();
|
||||||
|
|
||||||
|
//
|
||||||
|
std::vector<ObjectTypeHeader> Parse(std::string filename);
|
||||||
|
|
||||||
|
//
|
||||||
|
ObjectTypeHeader ParseHeader(std::string filename);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static const int TypeHeaderSize = 4; //Including the TypeID
|
||||||
|
static const int ObjectHeaderSize = 10; //Including modelID, textureID, position, rotation, scale.
|
||||||
|
static const int LevelHeaderSize = 10; //Including Format version, Name, Map version etc.
|
||||||
|
|
||||||
|
static const int FormatVersionMajor = 1;
|
||||||
|
static const int FormatVersionMinor = 0;
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
Question
|
||||||
|
*************************************/
|
||||||
|
//Could we use the IDs in "ObjectDefines.h" or do we have to use our own???
|
||||||
|
enum TypeID
|
||||||
|
{
|
||||||
|
TypeID_LevelHeader,
|
||||||
|
TypeID_Player,
|
||||||
|
TypeID_Object,
|
||||||
|
|
||||||
|
|
||||||
|
TypeID_NUM_OF_TYPES,
|
||||||
|
|
||||||
|
ObjectType_Unknown = -1,
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "Loader.h"
|
#include "Loader.h"
|
||||||
|
|
||||||
using namespace GameLogic::LevelLoader;
|
using namespace GameLogic::LevelFileLoader;
|
||||||
using namespace Oyster::Resource;
|
using namespace Oyster::Resource;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -14,5 +14,5 @@ char* Loader::LoadFile(std::string fileName)
|
||||||
std::wstring temp(fileName.begin(), fileName.end());
|
std::wstring temp(fileName.begin(), fileName.end());
|
||||||
|
|
||||||
//convert from wstring to wchar then loads the file
|
//convert from wstring to wchar then loads the file
|
||||||
return OysterResource::LoadResource(temp.c_str(), Oyster::Resource::ResourceType::ResourceType_Byte_Raw, -1 , false);
|
return (char*)OysterResource::LoadResource(temp.c_str(), Oyster::Resource::ResourceType::ResourceType_Byte_Raw, -1 , false);
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
namespace GameLogic
|
namespace GameLogic
|
||||||
{
|
{
|
||||||
namespace LevelLoader
|
namespace LevelFileLoader
|
||||||
{
|
{
|
||||||
class Loader
|
class Loader
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
#ifndef OBJECT_DEFINES_H
|
||||||
|
#define OBJECT_DEFINES_H
|
||||||
|
|
||||||
|
namespace GameLogic
|
||||||
|
{
|
||||||
|
enum ObjectType
|
||||||
|
{
|
||||||
|
ObjectType_Level,
|
||||||
|
ObjectType_Static,
|
||||||
|
ObjectType_Dynamic,
|
||||||
|
|
||||||
|
|
||||||
|
ObjectType_NUM_OF_TYPES,
|
||||||
|
|
||||||
|
ObjectType_Unknown = -1,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ObjectTypeHeader
|
||||||
|
{
|
||||||
|
ObjectType typeID;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ObjectHeader : public ObjectTypeHeader
|
||||||
|
{
|
||||||
|
//Model,
|
||||||
|
|
||||||
|
//Texture
|
||||||
|
|
||||||
|
//Position
|
||||||
|
float position[3];
|
||||||
|
//Rotation
|
||||||
|
float rotation[3];
|
||||||
|
//Scale
|
||||||
|
float scale[3];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue