diff --git a/.gitignore b/.gitignore index 66d6507432..184cef4736 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,4 @@ bin/USER/*.bmp bin/USER/*.sav deps/ docs/html/ -obj/ \ No newline at end of file +*.o \ No newline at end of file diff --git a/obj/.gitkeep b/obj/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Basescape/PurchaseState.cpp b/src/Basescape/PurchaseState.cpp index 6ddc9e25ca..28288e073e 100644 --- a/src/Basescape/PurchaseState.cpp +++ b/src/Basescape/PurchaseState.cpp @@ -48,7 +48,7 @@ namespace OpenXcom * @param game Pointer to the core game. * @param base Pointer to the base to get info from. */ -PurchaseState::PurchaseState(Game *game, Base *base) : State(game), _base(base), _sel(0), _total(0), _pQty(0), _cQty(0), _iQty(0.0f) +PurchaseState::PurchaseState(Game *game, Base *base) : State(game), _base(base), _crafts(), _items(), _qtys(), _sel(0), _total(0), _pQty(0), _cQty(0), _iQty(0.0f) { // Create objects _window = new Window(this, 320, 200, 0, 0); @@ -119,6 +119,10 @@ PurchaseState::PurchaseState(Game *game, Base *base) : State(game), _base(base), _lstItems->setSelectable(true); _lstItems->setBackground(_window); _lstItems->setMargin(2); + _lstItems->onLeftArrowPress((ActionHandler)&PurchaseState::lstItemsLeftArrowPress); + _lstItems->onLeftArrowRelease((ActionHandler)&PurchaseState::lstItemsLeftArrowRelease); + _lstItems->onRightArrowPress((ActionHandler)&PurchaseState::lstItemsRightArrowPress); + _lstItems->onRightArrowRelease((ActionHandler)&PurchaseState::lstItemsRightArrowRelease); _crafts.push_back("STR_SKYRANGER"); _crafts.push_back("STR_INTERCEPTOR"); @@ -158,10 +162,6 @@ PurchaseState::PurchaseState(Game *game, Base *base) : State(game), _base(base), _qtys.push_back(0); _lstItems->addRow(3, _game->getLanguage()->getString(*i).c_str(), Text::formatFunding(_game->getRuleset()->getItem(*i)->getCost()).c_str(), L"0"); } - _lstItems->onLeftArrowPress((ActionHandler)&PurchaseState::lstItemsLeftArrowPress); - _lstItems->onLeftArrowRelease((ActionHandler)&PurchaseState::lstItemsLeftArrowRelease); - _lstItems->onRightArrowPress((ActionHandler)&PurchaseState::lstItemsRightArrowPress); - _lstItems->onRightArrowRelease((ActionHandler)&PurchaseState::lstItemsRightArrowRelease); _timerInc = new Timer(50); _timerInc->onTimer((StateHandler)&PurchaseState::increase); @@ -318,7 +318,7 @@ int PurchaseState::getPrice() } /** - * Increases the quantity of the selected item on the list. + * Increases the quantity of the selected item to buy. */ void PurchaseState::increase() { @@ -369,7 +369,7 @@ void PurchaseState::increase() } /** - * Decreases the quantity of the selected item on the list. + * Decreases the quantity of the selected item to buy. */ void PurchaseState::decrease() { @@ -393,10 +393,10 @@ void PurchaseState::decrease() _lstItems->getCell(_sel, 2)->setText(ss.str()); _lstItems->draw(); _total -= getPrice(); + std::wstring s = _game->getLanguage()->getString("STR_COST_OF_PURCHASES"); + s += Text::formatFunding(_total); + _txtPurchases->setText(s); } - std::wstring s = _game->getLanguage()->getString("STR_COST_OF_PURCHASES"); - s += Text::formatFunding(_total); - _txtPurchases->setText(s); } } diff --git a/src/Battlescape/BattlescapeState.cpp b/src/Battlescape/BattlescapeState.cpp index f45dfabc03..c16a2eb581 100644 --- a/src/Battlescape/BattlescapeState.cpp +++ b/src/Battlescape/BattlescapeState.cpp @@ -181,7 +181,7 @@ BattlescapeState::BattlescapeState(Game *game) : State(game) _btnLeftHandItem->onMouseClick((ActionHandler)&BattlescapeState::btnLeftHandItemClick); _btnRightHandItem->onMouseClick((ActionHandler)&BattlescapeState::btnRightHandItemClick); - _txtName->setColor(Palette::blockOffset(7)); + _txtName->setColor(Palette::blockOffset(8)-1); _txtName->setHighContrast(true); _numTimeUnits->setColor(Palette::blockOffset(4)); _numEnergy->setColor(Palette::blockOffset(1)); diff --git a/src/Geoscape/GeoscapeState.cpp b/src/Geoscape/GeoscapeState.cpp index ef16462ca2..013635e7af 100644 --- a/src/Geoscape/GeoscapeState.cpp +++ b/src/Geoscape/GeoscapeState.cpp @@ -839,15 +839,8 @@ void GeoscapeState::btnBasesClick(Action *action) */ void GeoscapeState::btnGraphsClick(Action *action) { - _game->pushState(new GraphsState(_game)); -} + //_game->pushState(new GraphsState(_game)); -/** - * Goes to the Ufopaedia screen. - * @param action Pointer to an action. - */ -void GeoscapeState::btnUfopaediaClick(Action *action) -{ /* Daiky: uncomment this bit to start a terror mission */ _game->getSavedGame()->setBattleGame(new SavedBattleGame()); BattlescapeGenerator *bgen = new BattlescapeGenerator(_game); @@ -858,8 +851,17 @@ void GeoscapeState::btnUfopaediaClick(Action *action) bgen->setCraft(_game->getSavedGame()->getBases()->at(0)->getCrafts()->at(0)); bgen->run(); delete bgen; + _music = false; _game->pushState(new BattlescapeState(_game)); - +} + +/** + * Goes to the Ufopaedia window. + * @param action Pointer to an action. + */ +void GeoscapeState::btnUfopaediaClick(Action *action) +{ + } /** diff --git a/src/Interface/TextList.cpp b/src/Interface/TextList.cpp index aca394c5e2..1f3b5beae1 100644 --- a/src/Interface/TextList.cpp +++ b/src/Interface/TextList.cpp @@ -34,7 +34,8 @@ namespace OpenXcom * @param x X position in pixels. * @param y Y position in pixels. */ -TextList::TextList(int width, int height, int x, int y) : InteractiveSurface(width, height, x, y), _texts(), _columns(), _big(0), _small(0), _scroll(0), _visibleRows(0), _color(0), _align(ALIGN_LEFT), _dot(false), _selectable(false), _selRow(0), _bg(0), _selector(0), _margin(0), _arrowLeft(), _arrowRight(), _arrowPos(-1) +TextList::TextList(int width, int height, int x, int y) : InteractiveSurface(width, height, x, y), _texts(), _columns(), _big(0), _small(0), _scroll(0), _visibleRows(0), _color(0), _align(ALIGN_LEFT), _dot(false), _selectable(false), _selRow(0), _bg(0), _selector(0), _margin(0), + _arrowLeft(), _arrowRight(), _arrowPos(-1), _leftClick(0), _leftPress(0), _leftRelease(0), _rightClick(0), _rightPress(0), _rightRelease(0) { _up = new ArrowButton(ARROW_BIG_UP, 13, 14, getX() + getWidth() + 4, getY() + 1); _up->setVisible(false); @@ -155,10 +156,16 @@ void TextList::addRow(int cols, ...) ArrowButton *a1 = new ArrowButton(ARROW_SMALL_UP, 11, 8, getX() + _arrowPos, getY()); a1->setPalette(this->getPalette()); a1->setColor(_up->getColor()); + a1->onMouseClick(_leftClick); + a1->onMousePress(_leftPress); + a1->onMouseRelease(_leftRelease); _arrowLeft.push_back(a1); ArrowButton *a2 = new ArrowButton(ARROW_SMALL_DOWN, 11, 8, getX() + _arrowPos + 12, getY()); a2->setPalette(this->getPalette()); a2->setColor(_up->getColor()); + a2->onMouseClick(_rightClick); + a2->onMousePress(_rightPress); + a2->onMouseRelease(_rightRelease); _arrowRight.push_back(a2); } @@ -345,6 +352,7 @@ void TextList::setArrowColumn(int pos) */ void TextList::onLeftArrowClick(ActionHandler handler) { + _leftClick = handler; for (std::vector::iterator i = _arrowLeft.begin(); i < _arrowLeft.end(); i++) { (*i)->onMouseClick(handler); @@ -357,6 +365,7 @@ void TextList::onLeftArrowClick(ActionHandler handler) */ void TextList::onLeftArrowPress(ActionHandler handler) { + _leftPress = handler; for (std::vector::iterator i = _arrowLeft.begin(); i < _arrowLeft.end(); i++) { (*i)->onMousePress(handler); @@ -369,6 +378,7 @@ void TextList::onLeftArrowPress(ActionHandler handler) */ void TextList::onLeftArrowRelease(ActionHandler handler) { + _leftRelease = handler; for (std::vector::iterator i = _arrowLeft.begin(); i < _arrowLeft.end(); i++) { (*i)->onMouseRelease(handler); @@ -381,6 +391,7 @@ void TextList::onLeftArrowRelease(ActionHandler handler) */ void TextList::onRightArrowClick(ActionHandler handler) { + _rightClick = handler; for (std::vector::iterator i = _arrowRight.begin(); i < _arrowRight.end(); i++) { (*i)->onMouseClick(handler); @@ -393,6 +404,7 @@ void TextList::onRightArrowClick(ActionHandler handler) */ void TextList::onRightArrowPress(ActionHandler handler) { + _rightPress = handler; for (std::vector::iterator i = _arrowRight.begin(); i < _arrowRight.end(); i++) { (*i)->onMousePress(handler); @@ -405,6 +417,7 @@ void TextList::onRightArrowPress(ActionHandler handler) */ void TextList::onRightArrowRelease(ActionHandler handler) { + _rightRelease = handler; for (std::vector::iterator i = _arrowRight.begin(); i < _arrowRight.end(); i++) { (*i)->onMouseRelease(handler); diff --git a/src/Interface/TextList.h b/src/Interface/TextList.h index 24694472f6..460677a859 100644 --- a/src/Interface/TextList.h +++ b/src/Interface/TextList.h @@ -51,6 +51,7 @@ class TextList : public InteractiveSurface int _margin; std::vector _arrowLeft, _arrowRight; int _arrowPos; + ActionHandler _leftClick, _leftPress, _leftRelease, _rightClick, _rightPress, _rightRelease; /// Updates the arrow buttons. void updateArrows(); diff --git a/src/OpenXcom.2008.vcproj b/src/OpenXcom.2008.vcproj index 6a7fdff3de..df0dda753b 100644 --- a/src/OpenXcom.2008.vcproj +++ b/src/OpenXcom.2008.vcproj @@ -611,14 +611,6 @@ - - - - @@ -634,7 +626,15 @@ - + + + + + @@ -651,6 +651,22 @@ RelativePath=".\Battlescape\BulletSprite.h" > + + + + + + + + @@ -691,6 +707,14 @@ RelativePath=".\Battlescape\Projectile.h" > + + + + @@ -707,6 +731,22 @@ RelativePath=".\Battlescape\UnitSprite.h" > + + + + + + + + - +