Skip to content

Commit 2949d20

Browse files
committed
- Added "We can now produce" Geoscape window.
- More tweaks to Battlescape camera saving. - Various updates.
1 parent 4beb542 commit 2949d20

14 files changed

Lines changed: 324 additions & 31 deletions

‎Makefile.am‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ ruleset_DATA = \
1414
languagedir = $(pkgdatadir)/Language
1515
language_DATA = \
1616
bin/data/Language/Big.fnt \
17+
bin/data/Language/Czech.geo \
1718
bin/data/Language/Czech.lng \
19+
bin/data/Language/English.geo \
1820
bin/data/Language/English.lng \
21+
bin/data/Language/EnglishUk.geo \
1922
bin/data/Language/EnglishUk.lng \
2023
bin/data/Language/Font.dat \
2124
bin/data/Language/French.geo \
@@ -28,6 +31,7 @@ language_DATA = \
2831
bin/data/Language/Italian.lng \
2932
bin/data/Language/Polish.geo \
3033
bin/data/Language/Polish.lng \
34+
bin/data/Language/Romanian.geo \
3135
bin/data/Language/Romanian.lng \
3236
bin/data/Language/Russian.geo \
3337
bin/data/Language/Russian.lng \
@@ -39,10 +43,17 @@ namedir = $(pkgdatadir)/SoldierName
3943
name_DATA = \
4044
bin/data/SoldierName/American.nam \
4145
bin/data/SoldierName/British.nam \
46+
bin/data/SoldierName/Czech.nam \
47+
bin/data/SoldierName/Danish.nam \
48+
bin/data/SoldierName/Finnish.nam \
4249
bin/data/SoldierName/French.nam \
4350
bin/data/SoldierName/German.nam \
4451
bin/data/SoldierName/Japanese.nam \
45-
bin/data/SoldierName/Russian.nam
52+
bin/data/SoldierName/Polish.nam \
53+
bin/data/SoldierName/Portuguese.nam \
54+
bin/data/SoldierName/Romanian.nam \
55+
bin/data/SoldierName/Russian.nam \
56+
bin/data/SoldierName/Swedish.nam
4657

4758
bin_PROGRAMS = openxcom
4859
openxcom_LDADD = $(SDL_LIBS) $(YAML_LIBS)
@@ -288,6 +299,8 @@ openxcom_SOURCES = \
288299
src/Geoscape/MonthlyReportState.h \
289300
src/Geoscape/MultipleTargetsState.cpp \
290301
src/Geoscape/MultipleTargetsState.h \
302+
src/Geoscape/NewPossibleManufactureState.cpp \
303+
src/Geoscape/NewPossibleManufactureState.h \
291304
src/Geoscape/NewPossibleResearchState.cpp \
292305
src/Geoscape/NewPossibleResearchState.h \
293306
src/Geoscape/GeoscapeOptionsState.cpp \

‎src/Battlescape/BattlescapeState.cpp‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,11 @@ void BattlescapeState::init()
361361
if (firstInit && playableUnitSelected())
362362
{
363363
_battleGame->setupCursor();
364-
_map->getCamera()->centerOnPosition(_save->getSelectedUnit()->getPosition());
364+
if (_save->getCameraPosition().x == -10)
365+
_save->setCameraPosition(_save->getSelectedUnit()->getPosition());
365366
firstInit = false;
366367
}
367-
else
368-
{
369-
_map->getCamera()->centerOnPosition(_save->getCameraPosition());
370-
}
368+
_map->getCamera()->centerOnPosition(_save->getCameraPosition());
371369
}
372370

373371
/**

‎src/CMakeLists.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ set ( geoscape_src
262262
Geoscape/NewPossibleResearchState.cpp
263263
Geoscape/AlienTerrorState.h
264264
Geoscape/AlienTerrorState.cpp
265+
Geoscape/NewPossibleManufactureState.h
266+
Geoscape/NewPossibleManufactureState.cpp
265267
)
266268

267269
set ( interface_src

‎src/Geoscape/GeoscapeState.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#include "ResearchCompleteState.h"
7272
#include "../Ruleset/RuleResearch.h"
7373
#include "NewPossibleResearchState.h"
74+
#include "NewPossibleManufactureState.h"
7475
#include "../Savegame/Production.h"
7576
#include "../Ruleset/RuleManufacture.h"
7677
#include "../Savegame/ItemContainer.h"
@@ -900,9 +901,15 @@ void GeoscapeState::time1Day()
900901
_game->getSavedGame()->addFinishedResearch(research, _game->getRuleset ());
901902
std::vector<RuleResearch *> newPossibleResearch;
902903
_game->getSavedGame()->getDependableResearch (newPossibleResearch, (*iter)->getRules(), _game->getRuleset(), *i);
904+
std::vector<RuleManufacture *> newPossibleManufacture;
905+
_game->getSavedGame()->getDependableManufacture (newPossibleManufacture, (*iter)->getRules(), _game->getRuleset(), *i);
903906
timerReset();
904907
popup(new ResearchCompleteState (_game, research));
905908
popup(new NewPossibleResearchState(_game, *i, newPossibleResearch));
909+
if (!newPossibleManufacture.empty())
910+
{
911+
popup(new NewPossibleManufactureState(_game, *i, newPossibleManufacture));
912+
}
906913
delete(*iter);
907914
}
908915
// Handle soldier wounds
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/*
2+
* Copyright 2010-2012 OpenXcom Developers.
3+
*
4+
* This file is part of OpenXcom.
5+
*
6+
* OpenXcom is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* OpenXcom is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
#include "NewPossibleManufactureState.h"
20+
#include "../Engine/Game.h"
21+
#include "../Engine/Palette.h"
22+
#include "../Engine/Language.h"
23+
#include "../Resource/ResourcePack.h"
24+
#include "../Interface/TextButton.h"
25+
#include "../Interface/Window.h"
26+
#include "../Interface/Text.h"
27+
#include "../Interface/TextList.h"
28+
#include "../Ruleset/RuleManufacture.h"
29+
#include "../Basescape/ManufactureState.h"
30+
31+
namespace OpenXcom
32+
{
33+
/**
34+
* Initializes all the elements in the EndManufacture screen.
35+
* @param game Pointer to the core game.
36+
* @param base Pointer to the base to get info from.
37+
* @param possibilities List of newly possible ManufactureProject
38+
*/
39+
NewPossibleManufactureState::NewPossibleManufactureState(Game * game, Base * base, const std::vector<RuleManufacture *> & possibilities) : State (game), _base(base)
40+
{
41+
_screen = false;
42+
43+
// Create objects
44+
_window = new Window(this, 288, 180, 16, 10);
45+
_btnOk = new TextButton(160, 14, 80, 149);
46+
_btnManufacture = new TextButton(160, 14, 80, 165);
47+
_txtTitle = new Text(288, 40, 16, 20);
48+
_lstPossibilities = new TextList(288, 80, 16, 56);
49+
50+
// Set palette
51+
_game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(6)), Palette::backPos, 16);
52+
53+
add(_window);
54+
add(_btnOk);
55+
add(_btnManufacture);
56+
add(_txtTitle);
57+
add(_lstPossibilities);
58+
59+
// Set up objects
60+
_window->setColor(Palette::blockOffset(15)-1);
61+
_window->setBackground(_game->getResourcePack()->getSurface("BACK17.SCR"));
62+
63+
_btnOk->setColor(Palette::blockOffset(8)+5);
64+
_btnOk->setText(_game->getLanguage()->getString("STR_OK"));
65+
_btnOk->onMouseClick((ActionHandler)&NewPossibleManufactureState::btnOkClick);
66+
_btnManufacture->setColor(Palette::blockOffset(8)+5);
67+
_btnManufacture->setText(_game->getLanguage()->getString("STR_ALLOCATE_MANUFACTURE"));
68+
_btnManufacture->onMouseClick((ActionHandler)&NewPossibleManufactureState::btnManufactureClick);
69+
_txtTitle->setColor(Palette::blockOffset(15)-1);
70+
_txtTitle->setBig();
71+
_txtTitle->setAlign(ALIGN_CENTER);
72+
_txtTitle->setText(_game->getLanguage()->getString("STR_WE_CAN_NOW_PRODUCE"));
73+
74+
_lstPossibilities->setColor(Palette::blockOffset(8)+10);
75+
_lstPossibilities->setColumns(1, 288);
76+
_lstPossibilities->setBig();
77+
_lstPossibilities->setAlign(ALIGN_CENTER);
78+
for(std::vector<RuleManufacture *>::const_iterator iter = possibilities.begin (); iter != possibilities.end (); ++iter)
79+
{
80+
_lstPossibilities->addRow (1, _game->getLanguage()->getString((*iter)->getName ()).c_str());
81+
}
82+
}
83+
84+
/**
85+
* Resets the palette.
86+
*/
87+
void NewPossibleManufactureState::init()
88+
{
89+
_game->setPalette(_game->getResourcePack()->getPalette("BACKPALS.DAT")->getColors(Palette::blockOffset(6)), Palette::backPos, 16);
90+
}
91+
92+
/**
93+
* return to the previous screen
94+
* @param action Pointer to an action.
95+
*/
96+
void NewPossibleManufactureState::btnOkClick(Action *action)
97+
{
98+
_game->popState ();
99+
}
100+
101+
/**
102+
* Open the ManufactureState so the player can dispatch available scientist.
103+
* @param action Pointer to an action.
104+
*/
105+
void NewPossibleManufactureState::btnManufactureClick(Action *action)
106+
{
107+
_game->popState();
108+
_game->pushState (new ManufactureState(_game, _base));
109+
}
110+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2010-2012 OpenXcom Developers.
3+
*
4+
* This file is part of OpenXcom.
5+
*
6+
* OpenXcom is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* OpenXcom is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
#ifndef OPENXCOM_NEWPOSSIBLEMANUFACTURESTATE
20+
#define OPENXCOM_NEWPOSSIBLEMANUFACTURESTATE
21+
22+
#include "../Engine/State.h"
23+
namespace OpenXcom
24+
{
25+
class Game;
26+
class Window;
27+
class TextButton;
28+
class Text;
29+
class Base;
30+
class TextList;
31+
class RuleManufacture;
32+
33+
/**
34+
Window which inform the player of new possible manufacture projects.
35+
Also allow to go to the ManufactureState to dispatch available engineers.
36+
*/
37+
class NewPossibleManufactureState : public State
38+
{
39+
Window *_window;
40+
Text *_txtTitle;
41+
TextList * _lstPossibilities;
42+
TextButton *_btnManufacture, *_btnOk;
43+
Base * _base;
44+
public:
45+
/// Creates the NewPossibleManufacture state.
46+
NewPossibleManufactureState(Game * game, Base * base, const std::vector<RuleManufacture *> & possibilities);
47+
/// Updates the palette.
48+
void init();
49+
/// Handler for clicking the OK button.
50+
void btnOkClick(Action *action);
51+
/// Handler for clicking the Allocate Manufacture button.
52+
void btnManufactureClick(Action *action);
53+
};
54+
}
55+
#endif

0 commit comments

Comments
 (0)