At last - credits!
svn-id: r12155
This commit is contained in:
parent
8dabcaaef1
commit
c21e5d797c
8 changed files with 304 additions and 29 deletions
157
queen/credits.cpp
Normal file
157
queen/credits.cpp
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
/* ScummVM - Scumm Interpreter
|
||||||
|
* Copyright (C) 2003 The ScummVM project
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Header$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "queen/credits.h"
|
||||||
|
|
||||||
|
#include "queen/graphics.h"
|
||||||
|
#include "queen/queen.h"
|
||||||
|
#include "queen/resource.h"
|
||||||
|
|
||||||
|
namespace Queen {
|
||||||
|
|
||||||
|
Credits::Credits(QueenEngine *vm, const char* filename) :
|
||||||
|
_vm(vm), _running(true), _count(0), _pause(0), _justify(0), _fontSize(0), _color(0), _zone(0) {
|
||||||
|
_credits = new LineReader(
|
||||||
|
(char*)_vm->resource()->loadFile(filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
Credits::~Credits() {
|
||||||
|
_vm->graphics()->textClear(0, 199);
|
||||||
|
delete _credits;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Credits::nextRoom() {
|
||||||
|
if (-1 == _pause) {
|
||||||
|
_pause = 0;
|
||||||
|
_vm->graphics()->textClear(0, 199);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Credits::update() {
|
||||||
|
if (!_running)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_pause > 0) {
|
||||||
|
_pause--;
|
||||||
|
if (!_pause)
|
||||||
|
_vm->graphics()->textClear(0, 199);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* wait until next room */
|
||||||
|
if (-1 == _pause)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
char *line = _credits->nextLine();
|
||||||
|
|
||||||
|
if (0 == memcmp(line, "EN", 2)) {
|
||||||
|
_running = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('.' == line[0]) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
switch (tolower(line[1])) {
|
||||||
|
|
||||||
|
case 'l' :
|
||||||
|
_justify = 0;
|
||||||
|
break;
|
||||||
|
case 'c' :
|
||||||
|
_justify = 1;
|
||||||
|
break;
|
||||||
|
case 'r' :
|
||||||
|
_justify = 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 's' :
|
||||||
|
_fontSize = 0;
|
||||||
|
break;
|
||||||
|
case 'b' :
|
||||||
|
_fontSize = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'p' :
|
||||||
|
sscanf(&line[3], "%d\n", &_pause);
|
||||||
|
_pause *= 10;
|
||||||
|
|
||||||
|
/* wait until next room */
|
||||||
|
if (0 == _pause)
|
||||||
|
_pause = -1;
|
||||||
|
|
||||||
|
|
||||||
|
for(i = 0; i < _count; i++)
|
||||||
|
{
|
||||||
|
_vm->graphics()->textCurrentColor(_list[i].color);
|
||||||
|
_vm->graphics()->textSet(_list[i].x, _list[i].y, _list[i].text);
|
||||||
|
}
|
||||||
|
|
||||||
|
_count = 0;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case 'i' :
|
||||||
|
sscanf(&line[3], "%d\n", &_color);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '1' :
|
||||||
|
case '2' :
|
||||||
|
case '3' :
|
||||||
|
case '4' :
|
||||||
|
case '5' :
|
||||||
|
case '6' :
|
||||||
|
case '7' :
|
||||||
|
case '8' :
|
||||||
|
case '9' :
|
||||||
|
_zone = line[1] - '1';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_list[_count].text = line;
|
||||||
|
_list[_count].color = _color;
|
||||||
|
_list[_count].fontSize = _fontSize;
|
||||||
|
|
||||||
|
switch (_justify) {
|
||||||
|
case 0:
|
||||||
|
_list[_count].x = (_zone % 3) * (320 / 3) + 8;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
_list[_count].x = (_zone % 3) * (320 / 3) + 54 - _vm->graphics()->textWidth(line) / 2;
|
||||||
|
if (_list[_count].x < 8)
|
||||||
|
_list[_count].x = 8;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
_list[_count].x = (_zone % 3) * (320 / 3) + 100 - _vm->graphics()->textWidth(line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_list[_count].y = (_zone / 3) * (200 / 3) + (_count * 10);
|
||||||
|
_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // End of namespace Queen
|
||||||
|
|
70
queen/credits.h
Normal file
70
queen/credits.h
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
/* ScummVM - Scumm Interpreter
|
||||||
|
* Copyright (C) 2003 The ScummVM project
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Header$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CREDITS_H
|
||||||
|
#define CREDITS_H
|
||||||
|
|
||||||
|
#include "common/util.h"
|
||||||
|
#include "queen/defs.h"
|
||||||
|
|
||||||
|
namespace Queen {
|
||||||
|
|
||||||
|
class QueenEngine;
|
||||||
|
class LineReader;
|
||||||
|
|
||||||
|
class Credits {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Credits(QueenEngine *vm, const char* filename);
|
||||||
|
~Credits();
|
||||||
|
|
||||||
|
void update();
|
||||||
|
void nextRoom();
|
||||||
|
|
||||||
|
bool running() const { return _running; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
QueenEngine *_vm;
|
||||||
|
LineReader *_credits;
|
||||||
|
|
||||||
|
struct Line
|
||||||
|
{
|
||||||
|
short x,y,color,fontSize;
|
||||||
|
char *text;
|
||||||
|
};
|
||||||
|
|
||||||
|
Line _list[15];
|
||||||
|
|
||||||
|
bool _running;
|
||||||
|
int _count;
|
||||||
|
int _pause;
|
||||||
|
int _justify;
|
||||||
|
int _fontSize;
|
||||||
|
int _color;
|
||||||
|
int _zone;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // End of namespace Queen
|
||||||
|
|
||||||
|
#endif
|
|
@ -22,6 +22,7 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "queen/cutaway.h"
|
#include "queen/cutaway.h"
|
||||||
|
|
||||||
|
#include "queen/credits.h"
|
||||||
#include "queen/display.h"
|
#include "queen/display.h"
|
||||||
#include "queen/graphics.h"
|
#include "queen/graphics.h"
|
||||||
#include "queen/input.h"
|
#include "queen/input.h"
|
||||||
|
@ -820,8 +821,8 @@ void Cutaway::handlePersonRecord(
|
||||||
|
|
||||||
if (0 != strcmp(sentence, "*")) {
|
if (0 != strcmp(sentence, "*")) {
|
||||||
if (sentence[0] == '#') {
|
if (sentence[0] == '#') {
|
||||||
warning("Credit scripting system not yet implemented");
|
debug(0, "Starting credits");
|
||||||
// XXX Cinit(sentence + 1);
|
_vm->logic()->startCredits(sentence + 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (object.objectNumber > 0) {
|
if (object.objectNumber > 0) {
|
||||||
|
@ -1095,7 +1096,7 @@ void Cutaway::stop() {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Stop the credits from running
|
// Stop the credits from running
|
||||||
// XXX CFlag = 0;
|
_vm->logic()->stopCredits();
|
||||||
|
|
||||||
_vm->graphics()->bobStopAll();
|
_vm->graphics()->bobStopAll();
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
#include "queen/command.h"
|
#include "queen/command.h"
|
||||||
|
#include "queen/credits.h"
|
||||||
#include "queen/cutaway.h"
|
#include "queen/cutaway.h"
|
||||||
#include "queen/debug.h"
|
#include "queen/debug.h"
|
||||||
#include "queen/defs.h"
|
#include "queen/defs.h"
|
||||||
|
@ -42,7 +43,7 @@
|
||||||
namespace Queen {
|
namespace Queen {
|
||||||
|
|
||||||
Logic::Logic(QueenEngine *vm)
|
Logic::Logic(QueenEngine *vm)
|
||||||
: _vm(vm) {
|
: _queen2jas(NULL), _vm(vm), _credits(NULL) {
|
||||||
_joe.x = _joe.y = 0;
|
_joe.x = _joe.y = 0;
|
||||||
_joe.scale = 100;
|
_joe.scale = 100;
|
||||||
memset(_gameState, 0, sizeof(_gameState));
|
memset(_gameState, 0, sizeof(_gameState));
|
||||||
|
@ -61,6 +62,10 @@ Logic::Logic(QueenEngine *vm)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logic::~Logic() {
|
||||||
|
delete _credits;
|
||||||
|
delete _queen2jas;
|
||||||
|
}
|
||||||
|
|
||||||
void Logic::initialise() {
|
void Logic::initialise() {
|
||||||
|
|
||||||
|
@ -72,6 +77,8 @@ void Logic::initialise() {
|
||||||
uint8 *jas = _vm->resource()->loadFile("QUEEN.JAS", 20);
|
uint8 *jas = _vm->resource()->loadFile("QUEEN.JAS", 20);
|
||||||
uint8 *ptr = jas;
|
uint8 *ptr = jas;
|
||||||
|
|
||||||
|
_queen2jas = new LineReader((char*)_vm->resource()->loadFile("QUEEN2.JAS"));
|
||||||
|
|
||||||
_numRooms = READ_BE_UINT16(ptr); ptr += 2;
|
_numRooms = READ_BE_UINT16(ptr); ptr += 2;
|
||||||
_numNames = READ_BE_UINT16(ptr); ptr += 2;
|
_numNames = READ_BE_UINT16(ptr); ptr += 2;
|
||||||
_numObjects = READ_BE_UINT16(ptr); ptr += 2;
|
_numObjects = READ_BE_UINT16(ptr); ptr += 2;
|
||||||
|
@ -215,7 +222,7 @@ void Logic::initialise() {
|
||||||
_objDescription = new char*[_numDescriptions + 1];
|
_objDescription = new char*[_numDescriptions + 1];
|
||||||
_objDescription[0] = 0;
|
_objDescription[0] = 0;
|
||||||
for (i = 1; i <= _numDescriptions; i++)
|
for (i = 1; i <= _numDescriptions; i++)
|
||||||
_objDescription[i] = _vm->resource()->getJAS2Line();
|
_objDescription[i] = _queen2jas->nextLine();
|
||||||
|
|
||||||
//Patch for German text bug
|
//Patch for German text bug
|
||||||
if (_vm->resource()->getLanguage() == GERMAN) {
|
if (_vm->resource()->getLanguage() == GERMAN) {
|
||||||
|
@ -227,35 +234,35 @@ void Logic::initialise() {
|
||||||
_objName = new char*[_numNames + 1];
|
_objName = new char*[_numNames + 1];
|
||||||
_objName[0] = 0;
|
_objName[0] = 0;
|
||||||
for (i = 1; i <= _numNames; i++)
|
for (i = 1; i <= _numNames; i++)
|
||||||
_objName[i] = _vm->resource()->getJAS2Line();
|
_objName[i] = _queen2jas->nextLine();
|
||||||
|
|
||||||
_roomName = new char*[_numRooms + 1];
|
_roomName = new char*[_numRooms + 1];
|
||||||
_roomName[0] = 0;
|
_roomName[0] = 0;
|
||||||
for (i = 1; i <= _numRooms; i++)
|
for (i = 1; i <= _numRooms; i++)
|
||||||
_roomName[i] = _vm->resource()->getJAS2Line();
|
_roomName[i] = _queen2jas->nextLine();
|
||||||
|
|
||||||
_verbName[0] = 0;
|
_verbName[0] = 0;
|
||||||
for (i = 1; i <= 12; i++)
|
for (i = 1; i <= 12; i++)
|
||||||
_verbName[i] = _vm->resource()->getJAS2Line();
|
_verbName[i] = _queen2jas->nextLine();
|
||||||
|
|
||||||
_joeResponse[0] = 0;
|
_joeResponse[0] = 0;
|
||||||
for (i = 1; i <= JOE_RESPONSE_MAX; i++)
|
for (i = 1; i <= JOE_RESPONSE_MAX; i++)
|
||||||
_joeResponse[i] = _vm->resource()->getJAS2Line();
|
_joeResponse[i] = _queen2jas->nextLine();
|
||||||
|
|
||||||
_aAnim = new char*[_numAAnim + 1];
|
_aAnim = new char*[_numAAnim + 1];
|
||||||
_aAnim[0] = 0;
|
_aAnim[0] = 0;
|
||||||
for (i = 1; i <= _numAAnim; i++)
|
for (i = 1; i <= _numAAnim; i++)
|
||||||
_aAnim[i] = _vm->resource()->getJAS2Line();
|
_aAnim[i] = _queen2jas->nextLine();
|
||||||
|
|
||||||
_aName = new char*[_numAName + 1];
|
_aName = new char*[_numAName + 1];
|
||||||
_aName[0] = 0;
|
_aName[0] = 0;
|
||||||
for (i = 1; i <= _numAName; i++)
|
for (i = 1; i <= _numAName; i++)
|
||||||
_aName[i] = _vm->resource()->getJAS2Line();
|
_aName[i] = _queen2jas->nextLine();
|
||||||
|
|
||||||
_aFile = new char*[_numAFile + 1];
|
_aFile = new char*[_numAFile + 1];
|
||||||
_aFile[0] = 0;
|
_aFile[0] = 0;
|
||||||
for (i = 1; i <= _numAFile; i++)
|
for (i = 1; i <= _numAFile; i++)
|
||||||
_aFile[i] = _vm->resource()->getJAS2Line();
|
_aFile[i] = _queen2jas->nextLine();
|
||||||
|
|
||||||
|
|
||||||
// Step 3 : initialise game state / variables
|
// Step 3 : initialise game state / variables
|
||||||
|
@ -978,6 +985,9 @@ void Logic::roomDisplay(uint16 room, RoomDisplayMode mode, uint16 scale, int com
|
||||||
|
|
||||||
roomErase();
|
roomErase();
|
||||||
|
|
||||||
|
if (_credits)
|
||||||
|
_credits->nextRoom();
|
||||||
|
|
||||||
roomSetup(roomName(room), comPanel, inCutaway);
|
roomSetup(roomName(room), comPanel, inCutaway);
|
||||||
ObjectData *pod = NULL;
|
ObjectData *pod = NULL;
|
||||||
if (mode != RDM_FADE_NOJOE) {
|
if (mode != RDM_FADE_NOJOE) {
|
||||||
|
@ -2078,6 +2088,8 @@ void Logic::update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_vm->graphics()->update(_currentRoom);
|
_vm->graphics()->update(_currentRoom);
|
||||||
|
if (_credits)
|
||||||
|
_credits->update();
|
||||||
|
|
||||||
_vm->input()->delay();
|
_vm->input()->delay();
|
||||||
|
|
||||||
|
@ -3180,6 +3192,19 @@ void Logic::asmEndInterview() {
|
||||||
OSystem::instance()->quit();
|
OSystem::instance()->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Logic::startCredits(const char *filename) {
|
||||||
|
|
||||||
|
stopCredits();
|
||||||
|
_credits = new Credits(_vm, filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Logic::stopCredits() {
|
||||||
|
if (_credits) {
|
||||||
|
delete _credits;
|
||||||
|
_credits = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // End of namespace Queen
|
} // End of namespace Queen
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "queen/defs.h"
|
#include "queen/defs.h"
|
||||||
#include "queen/structs.h"
|
#include "queen/structs.h"
|
||||||
|
#include "queen/resource.h"
|
||||||
|
|
||||||
namespace Queen {
|
namespace Queen {
|
||||||
|
|
||||||
|
@ -53,11 +54,13 @@ struct ZoneSlot {
|
||||||
};
|
};
|
||||||
|
|
||||||
class QueenEngine;
|
class QueenEngine;
|
||||||
|
class Credits;
|
||||||
|
|
||||||
class Logic {
|
class Logic {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Logic(QueenEngine *vm);
|
Logic(QueenEngine *vm);
|
||||||
|
~Logic();
|
||||||
|
|
||||||
uint16 currentRoom() const { return _currentRoom; }
|
uint16 currentRoom() const { return _currentRoom; }
|
||||||
void currentRoom(uint16 room) {
|
void currentRoom(uint16 room) {
|
||||||
|
@ -296,6 +299,9 @@ public:
|
||||||
void asmInterviewIntro();
|
void asmInterviewIntro();
|
||||||
void asmEndInterview();
|
void asmEndInterview();
|
||||||
|
|
||||||
|
void startCredits(const char *filename);
|
||||||
|
void stopCredits();
|
||||||
|
|
||||||
typedef bool (Logic::*ExecuteSpecialMoveProc)(uint16);
|
typedef bool (Logic::*ExecuteSpecialMoveProc)(uint16);
|
||||||
typedef bool (Logic::*PreChangeRoomProc)();
|
typedef bool (Logic::*PreChangeRoomProc)();
|
||||||
|
|
||||||
|
@ -312,6 +318,8 @@ protected:
|
||||||
|
|
||||||
void initialise();
|
void initialise();
|
||||||
|
|
||||||
|
LineReader *_queen2jas;
|
||||||
|
|
||||||
uint16 _currentRoom;
|
uint16 _currentRoom;
|
||||||
uint16 _oldRoom;
|
uint16 _oldRoom;
|
||||||
uint16 _newRoom;
|
uint16 _newRoom;
|
||||||
|
@ -440,6 +448,7 @@ protected:
|
||||||
PreChangeRoomProc _preChangeRoom;
|
PreChangeRoomProc _preChangeRoom;
|
||||||
|
|
||||||
QueenEngine *_vm;
|
QueenEngine *_vm;
|
||||||
|
Credits *_credits;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ MODULE := queen
|
||||||
|
|
||||||
MODULE_OBJS = \
|
MODULE_OBJS = \
|
||||||
queen/command.o \
|
queen/command.o \
|
||||||
|
queen/credits.o \
|
||||||
queen/cutaway.o \
|
queen/cutaway.o \
|
||||||
queen/debug.o \
|
queen/debug.o \
|
||||||
queen/display.o \
|
queen/display.o \
|
||||||
|
|
|
@ -44,14 +44,13 @@ const GameVersion Resource::_gameVersions[] = {
|
||||||
|
|
||||||
|
|
||||||
Resource::Resource(const Common::String &datafilePath, SaveFileManager *mgr, const char *savePath)
|
Resource::Resource(const Common::String &datafilePath, SaveFileManager *mgr, const char *savePath)
|
||||||
: _JAS2Pos(0), _datafilePath(datafilePath), _savePath(savePath), _resourceEntries(0), _resourceTable(NULL), _saveFileManager(mgr) {
|
: _datafilePath(datafilePath), _savePath(savePath), _resourceEntries(0), _resourceTable(NULL), _saveFileManager(mgr) {
|
||||||
|
|
||||||
_resourceFile = new File();
|
_resourceFile = new File();
|
||||||
if (!findCompressedVersion() && !findNormalVersion())
|
if (!findCompressedVersion() && !findNormalVersion())
|
||||||
error("Could not open resource file '%s%s'", _datafilePath.c_str(), "queen.1");
|
error("Could not open resource file '%s%s'", _datafilePath.c_str(), "queen.1");
|
||||||
checkJASVersion();
|
checkJASVersion();
|
||||||
debug(5, "Detected game version: %s, which has %d resource entries", _versionString, _resourceEntries);
|
debug(5, "Detected game version: %s, which has %d resource entries", _versionString, _resourceEntries);
|
||||||
_JAS2Ptr = (char *)loadFile("QUEEN2.JAS", 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Resource::~Resource() {
|
Resource::~Resource() {
|
||||||
|
@ -59,7 +58,6 @@ Resource::~Resource() {
|
||||||
delete _resourceFile;
|
delete _resourceFile;
|
||||||
if(_resourceTable != _resourceTablePEM10)
|
if(_resourceTable != _resourceTablePEM10)
|
||||||
delete[] _resourceTable;
|
delete[] _resourceTable;
|
||||||
delete[] _JAS2Ptr;
|
|
||||||
delete _saveFileManager;
|
delete _saveFileManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,17 +110,6 @@ ResourceEntry *Resource::resourceEntry(const char *filename) const {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *Resource::getJAS2Line() {
|
|
||||||
assert(_JAS2Pos < resourceEntry("QUEEN2.JAS")->size);
|
|
||||||
char *startOfLine = _JAS2Ptr + _JAS2Pos;
|
|
||||||
char *curPos = startOfLine;
|
|
||||||
while (*curPos++ != 0xd) ;
|
|
||||||
*(curPos - 1) = '\0'; // '\r'
|
|
||||||
*curPos = '\0'; // '\n'
|
|
||||||
_JAS2Pos = (curPos - _JAS2Ptr) + 1;
|
|
||||||
return startOfLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8 *Resource::loadFile(const char *filename, uint32 skipBytes, byte *dstBuf) {
|
uint8 *Resource::loadFile(const char *filename, uint32 skipBytes, byte *dstBuf) {
|
||||||
ResourceEntry *re = resourceEntry(filename);
|
ResourceEntry *re = resourceEntry(filename);
|
||||||
assert(re != NULL);
|
assert(re != NULL);
|
||||||
|
@ -295,5 +282,22 @@ bool Resource::readSave(uint16 slot, byte *&ptr) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LineReader::LineReader(char *buffer) : _buffer(buffer), _current(0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
LineReader::~LineReader() {
|
||||||
|
delete[] _buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* LineReader::nextLine() {
|
||||||
|
char *startOfLine = _buffer + _current;
|
||||||
|
char *curPos = startOfLine;
|
||||||
|
while (*curPos++ != 0xd) ;
|
||||||
|
*(curPos - 1) = '\0'; // '\r'
|
||||||
|
*curPos = '\0'; // '\n'
|
||||||
|
_current = (curPos - _buffer) + 1;
|
||||||
|
return startOfLine;
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Queen
|
} // End of namespace Queen
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,17 @@ struct GameVersion {
|
||||||
uint32 dataFileSize;
|
uint32 dataFileSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class LineReader {
|
||||||
|
|
||||||
|
public:
|
||||||
|
LineReader(char *buffer);
|
||||||
|
~LineReader();
|
||||||
|
char* nextLine();
|
||||||
|
|
||||||
|
private:
|
||||||
|
char *_buffer;
|
||||||
|
int _current;
|
||||||
|
};
|
||||||
|
|
||||||
class Resource {
|
class Resource {
|
||||||
|
|
||||||
|
@ -81,7 +92,6 @@ public:
|
||||||
uint8 compression() const { return _compression; }
|
uint8 compression() const { return _compression; }
|
||||||
const char *JASVersion() const { return _versionString; }
|
const char *JASVersion() const { return _versionString; }
|
||||||
Language getLanguage() const;
|
Language getLanguage() const;
|
||||||
char *getJAS2Line();
|
|
||||||
|
|
||||||
bool writeSave(uint16 slot, const byte *saveData, uint32 size);
|
bool writeSave(uint16 slot, const byte *saveData, uint32 size);
|
||||||
bool readSave(uint16 slot, byte *&ptr);
|
bool readSave(uint16 slot, byte *&ptr);
|
||||||
|
@ -94,8 +104,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
File *_resourceFile;
|
File *_resourceFile;
|
||||||
char *_JAS2Ptr;
|
|
||||||
uint32 _JAS2Pos;
|
|
||||||
uint8 _compression;
|
uint8 _compression;
|
||||||
const Common::String _datafilePath;
|
const Common::String _datafilePath;
|
||||||
char _versionString[6];
|
char _versionString[6];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue