Weeded out some more unused code, and some restructuring.
svn-id: r35377
This commit is contained in:
parent
6b043aa05b
commit
c76f0bdb10
6 changed files with 44 additions and 170 deletions
|
@ -45,7 +45,6 @@ Debugger::Debugger(Parallaction *vm)
|
|||
DCmd_Register("localflags", WRAP_METHOD(Debugger, Cmd_LocalFlags));
|
||||
DCmd_Register("locations", WRAP_METHOD(Debugger, Cmd_Locations));
|
||||
DCmd_Register("gfxobjects", WRAP_METHOD(Debugger, Cmd_GfxObjects));
|
||||
DCmd_Register("set", WRAP_METHOD(Debugger, Cmd_Set));
|
||||
DCmd_Register("programs", WRAP_METHOD(Debugger, Cmd_Programs));
|
||||
|
||||
}
|
||||
|
@ -204,17 +203,6 @@ bool Debugger::Cmd_GfxObjects(int argc, const char **argv) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Debugger::Cmd_Set(int argc, const char** argv) {
|
||||
|
||||
if (argc < 3) {
|
||||
DebugPrintf("set <var name> <value>\n");
|
||||
} else {
|
||||
_vm->_gfx->setVar(Common::String(argv[1]), atoi(argv[2]));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Debugger::Cmd_Programs(int argc, const char** argv) {
|
||||
|
||||
ProgramList::iterator b = _vm->_location._programs.begin();
|
||||
|
|
|
@ -28,8 +28,6 @@ protected:
|
|||
bool Cmd_GlobalFlags(int argc, const char **argv);
|
||||
bool Cmd_Locations(int argc, const char **argv);
|
||||
bool Cmd_GfxObjects(int argc, const char **argv);
|
||||
bool Cmd_GfxFeature(int argc, const char** argv);
|
||||
bool Cmd_Set(int argc, const char** argv);
|
||||
bool Cmd_Programs(int argc, const char** argv);
|
||||
};
|
||||
|
||||
|
|
|
@ -40,36 +40,6 @@ namespace Parallaction {
|
|||
#define MAXIMUM_UNPACKED_BITMAP_SIZE 641*401
|
||||
|
||||
|
||||
void Gfx::registerVar(const Common::String &name, int32 initialValue) {
|
||||
if (_vars.contains(name)) {
|
||||
warning("Variable '%s' already registered, ignoring initial value.\n", name.c_str());
|
||||
} else {
|
||||
_vars.setVal(name, initialValue);
|
||||
}
|
||||
}
|
||||
|
||||
void Gfx::setVar(const Common::String &name, int32 value) {
|
||||
if (!_vars.contains(name)) {
|
||||
warning("Variable '%s' doesn't exist, skipping assignment.\n", name.c_str());
|
||||
} else {
|
||||
_vars.setVal(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
int32 Gfx::getVar(const Common::String &name) {
|
||||
int32 v = 0;
|
||||
|
||||
if (!_vars.contains(name)) {
|
||||
warning("Variable '%s' doesn't exist, returning default value.\n", name.c_str());
|
||||
} else {
|
||||
v = _vars.getVal(name);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define LABEL_TRANSPARENT_COLOR 0xFF
|
||||
|
||||
void halfbritePixel(int x, int y, int color, void *data) {
|
||||
|
@ -343,56 +313,6 @@ void Gfx::drawList(Graphics::Surface &surface, GfxObjArray &list) {
|
|||
}
|
||||
}
|
||||
|
||||
void Gfx::beginFrame() {
|
||||
_skipBackground = (_backgroundInfo->bg.pixels == 0); // don't render frame if background is missing
|
||||
|
||||
if (!_skipBackground) {
|
||||
int32 oldBackgroundMode = _varBackgroundMode;
|
||||
_varBackgroundMode = getVar("background_mode");
|
||||
if (oldBackgroundMode != _varBackgroundMode) {
|
||||
switch (_varBackgroundMode) {
|
||||
case 1:
|
||||
_bitmapMask.free();
|
||||
break;
|
||||
case 2:
|
||||
_bitmapMask.create(_backgroundInfo->width, _backgroundInfo->height, 1);
|
||||
byte *data = (byte*)_bitmapMask.pixels;
|
||||
for (uint y = 0; y < _bitmapMask.h; y++) {
|
||||
for (uint x = 0; x < _bitmapMask.w; x++) {
|
||||
*data++ = _backgroundInfo->mask.getValue(x, y);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
Common::DumpFile dump;
|
||||
dump.open("maskdump.bin");
|
||||
dump.write(_bitmapMask.pixels, _bitmapMask.w * _bitmapMask.h);
|
||||
dump.close();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_varDrawPathZones = getVar("draw_path_zones");
|
||||
if (_varDrawPathZones == 1 && _gameType != GType_BRA) {
|
||||
setVar("draw_path_zones", 0);
|
||||
_varDrawPathZones = 0;
|
||||
warning("Path zones are supported only in Big Red Adventure");
|
||||
}
|
||||
}
|
||||
|
||||
int32 Gfx::getRenderMode(const char *type) {
|
||||
|
||||
int32 mode = getVar(type);
|
||||
if (mode < 0 || mode > 2) {
|
||||
warning("new value for '%s' is wrong: resetting default", type);
|
||||
setVar(type, 1);
|
||||
mode = 1;
|
||||
}
|
||||
return mode;
|
||||
|
||||
}
|
||||
|
||||
void Gfx::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
|
||||
if (_doubleBuffering) {
|
||||
if (_overlayMode)
|
||||
|
@ -457,26 +377,17 @@ void Gfx::updateScreen() {
|
|||
// is needed
|
||||
_overlayMode = false;
|
||||
|
||||
if (!_skipBackground) {
|
||||
bool skipBackground = (_backgroundInfo->bg.pixels == 0); // don't render frame if background is missing
|
||||
|
||||
if (!skipBackground) {
|
||||
// background may not cover the whole screen, so adjust bulk update size
|
||||
uint w = _backgroundInfo->width;
|
||||
uint h = _backgroundInfo->height;
|
||||
|
||||
byte *backgroundData = 0;
|
||||
uint16 backgroundPitch = 0;
|
||||
switch (_varBackgroundMode) {
|
||||
case 1:
|
||||
backgroundData = (byte*)_backgroundInfo->bg.getBasePtr(0, 0);
|
||||
backgroundPitch = _backgroundInfo->bg.pitch;
|
||||
break;
|
||||
case 2:
|
||||
backgroundData = (byte*)_bitmapMask.getBasePtr(0, 0);
|
||||
backgroundPitch = _bitmapMask.pitch;
|
||||
break;
|
||||
}
|
||||
byte *backgroundData = (byte*)_backgroundInfo->bg.getBasePtr(0, 0);
|
||||
uint16 backgroundPitch = _backgroundInfo->bg.pitch;
|
||||
copyRectToScreen(backgroundData, backgroundPitch, _backgroundInfo->x, _backgroundInfo->y, w, h);
|
||||
}
|
||||
|
||||
/*
|
||||
if (_varDrawPathZones == 1) {
|
||||
Graphics::Surface *surf = lockScreen();
|
||||
ZoneList::iterator b = _vm->_location._zones.begin();
|
||||
|
@ -489,7 +400,7 @@ void Gfx::updateScreen() {
|
|||
}
|
||||
unlockScreen();
|
||||
}
|
||||
|
||||
*/
|
||||
sortScene();
|
||||
Graphics::Surface *surf = lockScreen();
|
||||
// draws animations frames and other game items
|
||||
|
@ -798,11 +709,6 @@ Gfx::Gfx(Parallaction* vm) :
|
|||
_unpackedBitmap = new byte[MAXIMUM_UNPACKED_BITMAP_SIZE];
|
||||
assert(_unpackedBitmap);
|
||||
|
||||
registerVar("background_mode", 1);
|
||||
_varBackgroundMode = 1;
|
||||
|
||||
registerVar("draw_path_zones", 0);
|
||||
|
||||
if ((_gameType == GType_BRA) && (_vm->getPlatform() == Common::kPlatformPC)) {
|
||||
// this loads the backup palette needed by the PC version of BRA (see setBackground()).
|
||||
BackgroundInfo paletteInfo;
|
||||
|
|
|
@ -477,8 +477,6 @@ public:
|
|||
};
|
||||
|
||||
|
||||
typedef Common::HashMap<Common::String, int32, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> VarMap;
|
||||
|
||||
typedef Common::Array<GfxObj*> GfxObjArray;
|
||||
|
||||
|
||||
|
@ -489,7 +487,6 @@ protected:
|
|||
|
||||
public:
|
||||
Disk *_disk;
|
||||
VarMap _vars;
|
||||
|
||||
GfxObjArray _sceneObjects;
|
||||
GfxObj* loadAnim(const char *name);
|
||||
|
@ -544,12 +541,6 @@ public:
|
|||
Gfx(Parallaction* vm);
|
||||
virtual ~Gfx();
|
||||
|
||||
void beginFrame();
|
||||
|
||||
void registerVar(const Common::String &name, int32 initialValue);
|
||||
void setVar(const Common::String &name, int32 value);
|
||||
int32 getVar(const Common::String &name);
|
||||
|
||||
void clearScreen();
|
||||
void updateScreen();
|
||||
|
||||
|
@ -561,8 +552,6 @@ public:
|
|||
protected:
|
||||
bool _halfbrite;
|
||||
|
||||
bool _skipBackground;
|
||||
|
||||
Common::Point _hbCirclePos;
|
||||
int _hbCircleRadius;
|
||||
|
||||
|
@ -570,10 +559,6 @@ protected:
|
|||
Palette _backupPal;
|
||||
|
||||
// frame data stored in programmable variables
|
||||
int32 _varBackgroundMode; // 1 = normal, 2 = only mask
|
||||
int32 _varRenderMode;
|
||||
int32 _varDrawPathZones; // 0 = don't draw, 1 = draw
|
||||
Graphics::Surface _bitmapMask;
|
||||
int32 getRenderMode(const char *type);
|
||||
|
||||
Graphics::Surface *lockScreen();
|
||||
|
|
|
@ -308,24 +308,39 @@ void Parallaction::showLocationComment(const Common::String &text, bool end) {
|
|||
}
|
||||
|
||||
|
||||
void Parallaction::processInput(int event) {
|
||||
|
||||
switch (event) {
|
||||
case kEvSaveGame:
|
||||
_input->stopHovering();
|
||||
_saveLoad->saveGame();
|
||||
_input->setArrowCursor();
|
||||
break;
|
||||
|
||||
case kEvLoadGame:
|
||||
_input->stopHovering();
|
||||
_saveLoad->loadGame();
|
||||
_input->setArrowCursor();
|
||||
break;
|
||||
|
||||
void Parallaction::runGameFrame(int event) {
|
||||
if (_input->_inputMode != Input::kInputModeGame) {
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
if (event != kEvNone) {
|
||||
_input->stopHovering();
|
||||
if (event == kEvSaveGame) {
|
||||
_saveLoad->saveGame();
|
||||
} else
|
||||
if (event == kEvLoadGame) {
|
||||
_saveLoad->loadGame();
|
||||
}
|
||||
_input->setArrowCursor();
|
||||
}
|
||||
|
||||
runPendingZones();
|
||||
|
||||
if (shouldQuit())
|
||||
return;
|
||||
|
||||
if (_engineFlags & kEngineChangeLocation) {
|
||||
changeLocation(_location._name);
|
||||
}
|
||||
|
||||
_programExec->runScripts(_location._programs.begin(), _location._programs.end());
|
||||
_char._ani->setZ(_char._ani->height() + _char._ani->getFrameY());
|
||||
if (_char._ani->gfxobj) {
|
||||
_char._ani->gfxobj->z = _char._ani->getZ();
|
||||
}
|
||||
_char._walker->walk();
|
||||
drawAnimations();
|
||||
|
||||
}
|
||||
|
||||
void Parallaction::runGame() {
|
||||
|
@ -337,30 +352,10 @@ void Parallaction::runGame() {
|
|||
runGuiFrame();
|
||||
runDialogueFrame();
|
||||
runCommentFrame();
|
||||
runGameFrame(event);
|
||||
|
||||
if (_input->_inputMode == Input::kInputModeGame) {
|
||||
processInput(event);
|
||||
runPendingZones();
|
||||
|
||||
if (shouldQuit())
|
||||
return;
|
||||
|
||||
if (_engineFlags & kEngineChangeLocation) {
|
||||
changeLocation(_location._name);
|
||||
}
|
||||
}
|
||||
|
||||
_gfx->beginFrame();
|
||||
|
||||
if (_input->_inputMode == Input::kInputModeGame) {
|
||||
_programExec->runScripts(_location._programs.begin(), _location._programs.end());
|
||||
_char._ani->setZ(_char._ani->height() + _char._ani->getFrameY());
|
||||
if (_char._ani->gfxobj) {
|
||||
_char._ani->gfxobj->z = _char._ani->getZ();
|
||||
}
|
||||
_char._walker->walk();
|
||||
drawAnimations();
|
||||
}
|
||||
if (shouldQuit())
|
||||
return;
|
||||
|
||||
// change this to endFrame?
|
||||
updateView();
|
||||
|
|
|
@ -123,6 +123,7 @@ class Input;
|
|||
class DialogueManager;
|
||||
class MenuInputHelper;
|
||||
|
||||
|
||||
struct Location {
|
||||
|
||||
Common::Point _startPosition;
|
||||
|
@ -301,6 +302,7 @@ public:
|
|||
|
||||
protected:
|
||||
void runGame();
|
||||
void runGameFrame(int event);
|
||||
void runGuiFrame();
|
||||
void cleanupGui();
|
||||
void runDialogueFrame();
|
||||
|
@ -308,7 +310,6 @@ protected:
|
|||
void runCommentFrame();
|
||||
void enterCommentMode(ZonePtr z);
|
||||
void exitCommentMode();
|
||||
void processInput(int event);
|
||||
void updateView();
|
||||
void drawAnimations();
|
||||
void freeCharacter();
|
||||
|
@ -494,6 +495,7 @@ public:
|
|||
int32 _counters[32];
|
||||
uint32 _zoneFlags[NUM_LOCATIONS][NUM_ZONES];
|
||||
|
||||
|
||||
private:
|
||||
LocationParser_br *_locationParser;
|
||||
ProgramParser_br *_programParser;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue