mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-19 08:06:42 +00:00
Added Game's constructor. Added the Person struct and made Game constructor read in the list of persons from INIT.DFW. Added Game instance to DraciEngine.
svn-id: r41907
This commit is contained in:
parent
c1644493b8
commit
0430939006
@ -69,6 +69,7 @@ int DraciEngine::init() {
|
||||
_screen = new Screen(this);
|
||||
_font = new Font();
|
||||
_mouse = new Mouse(this);
|
||||
_game = new Game();
|
||||
|
||||
// Load default font
|
||||
_font->setFont(kFontBig);
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "engines/engine.h"
|
||||
#include "engines/advancedDetector.h"
|
||||
|
||||
#include "draci/game.h"
|
||||
#include "draci/mouse.h"
|
||||
#include "draci/screen.h"
|
||||
#include "draci/font.h"
|
||||
@ -50,6 +51,7 @@ public:
|
||||
Font *_font;
|
||||
Screen *_screen;
|
||||
Mouse *_mouse;
|
||||
Game *_game;
|
||||
|
||||
private:
|
||||
Common::RandomSource _rnd;
|
||||
|
@ -23,4 +23,31 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/stream.h"
|
||||
|
||||
#include "draci/draci.h"
|
||||
#include "draci/game.h"
|
||||
#include "draci/barchive.h"
|
||||
|
||||
namespace Draci {
|
||||
|
||||
Game::Game() {
|
||||
Common::String path("INIT.DFW");
|
||||
|
||||
BArchive initArchive(path);
|
||||
BAFile *file;
|
||||
|
||||
file = initArchive[5];
|
||||
Common::MemoryReadStream reader(file->_data, file->_length);
|
||||
|
||||
unsigned int numPersons = file->_length / personSize;
|
||||
_persons = new Person[numPersons];
|
||||
|
||||
for (unsigned int i = 0; i < numPersons; ++i) {
|
||||
_persons[i]._x = reader.readByte();
|
||||
_persons[i]._y = reader.readByte();
|
||||
_persons[i]._fontColour = reader.readUint16LE();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,9 +26,27 @@
|
||||
#ifndef DRACI_GAME_H
|
||||
#define DRACI_GAME_H
|
||||
|
||||
#include "common/str.h"
|
||||
|
||||
namespace Draci {
|
||||
|
||||
enum StructSizes {
|
||||
personSize = 3
|
||||
};
|
||||
|
||||
struct Person {
|
||||
uint16 _x, _y;
|
||||
byte _fontColour;
|
||||
};
|
||||
|
||||
class Game {
|
||||
|
||||
public:
|
||||
Game();
|
||||
~Game();
|
||||
|
||||
private:
|
||||
Person *_persons;
|
||||
};
|
||||
|
||||
} // End of namespace Draci
|
||||
|
Loading…
Reference in New Issue
Block a user