summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-04-21 18:59:42 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-04-21 18:59:42 +0200
commitc3a8bc36ce75984bdb5a54fbae4f77d84e4efbcc (patch)
tree1d334838c8f98e05b0c0c77a5f56ca65412a3585
parent4cfe1361fff6223d11a25cefd74af7a51b7d57bd (diff)
Get rid of src/game/text.cpp.
-rw-r--r--Makefile1
-rw-r--r--src/game/game.cpp30
-rw-r--r--src/game/game.hpp28
-rw-r--r--src/game/interface.cpp8
-rw-r--r--src/game/text.cpp88
-rw-r--r--src/game/unit_nest.cpp2
-rw-r--r--src/game/unit_repl.cpp2
-rw-r--r--src/game/unit_spider.cpp2
-rw-r--r--src/game/units.cpp4
9 files changed, 29 insertions, 136 deletions
diff --git a/Makefile b/Makefile
index f481bfb..bd4a292 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,6 @@ SRC := src/game/assets.cpp \
src/game/interface.cpp \
src/game/pseudostate.cpp \
src/game/rocket.cpp \
- src/game/text.cpp \
src/game/units.cpp \
src/game/unit_nest.cpp \
src/game/unit_repl.cpp \
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 5f89a60..70bd040 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -152,8 +152,18 @@ void state_t::select(rectf_t rect, int type)
continue;
if (select_unit(unit, type)) {
- if (unit->type == unit_t::UNIT_SOLDIER)
- unit->say(text::get(text::SAY_READY), false);
+ switch (unit->type) {
+ case unit_t::UNIT_SOLDIER:
+ unit->say("Ich bin bereit.", false);
+ break;
+
+ case unit_t::UNIT_SCIENTIST:
+ unit->say("Я готов.", false);
+ break;
+
+ default:
+ break;
+ }
}
if (select_one)
@@ -228,24 +238,24 @@ static void command_soldier(unit_soldier_t *soldier, v2f_t x, int number)
switch (number) {
case COMMAND_MOVE:
if (!soldier->start_moving(x))
- soldier->say(text::get(text::SAY_NO_PATH), false);
+ soldier->say("Es gibt keinen Weg.", false);
else {
soldier->move_marker = std::make_unique<fx_move_marker_t>(soldier->game, soldier->move.path.back());
- soldier->say(text::get(text::SAY_MOVING), false);
+ soldier->say("Ich bin unterwegs.", false);
}
break;
case COMMAND_STOP:
soldier->stop_moving();
soldier->manual_firing = false;
- soldier->say(text::get(text::SAY_STOPPING), false);
+ soldier->say("Halt.", false);
soldier->aim_marker.reset();
break;
case COMMAND_FIRE:
soldier->manual_firing = true;
soldier->manual_firing_target = x;
- soldier->say(text::get(text::SAY_FIRING), false);
+ soldier->say("Feuer!", false);
break;
case COMMAND_FIRE_ROCKET:
@@ -254,7 +264,7 @@ static void command_soldier(unit_soldier_t *soldier, v2f_t x, int number)
rocket_t *rocket;
if (soldier->rocket_fired) {
- soldier->say(text::get(text::SAY_NO_ROCKETS));
+ soldier->say("Keine Raketen!");
break;
}
@@ -272,16 +282,16 @@ static void command_scientist(unit_scientist_t *scientist, v2f_t x, int number)
switch (number) {
case COMMAND_MOVE:
if (!scientist->start_moving(x))
- scientist->say(text::get(text::SAY_NO_PATH), false);
+ scientist->say("Нет пути.", false);
else {
scientist->move_marker = std::make_unique<fx_move_marker_t>(scientist->game, scientist->move.path.back());
- scientist->say(text::get(text::SAY_MOVING), false);
+ scientist->say("Я иду.", false);
}
break;
case COMMAND_STOP:
scientist->stop_moving();
- scientist->say(text::get(text::SAY_STOPPING), false);
+ scientist->say("Стоп.", false);
scientist->aim_marker.reset();
break;
}
diff --git a/src/game/game.hpp b/src/game/game.hpp
index e4fdba2..2a472b7 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -253,34 +253,6 @@ namespace game {
void load(void);
}
- namespace text {
- typedef enum {
- LANG_ENGLISH
- } language_t;
-
- extern language_t language;
-
- typedef enum {
- PAUSED,
- UNPAUSED,
- FOLLOWING_ON,
- FOLLOWING_OFF,
- SAY_NO_PATH,
- SAY_READY,
- SAY_MOVING,
- SAY_STOPPING,
- SAY_FIRING,
- SAY_NO_ROCKETS,
- UNIT_NAME_SPIDER,
- UNIT_NAME_NEST,
- UNIT_NAME_REPL,
- UNIT_DEATH,
- UNIT_DESTRUCTION
- } index_t;
-
- std::string get(index_t index);
- }
-
class entity_t : public world::entity_t {
public:
game::state_t *game = 0;
diff --git a/src/game/interface.cpp b/src/game/interface.cpp
index c40023d..fbde982 100644
--- a/src/game/interface.cpp
+++ b/src/game/interface.cpp
@@ -34,7 +34,7 @@ void state_t::start_following(void)
camera.following = true;
camera.zero_point_s = camera.center;
camera.center = v2f_t(0, 0);
- print(text::get(text::FOLLOWING_ON));
+ print("Following: on.");
}
void state_t::stop_following(void)
@@ -42,7 +42,7 @@ void state_t::stop_following(void)
camera.following = false;
camera.center += camera.zero_point_s;
camera.zero_point_s = v2f_t(0, 0);
- print(text::get(text::FOLLOWING_OFF));
+ print("Following: off.");
}
void pie_menu_t::open(v2f_t wmouse, v2f_t mouse)
@@ -239,10 +239,10 @@ void state_t::tick(double dt)
case sf::Keyboard::Key::Space:
if (!game->paused) {
game->pause();
- print(text::get(text::PAUSED));
+ print("PAUSED");
} else {
game->resume();
- print(text::get(text::UNPAUSED));
+ print("UNPAUSED");
}
break;
diff --git a/src/game/text.cpp b/src/game/text.cpp
deleted file mode 100644
index de1e804..0000000
--- a/src/game/text.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-This file is part of Minitrem.
-
-Minitrem is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-Minitrem is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Minitrem. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "game.hpp"
-
-namespace game::text {
-
-language_t language = LANG_ENGLISH;
-
-static std::string get_english(index_t index)
-{
- switch (index) {
- case PAUSED:
- return "PAUSED";
-
- case UNPAUSED:
- return "UNPAUSED";
-
- case FOLLOWING_ON:
- return "Following: on.";
-
- case FOLLOWING_OFF:
- return "Following: off.";
-
- case SAY_NO_PATH:
- return "I can't get there.";
-
- case SAY_READY:
- return "Ready for orders.";
-
- case SAY_MOVING:
- return "On my way.";
-
- case SAY_STOPPING:
- return "Stopping.";
-
- case SAY_FIRING:
- return "Firing!";
-
- case SAY_NO_ROCKETS:
- return "Out of rockets.";
-
- case UNIT_NAME_SPIDER:
- return "Spider";
-
- case UNIT_NAME_NEST:
- return "Nest";
-
- case UNIT_NAME_REPL:
- return "Replicator";
-
- case UNIT_DEATH:
- return "died";
-
- case UNIT_DESTRUCTION:
- return "was destroyed";
-
- default:
- abort();
- }
-}
-
-std::string get(index_t index)
-{
- switch (language) {
- case LANG_ENGLISH:
- return get_english(index);
-
- default:
- abort();
- }
-}
-
-} // namespace text
diff --git a/src/game/unit_nest.cpp b/src/game/unit_nest.cpp
index fe4a077..8e22a35 100644
--- a/src/game/unit_nest.cpp
+++ b/src/game/unit_nest.cpp
@@ -29,7 +29,7 @@ unit_nest_t::unit_nest_t(game::state_t *game_) : unit_t(game_, UNIT_NEST)
render_layer = render::LAYER_NORMAL;
cmodel.cflags = CF_BODY;
- name = text::get(text::UNIT_NAME_NEST);
+ name = "Nest";
ignore_waking = false;
diff --git a/src/game/unit_repl.cpp b/src/game/unit_repl.cpp
index bad5ab0..57e18f8 100644
--- a/src/game/unit_repl.cpp
+++ b/src/game/unit_repl.cpp
@@ -27,7 +27,7 @@ unit_repl_t::unit_repl_t(game::state_t *game_) : unit_t(game_, UNIT_REPL)
render_layer = render::LAYER_FLAT;
cmodel.cflags = CF_SURFACE;
- name = text::get(text::UNIT_NAME_REPL);
+ name = "Replicator";
ignore_waking = false;
health = max_health = 35;
diff --git a/src/game/unit_spider.cpp b/src/game/unit_spider.cpp
index 6bd7509..714a51c 100644
--- a/src/game/unit_spider.cpp
+++ b/src/game/unit_spider.cpp
@@ -28,7 +28,7 @@ unit_spider_t::unit_spider_t(game::state_t *game) : unit_t(game, UNIT_SPIDER)
cmodel.cflags = CF_BODY_SMALL;
move.cflags = CF_SOLID | CF_WATER | CF_BODY_SMALL;
- name = text::get(text::UNIT_NAME_SPIDER);
+ name = "Spider";
ignore_waking = false;
diff --git a/src/game/units.cpp b/src/game/units.cpp
index 828ca6b..ef74b74 100644
--- a/src/game/units.cpp
+++ b/src/game/units.cpp
@@ -220,11 +220,11 @@ void unit_t::die(unit_t *killer)
case UNIT_SOLDIER:
case UNIT_SCIENTIST:
case UNIT_SPIDER:
- game->interface.print(name + " " + text::get(text::UNIT_DEATH) + ".");
+ game->interface.print(name + " died.");
break;
default:
- game->interface.print(name + " " + text::get(text::UNIT_DESTRUCTION) + ".");
+ game->interface.print(name + " was destroyed.");
break;
}