Some cheap cleanup.

svn-id: r26757
This commit is contained in:
Nicola Mettifogo 2007-05-06 09:31:45 +00:00
parent 76c98a03af
commit 79229cafab
6 changed files with 24 additions and 42 deletions

View File

@ -247,7 +247,7 @@ void _c_endComment(void *param) {
_vm->_gfx->floodFill(Gfx::kBitFront, r, 0);
r.setWidth(w+3);
r.setHeight(w+4);
r.setHeight(h+3);
r.moveTo(7, 7);
_vm->_gfx->floodFill(Gfx::kBitFront, r, 1);
@ -367,14 +367,10 @@ void _c_finito(void *parm) {
if (gameCompleted) {
_vm->_gfx->setFont(kFontMenu);
uint16 _ax = _vm->_gfx->getStringWidth(v4C[_language]);
_vm->_gfx->displayString((SCREEN_WIDTH - _ax)/2, 70, v4C[_language]);
_ax = _vm->_gfx->getStringWidth(v3C[_language]);
_vm->_gfx->displayString((SCREEN_WIDTH - _ax)/2, 100, v3C[_language]);
_ax = _vm->_gfx->getStringWidth(v2C[_language]);
_vm->_gfx->displayString((SCREEN_WIDTH - _ax)/2, 130, v2C[_language]);
_ax = _vm->_gfx->getStringWidth(v1C[_language]);
_vm->_gfx->displayString((SCREEN_WIDTH - _ax)/2, 160, v1C[_language]);
_vm->_gfx->displayCenteredString(70, v4C[_language]);
_vm->_gfx->displayCenteredString(100, v3C[_language]);
_vm->_gfx->displayCenteredString(130, v2C[_language]);
_vm->_gfx->displayCenteredString(160, v1C[_language]);
_vm->_gfx->copyScreen(Gfx::kBitFront, Gfx::kBitBack);
_vm->_gfx->copyScreen(Gfx::kBitFront, Gfx::kBit2);
@ -385,14 +381,10 @@ void _c_finito(void *parm) {
_engineFlags |= kEngineChangeLocation;
} else {
_vm->_gfx->setFont(kFontMenu);
uint16 _ax = _vm->_gfx->getStringWidth(v8C[_language]);
_vm->_gfx->displayString((SCREEN_WIDTH - _ax)/2, 70, v8C[_language]);
_ax = _vm->_gfx->getStringWidth(v7C[_language]);
_vm->_gfx->displayString((SCREEN_WIDTH - _ax)/2, 100, v7C[_language]);
_ax = _vm->_gfx->getStringWidth(v6C[_language]);
_vm->_gfx->displayString((SCREEN_WIDTH - _ax)/2, 130, v6C[_language]);
_ax = _vm->_gfx->getStringWidth(v5C[_language]);
_vm->_gfx->displayString((SCREEN_WIDTH - _ax)/2, 160, v5C[_language]);
_vm->_gfx->displayCenteredString(70, v8C[_language]);
_vm->_gfx->displayCenteredString(100, v7C[_language]);
_vm->_gfx->displayCenteredString(130, v6C[_language]);
_vm->_gfx->displayCenteredString(160, v5C[_language]);
_vm->_gfx->copyScreen(Gfx::kBitFront, Gfx::kBitBack);
_vm->_gfx->copyScreen(Gfx::kBitFront, Gfx::kBit2);
@ -437,10 +429,8 @@ void _c_testResult(void *parm) {
_vm->_gfx->setFont(kFontMenu);
uint16 _ax = _vm->_gfx->getStringWidth(_slideText[0]);
_vm->_gfx->displayString((SCREEN_WIDTH - _ax)/2, 38, _slideText[0]);
_ax = _vm->_gfx->getStringWidth(_slideText[1]);
_vm->_gfx->displayString((SCREEN_WIDTH - _ax)/2, 58, _slideText[1]);
_vm->_gfx->displayCenteredString(38, _slideText[0]);
_vm->_gfx->displayCenteredString(58, _slideText[1]);
_vm->_gfx->copyScreen(Gfx::kBitFront, Gfx::kBitBack);
_vm->_gfx->copyScreen(Gfx::kBitFront, Gfx::kBit2);

View File

@ -598,6 +598,11 @@ void Gfx::displayString(uint16 x, uint16 y, const char *text) {
_font->drawString(dst, SCREEN_WIDTH, text);
}
void Gfx::displayCenteredString(uint16 y, const char *text) {
uint16 x = (SCREEN_WIDTH - getStringWidth(text)) / 2;
displayString(x, y, text);
}
void Gfx::displayBalloonString(uint16 x, uint16 y, const char *text, byte color) {
assert(_font == _fonts[kFontDialogue]);

View File

@ -164,6 +164,7 @@ public:
void drawBalloon(const Common::Rect& r, uint16 arg_8);
void displayBalloonString(uint16 x, uint16 y, const char *text, byte color);
void displayString(uint16 x, uint16 y, const char *text);
void displayCenteredString(uint16 y, const char *text);
bool displayWrappedString(char *text, uint16 x, uint16 y, uint16 maxwidth, byte color);
uint16 getStringWidth(const char *text);
void getStringExtent(char *text, uint16 maxwidth, int16* width, int16* height);

View File

@ -141,13 +141,9 @@ void _c_endIntro(void *parm) {
_vm->_gfx->setFont(kFontMenu);
uint16 _di;
for (uint16 _si = 0; _si < 7; _si++) {
_di = _vm->_gfx->getStringWidth(_credits[_si]._role);
_vm->_gfx->displayString((SCREEN_WIDTH - _di)/2, 80, _credits[_si]._role);
_di = _vm->_gfx->getStringWidth(_credits[_si]._name);
_vm->_gfx->displayString((SCREEN_WIDTH - _di)/2, 100, _credits[_si]._name);
_vm->_gfx->displayCenteredString(80, _credits[_si]._role);
_vm->_gfx->displayCenteredString(100, _credits[_si]._name);
_vm->_gfx->updateScreen();

View File

@ -286,10 +286,7 @@ void Parallaction::showSlide(const char *name) {
_gfx->setFont(kFontMenu);
uint16 _ax = strlen(_slideText[0]);
_ax <<= 3; // text width
uint16 _dx = (SCREEN_WIDTH - _ax) >> 1; // center text
_gfx->displayString(_dx, 14, _slideText[0]); // displays text on screen
_gfx->displayCenteredString(14, _slideText[0]); // displays text on screen
_gfx->updateScreen();
waitUntilLeftClick();

View File

@ -148,17 +148,10 @@ void Menu::newGame() {
_vm->_gfx->setPalette(_vm->_gfx->_palette);
_vm->_gfx->swapBuffers();
uint16 _ax = (SCREEN_WIDTH - _vm->_gfx->getStringWidth(v14[0])) / 2;
_vm->_gfx->displayString(_ax, 50, v14[0]);
_ax = (SCREEN_WIDTH - _vm->_gfx->getStringWidth(v14[1])) / 2;
_vm->_gfx->displayString(_ax, 70, v14[1]);
_ax = (SCREEN_WIDTH - _vm->_gfx->getStringWidth(v14[2])) / 2;
_vm->_gfx->displayString(_ax, 100, v14[2]);
_ax = (SCREEN_WIDTH - _vm->_gfx->getStringWidth(v14[3])) / 2;
_vm->_gfx->displayString(_ax, 120, v14[3]);
_vm->_gfx->displayCenteredString(50, v14[0]);
_vm->_gfx->displayCenteredString(70, v14[1]);
_vm->_gfx->displayCenteredString(100, v14[2]);
_vm->_gfx->displayCenteredString(120, v14[3]);
_vm->_gfx->updateScreen();
_vm->_gfx->copyScreen(Gfx::kBitFront, Gfx::kBitBack);