AVALANCHE: Janitorial - Clean up misc style glitches

This commit is contained in:
Strangerke 2013-09-18 00:05:14 +02:00
parent 6e08f55160
commit 7790b4cc5b
6 changed files with 40 additions and 58 deletions

View file

@ -81,8 +81,6 @@ bool HeadType::parseAltTrigger(char key) {
return false; return false;
} }
void MenuItem::init(Dropdown *dr) { void MenuItem::init(Dropdown *dr) {
_dr = dr; _dr = dr;
_activeNow = false; _activeNow = false;
@ -135,12 +133,12 @@ void MenuItem::display() {
_firstlix = true; _firstlix = true;
_flx1 = _left - 2; _flx1 = _left - 2;
_flx2 = _left + _width; _flx2 = _left + _width;
fly = 15 + _optionNum * 10; _fly = 15 + _optionNum * 10;
_activeNow = true; _activeNow = true;
_dr->_vm->_gyro->_dropdownActive = true; _dr->_vm->_gyro->_dropdownActive = true;
_dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, fly), _dr->kMenuBackgroundColor); _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly), _dr->kMenuBackgroundColor);
_dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, fly + 1), _dr->kMenuBorderColor); _dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, _fly + 1), _dr->kMenuBorderColor);
displayOption(0, true); displayOption(0, true);
for (int y = 1; y < _optionNum; y++) for (int y = 1; y < _optionNum; y++)
@ -183,7 +181,7 @@ void MenuItem::moveHighlight(int8 inc) {
} }
void MenuItem::lightUp(Common::Point cursorPos) { void MenuItem::lightUp(Common::Point cursorPos) {
if ((cursorPos.x < _flx1 * 8) || (cursorPos.x > _flx2 * 8) || (cursorPos.y <= 25) || (cursorPos.y > ((fly - 3) * 2 + 1))) if ((cursorPos.x < _flx1 * 8) || (cursorPos.x > _flx2 * 8) || (cursorPos.y <= 25) || (cursorPos.y > ((_fly - 3) * 2 + 1)))
return; return;
_highlightNum = (cursorPos.y - 26) / 20; _highlightNum = (cursorPos.y - 26) / 20;
if (_highlightNum == _oldY) if (_highlightNum == _oldY)
@ -263,14 +261,12 @@ void MenuBar::setupMenuItem(byte which) {
} }
void MenuBar::chooseMenuItem(int16 x) { void MenuBar::chooseMenuItem(int16 x) {
byte i = 0; for (int i = 0; i < _menuNum; i++) {
do {
if ((x > _menuItems[i]._xpos * 8) && (x < _menuItems[i]._xright * 8)) { if ((x > _menuItems[i]._xpos * 8) && (x < _menuItems[i]._xright * 8)) {
setupMenuItem(i); setupMenuItem(i);
return; break;
}
} }
i++;
} while (i < _menuNum);
} }
Dropdown::Dropdown(AvalancheEngine *vm) { Dropdown::Dropdown(AvalancheEngine *vm) {
@ -641,14 +637,12 @@ void Dropdown::runMenuWith() {
_vm->_acci->_thing = _vm->_gyro->_thinks; _vm->_acci->_thing = _vm->_gyro->_thinks;
if (_vm->_gyro->_thinkThing) { if (_vm->_gyro->_thinkThing) {
_vm->_acci->_thing += 49; _vm->_acci->_thing += 49;
if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == Acci::kVerbCodeGive) if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == Acci::kVerbCodeGive)
_vm->_acci->_person = _vm->_gyro->_lastPerson; _vm->_acci->_person = _vm->_gyro->_lastPerson;
else else
_vm->_acci->_person = Acci::kPardon; _vm->_acci->_person = Acci::kPardon;
} else { } else {
switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) { switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) {
case 100: // Beer case 100: // Beer
@ -720,7 +714,7 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it...
if ((0 <= cursorPos.y) && (cursorPos.y <= 21)) if ((0 <= cursorPos.y) && (cursorPos.y <= 21))
_vm->_gyro->newMouse(1); // Up arrow _vm->_gyro->newMouse(1); // Up arrow
else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) { else if ((22 <= cursorPos.y) && (cursorPos.y <= 339)) {
if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem.fly * 2 + 1)) if ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) && (cursorPos.y > 21) && (cursorPos.y <= _activeMenuItem._fly * 2 + 1))
_vm->_gyro->newMouse(3); // Right-arrow _vm->_gyro->newMouse(3); // Right-arrow
else else
_vm->_gyro->newMouse(4); // Fletch _vm->_gyro->newMouse(4); // Fletch
@ -735,7 +729,7 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it...
if (_vm->_lucerna->_holdLeftMouse) { if (_vm->_lucerna->_holdLeftMouse) {
if (cursorPos.y > 21) { if (cursorPos.y > 21) {
if (!((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) if (!((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8)
&& (cursorPos.y >= 24) && (cursorPos.y <= (_activeMenuItem.fly * 2 + 1))))) { && (cursorPos.y >= 24) && (cursorPos.y <= (_activeMenuItem._fly * 2 + 1))))) {
// Clicked OUTSIDE the menu. // Clicked OUTSIDE the menu.
if (_activeMenuItem._activeNow) { if (_activeMenuItem._activeNow) {
_activeMenuItem.wipe(); _activeMenuItem.wipe();
@ -765,7 +759,7 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it...
// NOT clicked button... // NOT clicked button...
if ((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8) if ((_activeMenuItem._firstlix) && ((cursorPos.x >= _activeMenuItem._flx1 * 8) && (cursorPos.x <= _activeMenuItem._flx2 * 8)
&& (cursorPos.y >= 12) && (cursorPos.y <= (_activeMenuItem.fly * 2 + 1)))) { && (cursorPos.y >= 12) && (cursorPos.y <= (_activeMenuItem._fly * 2 + 1)))) {
// We act only if the button is released over a menu item. // We act only if the button is released over a menu item.
while (!_vm->shouldQuit()) { while (!_vm->shouldQuit()) {
@ -786,7 +780,6 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it...
} }
} }
} }
} }
} }

View file

@ -74,7 +74,7 @@ public:
byte _optionNum; byte _optionNum;
uint16 _width, _left; uint16 _width, _left;
bool _firstlix; bool _firstlix;
int16 _flx1, _flx2, fly; int16 _flx1, _flx2, _fly;
byte _oldY; // used by lightUp */ byte _oldY; // used by lightUp */
bool _activeNow; // Is there an active option now? bool _activeNow; // Is there an active option now?
byte _activeNum; // And if so, which is it? byte _activeNum; // And if so, which is it?

View file

@ -71,8 +71,7 @@ void Graphics::init() {
_scrolls.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8()); _scrolls.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8());
} }
void Graphics::fleshColors() void Graphics::fleshColors() {
{
g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1);
g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1);
} }
@ -294,11 +293,10 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16
void Graphics::drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY) { void Graphics::drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY) {
// Copy the picture to the given place on the screen. // Copy the picture to the given place on the screen.
for (uint16 y = 0; y < picture.h; y++) { for (uint16 y = 0; y < picture.h; y++) {
for (uint16 x = 0; x < picture.w; x++) { for (uint16 x = 0; x < picture.w; x++)
*(byte *)target.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y); *(byte *)target.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y);
} }
} }
}
void Graphics::refreshScreen() { void Graphics::refreshScreen() {
// These cycles are for doubling the screen height. // These cycles are for doubling the screen height.

View file

@ -80,8 +80,7 @@ void Parser::handleBackspace() {
void Parser::handleReturn() { void Parser::handleReturn() {
if (_vm->_dropdown->_activeMenuItem._activeNow) if (_vm->_dropdown->_activeMenuItem._activeNow)
_vm->_parser->tryDropdown(); _vm->_parser->tryDropdown();
else { else if (!_inputText.empty()) {
if (!_inputText.empty()) {
_inputTextBackup = _inputText; _inputTextBackup = _inputText;
_vm->_acci->parse(); _vm->_acci->parse();
_vm->_acci->doThat(); _vm->_acci->doThat();
@ -89,7 +88,6 @@ void Parser::handleReturn() {
wipeText(); wipeText();
} }
} }
}
void Parser::handleFunctionKey(const Common::Event &event) { void Parser::handleFunctionKey(const Common::Event &event) {
switch (event.kbd.keycode) { switch (event.kbd.keycode) {
@ -108,11 +106,9 @@ void Parser::handleFunctionKey(const Common::Event &event) {
void Parser::plotText() { void Parser::plotText() {
CursorMan.showMouse(false); CursorMan.showMouse(false);
cursorOff(); cursorOff();
_vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text. _vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), kColorBlack); // Black out the line of the text.
_vm->_graphics->drawText(_vm->_graphics->_surface, _vm->_parser->_inputText, _vm->_gyro->_font, 8, 24, 161, kColorWhite); _vm->_graphics->drawText(_vm->_graphics->_surface, _vm->_parser->_inputText, _vm->_gyro->_font, 8, 24, 161, kColorWhite);
cursorOn(); cursorOn();

View file

@ -28,7 +28,6 @@
/* SCROLLS The scroll driver. */ /* SCROLLS The scroll driver. */
#include "avalanche/avalanche.h" #include "avalanche/avalanche.h"
#include "avalanche/scrolls.h" #include "avalanche/scrolls.h"
#include "avalanche/gyro.h" #include "avalanche/gyro.h"
#include "avalanche/lucerna.h" #include "avalanche/lucerna.h"
@ -199,10 +198,9 @@ bool Scrolls::theyMatch(TuneType &played) {
byte mistakes = 0; byte mistakes = 0;
for (int i = 0; i < sizeof(played); i++) { for (int i = 0; i < sizeof(played); i++) {
if (played[i] != _vm->_gyro->kTune[i]) { if (played[i] != _vm->_gyro->kTune[i])
mistakes += 1; mistakes += 1;
} }
}
return mistakes < 5; return mistakes < 5;
} }
@ -320,7 +318,7 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) {
} }
int16 mx = 320; int16 mx = 320;
int16 my = 100; // Getmaxx & getmaxy div 2, both. int16 my = 100; // Getmaxx & getmaxy div 2, both.
lx = lx / 2; lx /= 2;
ly -= 2; ly -= 2;
if ((1 <= _useIcon) && (_useIcon <= 34)) if ((1 <= _useIcon) && (_useIcon <= 34))
@ -539,10 +537,11 @@ bool Scrolls::displayQuestion(Common::String question) {
void Scrolls::resetScroll() { void Scrolls::resetScroll() {
_vm->_gyro->_scrollNum = 1; _vm->_gyro->_scrollNum = 1;
for (int i = 0; i < 15; i++) for (int i = 0; i < 15; i++) {
if (!_vm->_gyro->_scroll[i].empty()) if (!_vm->_gyro->_scroll[i].empty())
_vm->_gyro->_scroll[i].clear(); _vm->_gyro->_scroll[i].clear();
} }
}
void Scrolls::setBubbleStateNatural() { void Scrolls::setBubbleStateNatural() {
_vm->_gyro->_talkX = 320; _vm->_gyro->_talkX = 320;
@ -574,10 +573,9 @@ Common::String Scrolls::displayMoney() {
} }
void Scrolls::stripTrailingSpaces(Common::String &str) { void Scrolls::stripTrailingSpaces(Common::String &str) {
while (str[str.size() - 1] == ' ') { while (str[str.size() - 1] == ' ')
str.deleteLastChar(); str.deleteLastChar();
} }
}
void Scrolls::solidify(byte n) { void Scrolls::solidify(byte n) {
if (!_vm->_gyro->_scroll[n].contains(' ')) if (!_vm->_gyro->_scroll[n].contains(' '))
@ -594,8 +592,6 @@ void Scrolls::solidify(byte n) {
void Scrolls::callScrollDriver() { void Scrolls::callScrollDriver() {
// bool was_virtual; // Was the mouse cursor virtual on entry to this proc? // bool was_virtual; // Was the mouse cursor virtual on entry to this proc?
//nosound(); //nosound();
warning("STUB: Scrolls::calldrivers()"); warning("STUB: Scrolls::calldrivers()");

View file

@ -480,9 +480,8 @@ void Timer::jump() {
if (_vm->_gyro->_jumpStatus == 20) { // End of jump. if (_vm->_gyro->_jumpStatus == 20) { // End of jump.
_vm->_gyro->_userMovesAvvy = true; _vm->_gyro->_userMovesAvvy = true;
_vm->_gyro->_jumpStatus = 0; _vm->_gyro->_jumpStatus = 0;
} else { // Still jumping. } else // Still jumping.
addTimer(1, kProcJump, kReasonJumping); addTimer(1, kProcJump, kReasonJumping);
}
if ((_vm->_gyro->_jumpStatus == 10) // You're at the highest point of your jump. if ((_vm->_gyro->_jumpStatus == 10) // You're at the highest point of your jump.
&& (_vm->_gyro->_room == kRoomInsideCardiffCastle) && (_vm->_gyro->_room == kRoomInsideCardiffCastle)