PRINCE: code cleanup
This commit is contained in:
parent
accb9e10e8
commit
5357724657
12 changed files with 261 additions and 206 deletions
|
@ -0,0 +1,23 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "prince/archive.h"
|
|
@ -19,6 +19,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PRINCE_ARCHIVE_H
|
||||
#define PRINCE_ARCHIVE_H
|
||||
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "prince/graphics.h"
|
||||
|
||||
#include "prince/prince.h"
|
||||
|
@ -38,13 +60,10 @@ void GraphicsMan::draw(const Graphics::Surface *s)
|
|||
|
||||
void GraphicsMan::drawTransparent(const Graphics::Surface *s)
|
||||
{
|
||||
for (uint y = 0; y < 480; ++y)
|
||||
{
|
||||
for (uint x = 0; x < 640; ++x)
|
||||
{
|
||||
for (uint y = 0; y < 480; ++y) {
|
||||
for (uint x = 0; x < 640; ++x) {
|
||||
byte pixel = *((byte*)s->getBasePtr(x,y));
|
||||
if (pixel != 255)
|
||||
{
|
||||
if (pixel != 255) {
|
||||
*((byte*)_frontScreen->getBasePtr(x, y)) = pixel;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,13 +67,11 @@ PrinceEngine::~PrinceEngine() {
|
|||
delete _debugger;
|
||||
}
|
||||
|
||||
GUI::Debugger *PrinceEngine::getDebugger()
|
||||
{
|
||||
GUI::Debugger *PrinceEngine::getDebugger() {
|
||||
return _debugger;
|
||||
}
|
||||
|
||||
Common::Error PrinceEngine::run() {
|
||||
|
||||
_graph = new GraphicsMan(this);
|
||||
|
||||
const Common::FSNode gameDataDir(ConfMan.get("path"));
|
||||
|
@ -127,8 +125,7 @@ Common::Error PrinceEngine::run() {
|
|||
return Common::kNoError;
|
||||
}
|
||||
|
||||
bool PrinceEngine::loadLocation(uint16 locationNr)
|
||||
{
|
||||
bool PrinceEngine::loadLocation(uint16 locationNr) {
|
||||
debug("PrinceEngine::loadLocation %d", locationNr);
|
||||
const Common::FSNode gameDataDir(ConfMan.get("path"));
|
||||
SearchMan.remove(Common::String::format("%02d", _locationNr));
|
||||
|
@ -141,14 +138,12 @@ bool PrinceEngine::loadLocation(uint16 locationNr)
|
|||
// load location background
|
||||
Common::SeekableReadStream *room = SearchMan.createReadStreamForMember("room");
|
||||
|
||||
if (!room)
|
||||
{
|
||||
if (!room) {
|
||||
error("Can't load room bitmap");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(_roomBmp.loadStream(*room))
|
||||
{
|
||||
if(_roomBmp.loadStream(*room)) {
|
||||
debug("Room bitmap loaded");
|
||||
_system->getPaletteManager()->setPalette(_roomBmp.getPalette(), 0, 256);
|
||||
}
|
||||
|
@ -158,11 +153,9 @@ bool PrinceEngine::loadLocation(uint16 locationNr)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool PrinceEngine::playNextFrame()
|
||||
{
|
||||
bool PrinceEngine::playNextFrame() {
|
||||
const Graphics::Surface *s = _flicPlayer.decodeNextFrame();
|
||||
if (s)
|
||||
{
|
||||
if (s) {
|
||||
_graph->drawTransparent(s);
|
||||
_graph->change();
|
||||
}
|
||||
|
@ -170,19 +163,16 @@ bool PrinceEngine::playNextFrame()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool PrinceEngine::loadAnim(uint16 animNr)
|
||||
{
|
||||
bool PrinceEngine::loadAnim(uint16 animNr) {
|
||||
Common::String streamName = Common::String::format("AN%02d", animNr);
|
||||
Common::SeekableReadStream * flicStream = SearchMan.createReadStreamForMember(streamName);
|
||||
|
||||
if (!flicStream)
|
||||
{
|
||||
if (!flicStream) {
|
||||
error("Can't open %s", streamName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_flicPlayer.loadStream(flicStream))
|
||||
{
|
||||
if (!_flicPlayer.loadStream(flicStream)) {
|
||||
error("Can't load flic stream %s", streamName.c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "prince/script.h"
|
||||
#include "prince/prince.h"
|
||||
|
||||
|
|
|
@ -33,8 +33,7 @@ namespace Prince {
|
|||
|
||||
class PrinceEngine;
|
||||
|
||||
class Script
|
||||
{
|
||||
class Script {
|
||||
public:
|
||||
Script(PrinceEngine *vm);
|
||||
virtual ~Script();
|
||||
|
@ -56,7 +55,8 @@ private:
|
|||
bool _opcodeNF;
|
||||
|
||||
// Stack
|
||||
uint16 _stack[500];
|
||||
static const uint32 _STACK_SIZE = 500;
|
||||
uint16 _stack[_STACK_SIZE];
|
||||
uint8 _stacktop;
|
||||
uint8 _savedStacktop;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue