Merge branch 'GameLogic-LevelFormat' of https://github.com/dean11/Danbias into GameLogic-LevelFormat
This commit is contained in:
commit
d6432b2c73
|
@ -1,5 +1,7 @@
|
||||||
#include "LevelParser.h"
|
#include "LevelParser.h"
|
||||||
|
|
||||||
|
#include "Loader.h"
|
||||||
|
|
||||||
using namespace GameLogic;
|
using namespace GameLogic;
|
||||||
using namespace ::LevelFileLoader;
|
using namespace ::LevelFileLoader;
|
||||||
|
|
||||||
|
@ -15,6 +17,8 @@ LevelParser::~LevelParser()
|
||||||
std::vector<ObjectTypeHeader> LevelParser::Parse(std::string filename)
|
std::vector<ObjectTypeHeader> LevelParser::Parse(std::string filename)
|
||||||
{
|
{
|
||||||
//Read entire level file.
|
//Read entire level file.
|
||||||
|
Loader loader;
|
||||||
|
unsigned char* buffer = (unsigned char*)loader.LoadFile(filename.c_str());
|
||||||
|
|
||||||
std::vector<ObjectTypeHeader> objects;
|
std::vector<ObjectTypeHeader> objects;
|
||||||
|
|
||||||
|
@ -25,6 +29,7 @@ std::vector<ObjectTypeHeader> LevelParser::Parse(std::string filename)
|
||||||
//Get typeID
|
//Get typeID
|
||||||
int typeID = 0;
|
int typeID = 0;
|
||||||
|
|
||||||
|
//Unpack ID
|
||||||
|
|
||||||
switch(typeID)
|
switch(typeID)
|
||||||
{
|
{
|
||||||
|
@ -50,6 +55,8 @@ std::vector<ObjectTypeHeader> LevelParser::Parse(std::string filename)
|
||||||
ObjectTypeHeader LevelParser::ParseHeader(std::string filename)
|
ObjectTypeHeader LevelParser::ParseHeader(std::string filename)
|
||||||
{
|
{
|
||||||
//Read entire level file.
|
//Read entire level file.
|
||||||
|
Loader loader;
|
||||||
|
unsigned char* buffer = (unsigned char*)loader.LoadFile(filename.c_str());
|
||||||
|
|
||||||
//Find the header in the returned string.
|
//Find the header in the returned string.
|
||||||
unsigned int counter = 0;
|
unsigned int counter = 0;
|
||||||
|
@ -65,7 +72,8 @@ ObjectTypeHeader LevelParser::ParseHeader(std::string filename)
|
||||||
{
|
{
|
||||||
case TypeID_LevelHeader:
|
case TypeID_LevelHeader:
|
||||||
//Call function
|
//Call function
|
||||||
|
|
||||||
|
counter += LevelHeaderSize;
|
||||||
break;
|
break;
|
||||||
case TypeID_Object:
|
case TypeID_Object:
|
||||||
//Call function
|
//Call function
|
||||||
|
|
Loading…
Reference in New Issue