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;
}
void MenuItem::init(Dropdown *dr) {
_dr = dr;
_activeNow = false;
@ -135,12 +133,12 @@ void MenuItem::display() {
_firstlix = true;
_flx1 = _left - 2;
_flx2 = _left + _width;
fly = 15 + _optionNum * 10;
_fly = 15 + _optionNum * 10;
_activeNow = 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.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, fly + 1), _dr->kMenuBorderColor);
_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);
displayOption(0, true);
for (int y = 1; y < _optionNum; y++)
@ -183,7 +181,7 @@ void MenuItem::moveHighlight(int8 inc) {
}
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;
_highlightNum = (cursorPos.y - 26) / 20;
if (_highlightNum == _oldY)
@ -263,14 +261,12 @@ void MenuBar::setupMenuItem(byte which) {
}
void MenuBar::chooseMenuItem(int16 x) {
byte i = 0;
do {
for (int i = 0; i < _menuNum; i++) {
if ((x > _menuItems[i]._xpos * 8) && (x < _menuItems[i]._xright * 8)) {
setupMenuItem(i);
return;
break;
}
i++;
} while (i < _menuNum);
}
}
Dropdown::Dropdown(AvalancheEngine *vm) {
@ -641,14 +637,12 @@ void Dropdown::runMenuWith() {
_vm->_acci->_thing = _vm->_gyro->_thinks;
if (_vm->_gyro->_thinkThing) {
_vm->_acci->_thing += 49;
if (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum] == Acci::kVerbCodeGive)
_vm->_acci->_person = _vm->_gyro->_lastPerson;
else
_vm->_acci->_person = Acci::kPardon;
} else {
switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) {
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))
_vm->_gyro->newMouse(1); // Up arrow
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
else
_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 (cursorPos.y > 21) {
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.
if (_activeMenuItem._activeNow) {
_activeMenuItem.wipe();
@ -765,28 +759,27 @@ void Dropdown::updateMenu() { // TODO: Optimize it ASAP!!! It really needs it...
// NOT clicked button...
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.
while (!_vm->shouldQuit()) {
cursorPos = _vm->getMousePos();
_activeMenuItem.lightUp(cursorPos);
_vm->_graphics->refreshScreen();
// We act only if the button is released over a menu item.
while (!_vm->shouldQuit()) {
cursorPos = _vm->getMousePos();
_activeMenuItem.lightUp(cursorPos);
_vm->_graphics->refreshScreen();
_vm->updateEvents();
if (!_vm->_lucerna->_holdLeftMouse)
break;
}
_vm->updateEvents();
if (!_vm->_lucerna->_holdLeftMouse)
break;
}
uint16 which = (cursorPos.y - 26) / 20;
_activeMenuItem.select(which);
if (_activeMenuItem._options[which]._valid) { // If the menu item wasn't active, we do nothing.
backup.free();
return;
}
uint16 which = (cursorPos.y - 26) / 20;
_activeMenuItem.select(which);
if (_activeMenuItem._options[which]._valid) { // If the menu item wasn't active, we do nothing.
backup.free();
return;
}
}
}
}
}

View file

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

View file

@ -71,8 +71,7 @@ void Graphics::init() {
_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[28], 5, 1);
}
@ -294,9 +293,8 @@ 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) {
// Copy the picture to the given place on the screen.
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);
}
}
}

View file

@ -80,14 +80,12 @@ void Parser::handleBackspace() {
void Parser::handleReturn() {
if (_vm->_dropdown->_activeMenuItem._activeNow)
_vm->_parser->tryDropdown();
else {
if (!_inputText.empty()) {
_inputTextBackup = _inputText;
_vm->_acci->parse();
_vm->_acci->doThat();
_inputText.clear();
wipeText();
}
else if (!_inputText.empty()) {
_inputTextBackup = _inputText;
_vm->_acci->parse();
_vm->_acci->doThat();
_inputText.clear();
wipeText();
}
}
@ -108,11 +106,9 @@ void Parser::handleFunctionKey(const Common::Event &event) {
void Parser::plotText() {
CursorMan.showMouse(false);
cursorOff();
_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);
cursorOn();

View file

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

View file

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