LAB: Move some more comments to header files

This commit is contained in:
Strangerke 2015-12-21 02:03:48 +01:00 committed by Willem Jan Palenstijn
parent be1fd471be
commit 6aad3aebd9
6 changed files with 78 additions and 68 deletions

View File

@ -454,7 +454,14 @@ private:
void performAction(uint16 actionMode, Common::Point curPos, uint16 &curInv);
private:
/**
* Writes the game out to disk.
*/
bool saveGame(int slot, const Common::String desc);
/**
* Reads the game from disk.
*/
bool loadGame(int slot);
void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName);
};

View File

@ -119,9 +119,6 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) {
return true;
}
/**
* Writes the game out to disk.
*/
bool LabEngine::saveGame(int slot, const Common::String desc) {
Common::String fileName = generateSaveFileName(slot);
Common::SaveFileManager *saveFileManager = g_system->getSavefileManager();
@ -162,9 +159,6 @@ bool LabEngine::saveGame(int slot, const Common::String desc) {
return true;
}
/**
* Reads the game from disk.
*/
bool LabEngine::loadGame(int slot) {
Common::String fileName = generateSaveFileName(slot);
Common::SaveFileManager *saveFileManager = g_system->getSavefileManager();

View File

@ -95,9 +95,6 @@ TilePuzzle::~TilePuzzle() {
}
}
/**
* Processes mouse clicks and changes the combination.
*/
void TilePuzzle::mouseTile(Common::Point pos) {
Common::Point realPos = _vm->_utils->vgaUnscale(pos);
@ -111,9 +108,6 @@ void TilePuzzle::mouseTile(Common::Point pos) {
changeTile(tileX, tileY);
}
/**
* Changes the combination number of one of the slots
*/
void TilePuzzle::changeTile(uint16 col, uint16 row) {
int16 scrolltype = -1;
@ -180,9 +174,6 @@ void TilePuzzle::changeTile(uint16 col, uint16 row) {
}
}
/**
* Processes mouse clicks and changes the combination.
*/
void TilePuzzle::mouseCombination(Common::Point pos) {
Common::Point realPos = _vm->_utils->vgaUnscale(pos);
@ -206,9 +197,6 @@ void TilePuzzle::mouseCombination(Common::Point pos) {
changeCombination(number);
}
/**
* Draws the images of the combination lock to the display bitmap.
*/
void TilePuzzle::doTile(bool showsolution) {
uint16 row = 0, col = 0, rowm, colm, num;
int16 rows, cols;
@ -248,9 +236,6 @@ void TilePuzzle::doTile(bool showsolution) {
}
}
/**
* Reads in a backdrop picture.
*/
void TilePuzzle::showTile(const Common::String filename, bool showSolution) {
_vm->_anim->_doBlack = true;
_vm->_anim->_noPalChange = true;
@ -271,9 +256,6 @@ void TilePuzzle::showTile(const Common::String filename, bool showSolution) {
_vm->_graphics->setPalette(_vm->_anim->_diffPalette, 256);
}
/**
* Does the scrolling for the tiles on the tile puzzle.
*/
void TilePuzzle::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) {
int16 dX = 0, dY = 0, dx = 0, dy = 0, sx = 0, sy = 0;
int last = 0;
@ -315,9 +297,6 @@ void TilePuzzle::doTileScroll(uint16 col, uint16 row, uint16 scrolltype) {
delete[] buffer;
}
/**
* Changes the combination number of one of the slots
*/
void TilePuzzle::changeCombination(uint16 number) {
const int solution[6] = { 0, 4, 0, 8, 7, 2 };
@ -368,17 +347,11 @@ void TilePuzzle::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x
_vm->_graphics->scrollDisplayY(dy, x1, y1, x2, y2, buffer);
}
/**
* Draws the images of the combination lock to the display bitmap.
*/
void TilePuzzle::doCombination() {
for (int i = 0; i <= 5; i++)
_numberImages[_combination[i]]->drawImage(_vm->_utils->vgaScaleX(COMBINATION_X[i]), _vm->_utils->vgaScaleY(65));
}
/**
* Reads in a backdrop picture.
*/
void TilePuzzle::showCombination(const Common::String filename) {
_vm->_anim->_doBlack = true;
_vm->_anim->_noPalChange = true;

View File

@ -49,20 +49,54 @@ public:
TilePuzzle(LabEngine *vm);
virtual ~TilePuzzle();
/**
* Processes mouse clicks and changes the combination.
*/
void mouseTile(Common::Point pos);
void showTile(const Common::String filename, bool showSolution);
/**
* Processes mouse clicks and changes the combination.
*/
void mouseCombination(Common::Point pos);
/**
* Reads in a backdrop picture.
*/
void showCombination(const Common::String filename);
/**
* Reads in a backdrop picture.
*/
void showTile(const Common::String filename, bool showSolution);
void save(Common::OutSaveFile *file);
void load(Common::InSaveFile *file);
private:
void doTile(bool showsolution);
void doTileScroll(uint16 col, uint16 row, uint16 scrolltype);
/**
* Changes the combination number of one of the slots
*/
void changeCombination(uint16 number);
void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer);
void doCombination();
/**
* Changes the combination number of one of the slots
*/
void changeTile(uint16 col, uint16 row);
/**
* Draws the images of the combination lock to the display bitmap.
*/
void doCombination();
/**
* Draws the images of the combination lock to the display bitmap.
*/
void doTile(bool showsolution);
/**
* Does the scrolling for the tiles on the tile puzzle.
*/
void doTileScroll(uint16 col, uint16 row, uint16 scrolltype);
void scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer);
};
} // End of namespace Lab

View File

@ -38,10 +38,6 @@ Utils::Utils(LabEngine *vm) : _vm(vm), _rnd("lab") {
_dataBytesPerRow = 0;
}
/**
* Scales the x co-ordinates to that of the new display. In the room parser
* file, co-ordinates are set up on a 360x336 display.
*/
uint16 Utils::scaleX(uint16 x) {
if (_vm->_isHiRes)
return (uint16)((x * 16) / 9);
@ -49,10 +45,6 @@ uint16 Utils::scaleX(uint16 x) {
return (uint16)((x * 8) / 9);
}
/**
* Scales the y co-ordinates to that of the new display. In the room parser
* file, co-ordinates are set up on a 368x336 display.
*/
uint16 Utils::scaleY(uint16 y) {
if (_vm->_isHiRes)
return (y + (y / 14));
@ -82,9 +74,6 @@ Common::Rect Utils::mapRectScale(int16 x1, int16 y1, int16 x2, int16 y2) {
return Common::Rect(mapScaleX(x1), mapScaleY(y1), mapScaleX(x2), mapScaleY(y2));
}
/**
* Scales the VGA coords to SVGA if necessary; otherwise, returns VGA coords.
*/
int16 Utils::vgaScaleX(int16 x) {
if (_vm->_isHiRes)
return (x * 2);
@ -92,9 +81,6 @@ int16 Utils::vgaScaleX(int16 x) {
return x;
}
/**
* Scales the VGA coords to SVGA if necessary; otherwise, returns VGA coords.
*/
int16 Utils::vgaScaleY(int16 y) {
if (_vm->_isHiRes)
return ((y * 12) / 5);
@ -113,9 +99,6 @@ uint16 Utils::svgaCord(uint16 cord) {
return 0;
}
/**
* Converts SVGA coords to VGA if necessary, otherwise returns VGA coords.
*/
Common::Point Utils::vgaUnscale(Common::Point pos) {
Common::Point result;
if (_vm->_isHiRes) {
@ -127,10 +110,6 @@ Common::Point Utils::vgaUnscale(Common::Point pos) {
return result;
}
/**
* Undiffs a piece of memory when header size is a byte, and copy/skip size
* is also a byte or a word.
*/
template<typename T>
void Utils::unDiff(T *dest, Common::File *sourceFile) {
byte bytesPerWord = sizeof(T);
@ -162,12 +141,6 @@ void Utils::unDiff(T *dest, Common::File *sourceFile) {
}
}
/*------------------------- unDiff Vertical Memory --------------------------*/
/**
* Undiffs a piece of memory when header size is a byte, and copy/skip size
* is a byte or a word or a double word.
*/
template<typename T>
void Utils::verticalUnDiff(T *dest, Common::File *sourceFile, uint16 bytesPerRow) {
uint16 counter = 0;
@ -262,9 +235,6 @@ void Utils::verticalRunLengthDecode(byte *dest, Common::File *sourceFile, uint16
}
}
/**
* Does the undiffing between the bitmaps.
*/
void Utils::unDiff(byte *newBuf, byte *oldBuf, Common::File *sourceFile, uint16 bytesPerRow, bool isVertical) {
sourceFile->skip(1);
byte bufType = sourceFile->readByte();

View File

@ -38,9 +38,16 @@ private:
LabEngine *_vm;
uint16 _dataBytesPerRow;
/**
* Undiffs a piece of memory based on the header size.
*/
template<typename T>
void unDiff(T *dest, Common::File *sourceFile);
/**
* Undiffs a piece of memory when header size is a byte, and copy/skip size
* is a byte or a word or a double word.
*/
template<typename T>
void verticalUnDiff(T *dest, Common::File *sourceFile, uint16 bytesPerRow);
@ -49,17 +56,42 @@ public:
Common::RandomSource _rnd;
/**
* Scales the x co-ordinates to that of the new display. In the room parser
* file, co-ordinates are set up on a 360x336 display.
*/
uint16 scaleX(uint16 x);
/**
* Scales the y co-ordinates to that of the new display. In the room parser
* file, co-ordinates are set up on a 368x336 display.
*/
uint16 scaleY(uint16 y);
Common::Rect rectScale(int16 x1, int16 y1, int16 x2, int16 y2);
/**
* Scales the VGA x coords to SVGA if necessary; otherwise, returns VGA coords.
*/
int16 vgaScaleX(int16 x);
/**
* Scales the VGA y coords to SVGA if necessary; otherwise, returns VGA coords.
*/
int16 vgaScaleY(int16 y);
Common::Rect vgaRectScale(int16 x1, int16 y1, int16 x2, int16 y2);
uint16 svgaCord(uint16 cord);
uint16 mapScaleX(uint16 x);
uint16 mapScaleY(uint16 y);
Common::Rect mapRectScale(int16 x1, int16 y1, int16 x2, int16 y2);
/**
* Converts SVGA coords to VGA if necessary, otherwise returns VGA coords.
*/
Common::Point vgaUnscale(Common::Point pos);
/**
* Does the undiffing between the bitmaps.
*/
void unDiff(byte *newBuf, byte *oldBuf, Common::File *sourceFile, uint16 bytesPerRow, bool isVertical);
void runLengthDecode(byte *dest, Common::File *sourceFile);
void verticalRunLengthDecode(byte *dest, Common::File *sourceFile, uint16 bytesPerRow);