[Scummvm-cvs-logs] scummvm master -> fc131804652aee81cbc434d62d8914b0959e70ad
urukgit
urukgit at users.noreply.github.com
Sat Apr 12 21:04:00 CEST 2014
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
759e499626 AVALANCHE: Remove unnecessary TODOs.
fc13180465 AVALANCHE: Merge ghostDrawGhost and ghostDrawGlerk.
Commit: 759e499626013a92917ea6bb3f9190486ae41c1d
https://github.com/scummvm/scummvm/commit/759e499626013a92917ea6bb3f9190486ae41c1d
Author: uruk (koppirnyo at gmail.com)
Date: 2014-04-12T19:51:49+02:00
Commit Message:
AVALANCHE: Remove unnecessary TODOs.
Changed paths:
engines/avalanche/avalanche.cpp
engines/avalanche/dropdown.cpp
engines/avalanche/graphics.h
diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp
index 5b41414..15b43b3 100644
--- a/engines/avalanche/avalanche.cpp
+++ b/engines/avalanche/avalanche.cpp
@@ -336,7 +336,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {
}
-bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!!
+bool AvalancheEngine::canSaveGameStateCurrently() {
return (_animationsEnabled && _alive);
}
@@ -381,7 +381,7 @@ Common::String AvalancheEngine::getSaveFileName(const int slot) {
return Common::String::format("%s.%03d", _targetName.c_str(), slot);
}
-bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!!
+bool AvalancheEngine::canLoadGameStateCurrently() {
return (_animationsEnabled);
}
diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp
index 7c05298..97adfc2 100644
--- a/engines/avalanche/dropdown.cpp
+++ b/engines/avalanche/dropdown.cpp
@@ -678,7 +678,7 @@ void DropDownMenu::setup() {
_menuBar.draw();
}
-void DropDownMenu::update() { // TODO: Optimize it ASAP!!! It really needs it...
+void DropDownMenu::update() {
_vm->_graphics->saveScreen();
Common::Point cursorPos = _vm->getMousePos();
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index 7e0ed64..3fd633f 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -97,7 +97,7 @@ public:
void drawWinningPic();
// Ghostroom's functions:
- void ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, int16 destY); // Very similar to loadPictureSign(). TODO: Unify the two later if possible.
+ void ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, int16 destY);
void ghostDrawGlerk(byte glerkArr[4][35][9], uint16 destX, uint16 destY); // Very similar to ghostDrawGhost(), but not enough to unify the two.
Graphics::Surface ghostLoadPicture(Common::File &file, Common::Point &coord);
void ghostDrawPicture(const Graphics::Surface &picture, uint16 destX, uint16 destY);
@@ -106,7 +106,7 @@ public:
// Help's function:
void helpDrawButton(int y, byte which);
void helpDrawHighlight(byte which, Color color);
- void helpDrawBigText(const Common::String text, int16 x, int16 y, Color color); // Very similar to drawText. TODO: Try to unify the two.
+ void helpDrawBigText(const Common::String text, int16 x, int16 y, Color color);
// Shoot em' up's functions:
void seuDrawTitle();
@@ -199,12 +199,11 @@ private:
Graphics::Surface loadPictureSign(Common::File &file, uint16 width, uint16 height); // Reads a tricky type of picture used for the "game over"/"about" scrolls and in the mini-game Nim.
void drawText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
- void drawBigText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); // Very similar to drawText. TODO: Try to unify the two.
+ void drawBigText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
void drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY);
// Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc.
// Returns the end point of the arc. (Needed in Clock.)
- // TODO: Make it more accurate later.
Common::Point drawArc(Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color);
};
Commit: fc131804652aee81cbc434d62d8914b0959e70ad
https://github.com/scummvm/scummvm/commit/fc131804652aee81cbc434d62d8914b0959e70ad
Author: uruk (koppirnyo at gmail.com)
Date: 2014-04-12T21:03:17+02:00
Commit Message:
AVALANCHE: Merge ghostDrawGhost and ghostDrawGlerk.
Changed paths:
engines/avalanche/enums.h
engines/avalanche/ghostroom.cpp
engines/avalanche/ghostroom.h
engines/avalanche/graphics.cpp
engines/avalanche/graphics.h
diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h
index 998c96a..0ba3932 100644
--- a/engines/avalanche/enums.h
+++ b/engines/avalanche/enums.h
@@ -30,6 +30,7 @@
namespace Avalanche {
+enum MonsterType { kMonsterTypeGhost, kMonsterTypeGlerk };
enum Flavour { kFlavourEga, kFlavourBgi, kFlavourNatural, kFlavourTwo, kFlavourOne };
diff --git a/engines/avalanche/ghostroom.cpp b/engines/avalanche/ghostroom.cpp
index 1419a0c..68e3c9b 100644
--- a/engines/avalanche/ghostroom.cpp
+++ b/engines/avalanche/ghostroom.cpp
@@ -70,6 +70,28 @@ GhostRoom::~GhostRoom() {
for (int j = 0; j < 6; j++)
_greldet[j][i].free();
}
+
+ for (int i = 0; i < 5; i++) {
+ for (int j = 0; j < 2; j++) {
+ for (int y = 0; y < 66; y++) {
+ delete[] _ghost[i][j][y];
+ }
+ delete[] _ghost[i][j];
+ }
+ delete[] _ghost[i];
+ }
+ delete[] _ghost;
+
+ for (int i = 0; i < 6; i++) {
+ for (int j = 0; j < 4; j++) {
+ for (int y = 0; y < 35; y++) {
+ delete[] _glerk[i][j][y];
+ }
+ delete[] _glerk[i][j];
+ }
+ delete[] _glerk[i];
+ }
+ delete[] _glerk;
}
void GhostRoom::wait(uint16 howLong) {
@@ -141,9 +163,13 @@ void GhostRoom::loadPictures() {
file.seek(44);
// Initializing ghost's array.
+ _ghost = new byte***[5];
for (int i = 0; i < 5; i++) {
+ _ghost[i] = new byte**[2];
for (int j = 0; j < 2; j++) {
+ _ghost[i][j] = new byte*[66];
for (int y = 0; y < 66; y++) {
+ _ghost[i][j][y] = new byte[26];
for (int x = 0; x < 26; x++)
_ghost[i][j][y][x] = 0;
}
@@ -171,11 +197,14 @@ void GhostRoom::loadPictures() {
for (int i = 0; i < 3; i++)
_bat[i] = _vm->_graphics->ghostLoadPicture(file, dummyCoord);
-
// Initializing glerk's array.
+ _glerk = new byte***[6];
for (int i = 0; i < 6; i++) {
+ _glerk[i] = new byte**[4];
for (int j = 0; j < 4; j++) {
+ _glerk[i][j] = new byte*[35];
for (int y = 0; y < 35; y++) {
+ _glerk[i][j][y] = new byte[9];
for (int x = 0; x < 9; x++)
_glerk[i][j][y][x] = 0;
}
@@ -245,7 +274,7 @@ void GhostRoom::run() {
if (_glerkStage > 25)
break;
- _vm->_graphics->ghostDrawGlerk(_glerk[kGlerkFade[_glerkStage]], 456, 14);
+ _vm->_graphics->ghostDrawMonster(_glerk[kGlerkFade[_glerkStage]], 456, 14, kMonsterTypeGlerk);
_glerkStage++;
}
@@ -263,7 +292,7 @@ void GhostRoom::run() {
// Here comes the descending ghost:
for (int y = -64; y <= 103; y++) {
- _vm->_graphics->ghostDrawGhost(_ghost[1 + (abs(y / 7) % 2) * 3], 0, y);
+ _vm->_graphics->ghostDrawMonster(_ghost[1 + (abs(y / 7) % 2) * 3], 0, y, kMonsterTypeGhost);
if (y > 0)
_vm->_graphics->drawFilledRectangle(Common::Rect(0, y - 1, 26 * 8 + 1, y + 1), kColorBlack);
_vm->_graphics->refreshScreen();
@@ -277,7 +306,7 @@ void GhostRoom::run() {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 5; j++) {
_vm->_graphics->drawFilledRectangle(Common::Rect(0, 96, 26 * 8, 170), kColorBlack);
- _vm->_graphics->ghostDrawGhost(_ghost[kWaveOrder[j]], 0, 96 + kAdjustment[j]);
+ _vm->_graphics->ghostDrawMonster(_ghost[kWaveOrder[j]], 0, 96 + kAdjustment[j], kMonsterTypeGhost);
_aarghCount++;
diff --git a/engines/avalanche/ghostroom.h b/engines/avalanche/ghostroom.h
index ebb02f7..4c65912 100644
--- a/engines/avalanche/ghostroom.h
+++ b/engines/avalanche/ghostroom.h
@@ -58,11 +58,11 @@ private:
static const byte kGreldetFade[18];
Common::Point dummyCoord;
- byte _ghost[5][2][66][26];
+ byte ****_ghost;// [5][2][66][26]
Graphics::Surface _eyes[2];
Graphics::Surface _exclamation;
Graphics::Surface _bat[3];
- byte _glerk[6][4][35][9];
+ byte ****_glerk; // [6][4][35][9]
Graphics::Surface _aargh[6];
Common::Point _aarghWhere[6];
Graphics::Surface _greenEyes[5];
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index ae53f3e..513cd72 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -527,64 +527,65 @@ void GraphicManager::nimFree() {
_nimLogo.free();
}
-void GraphicManager::ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, int16 destY) {
+void GraphicManager::ghostDrawMonster(byte ***picture, uint16 destX, int16 destY, MonsterType type) {
+ uint16 height = 0;
+ uint16 width = 0;
+ // Only for the Ghost:
const byte kPlaneToUse[4] = { 0, 0, 0, 1 };
- // Constants from the original code:
- uint16 height = 66;
- const uint16 width = 26 * 8;
-
- // We have to mess around with the coords and the sizes since
- // the ghost isn't always placed fully on the screen.
int yStart = 0;
- if (destY < 0) {
- yStart = abs(destY);
- height -= yStart;
- destY = 0;
- }
-
- Graphics::Surface ghostPic;
- ghostPic.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
-
- for (int y = 0; y < height; y++) {
- for (int plane = 0; plane < 4; plane++) {
- for (uint16 x = 0; x < width / 8; x ++) {
- byte pixel = ghostArr[kPlaneToUse[plane]][y + yStart][x];
- for (int bit = 0; bit < 8; bit++) {
- byte pixelBit = (pixel >> bit) & 1;
- *(byte *)ghostPic.getBasePtr(x * 8 + 7 - bit, y) += (pixelBit << plane);
- }
- }
+
+ // Constants from the original code:
+ switch (type) {
+ case kMonsterTypeGhost:
+ height = 66;
+ width = 208; // 26 * 8
+
+ // We have to mess around with the coords and the sizes since
+ // the ghost isn't always placed fully on the screen.
+ if (destY < 0) {
+ yStart = abs(destY);
+ height -= yStart;
+ destY = 0;
}
+ break;
+ case kMonsterTypeGlerk:
+ height = 35;
+ width = 72; // 9 * 8
+ break;
+ default:
+ break;
}
- drawPicture(_surface, ghostPic, destX, destY);
-
- ghostPic.free();
-}
-
-void GraphicManager::ghostDrawGlerk(byte glerkArr[4][35][9], uint16 destX, uint16 destY) {
- // Constants from the original code:
- const uint16 height = 35;
- const uint16 width = 9 * 8;
-
- Graphics::Surface glerkPic;
- glerkPic.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+ Graphics::Surface monsterPicture;
+ monsterPicture.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
for (int y = 0; y < height; y++) {
for (int plane = 0; plane < 4; plane++) {
for (uint16 x = 0; x < width / 8; x++) {
- byte pixel = glerkArr[plane][y][x];
+ byte pixel = 0;
+
+ switch (type) {
+ case kMonsterTypeGhost:
+ pixel = picture[kPlaneToUse[plane]][y + yStart][x];
+ break;
+ case kMonsterTypeGlerk:
+ pixel = picture[plane][y][x];
+ break;
+ default:
+ break;
+ }
+
for (int bit = 0; bit < 8; bit++) {
byte pixelBit = (pixel >> bit) & 1;
- *(byte *)glerkPic.getBasePtr(x * 8 + 7 - bit, y) += (pixelBit << plane);
+ *(byte *)monsterPicture.getBasePtr(x * 8 + 7 - bit, y) += (pixelBit << plane);
}
}
}
}
- drawPicture(_surface, glerkPic, destX, destY);
+ drawPicture(_surface, monsterPicture, destX, destY);
- glerkPic.free();
+ monsterPicture.free();
}
/**
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index 3fd633f..bd8fc6c 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -97,8 +97,7 @@ public:
void drawWinningPic();
// Ghostroom's functions:
- void ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, int16 destY);
- void ghostDrawGlerk(byte glerkArr[4][35][9], uint16 destX, uint16 destY); // Very similar to ghostDrawGhost(), but not enough to unify the two.
+ void ghostDrawMonster(byte ***picture, uint16 destX, int16 destY, MonsterType type);
Graphics::Surface ghostLoadPicture(Common::File &file, Common::Point &coord);
void ghostDrawPicture(const Graphics::Surface &picture, uint16 destX, uint16 destY);
void ghostDrawBackgroundItems(Common::File &file);
More information about the Scummvm-git-logs
mailing list