From 73f0a062817f8ec1276aff4cc1428609672ab98d Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Sun, 11 Apr 2004 14:55:59 +0000 Subject: [PATCH] - localized some more variables SVN-Revision: 475 --- src/gameloop.cpp | 16 ++++++++-------- src/gameloop.h | 1 + src/resources.cpp | 7 +++++++ src/resources.h | 7 +++++++ src/scene.cpp | 9 --------- src/scene.h | 5 +---- src/special.cpp | 1 + src/world.cpp | 1 + src/world.h | 8 +++++++- 9 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/gameloop.cpp b/src/gameloop.cpp index a24f457bf..5016baecc 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -73,8 +73,9 @@ GameSession::GameSession(const std::string& filename) world->load(filename); } -GameSession::GameSession(const std::string& subset_, int levelnb, int mode) - : subset(subset_) +GameSession::GameSession(const std::string& subset_, int levelnb_, int mode) + : subset(subset_), + levelnb(levelnb_) { init(); @@ -86,8 +87,7 @@ GameSession::GameSession(const std::string& subset_, int levelnb, int mode) timer_init(&frame_timer, true); st_gl_mode = mode; - level = levelnb; - + /* Init the game: */ world->arrays_free(); world->set_defaults(); @@ -99,7 +99,7 @@ GameSession::GameSession(const std::string& subset_, int levelnb, int mode) } else { - if(world->load(subset, level) != 0) + if(world->load(subset, levelnb) != 0) exit(1); } @@ -137,7 +137,7 @@ GameSession::levelintro(void) /* Level Intro: */ clearscreen(0, 0, 0); - sprintf(str, "LEVEL %d", level); + sprintf(str, "LEVEL %d", levelnb); text_drawf(&blue_text, str, 0, 200, A_HMIDDLE, A_TOP, 1); sprintf(str, "%s", world->get_level()->name.c_str()); @@ -350,7 +350,7 @@ GameSession::action() if (next_level) { /* End of a level! */ - level++; + levelnb++; next_level = 0; if(st_gl_mode != ST_GL_TEST) { @@ -408,7 +408,7 @@ GameSession::action() } else { - if(world->get_level()->load(subset, level) != 0) + if(world->get_level()->load(subset, levelnb) != 0) return 0; } diff --git a/src/gameloop.h b/src/gameloop.h index 05d73ecfa..dc1e3c140 100644 --- a/src/gameloop.h +++ b/src/gameloop.h @@ -50,6 +50,7 @@ class GameSession // FIXME: Hack for restarting the level std::string subset; + int levelnb; public: GameSession(); diff --git a/src/resources.cpp b/src/resources.cpp index fb93a389f..41e1773dd 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -13,6 +13,13 @@ texture_type img_poletop; texture_type img_flag[2]; texture_type img_cloud[2][4]; +texture_type img_box_full; +texture_type img_box_empty; +texture_type img_mints; +texture_type img_coffee; +texture_type img_super_bkgd; +texture_type img_red_glow; + /* Load graphics/sounds shared between all levels: */ void loadshared() { diff --git a/src/resources.h b/src/resources.h index e9ed41fc2..33c6719bc 100644 --- a/src/resources.h +++ b/src/resources.h @@ -8,6 +8,13 @@ extern texture_type img_poletop; extern texture_type img_flag[2]; extern texture_type img_cloud[2][4]; +extern texture_type img_box_full; +extern texture_type img_box_empty; +extern texture_type img_mints; +extern texture_type img_coffee; +extern texture_type img_super_bkgd; +extern texture_type img_red_glow; + void loadshared(); void unloadshared(); diff --git a/src/scene.cpp b/src/scene.cpp index aab4d217b..82826d5df 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -15,11 +15,8 @@ int score; int distros; -int level; int next_level; int score_multiplier; -bool counting_distros; -int distro_counter; timer_type super_bkgd_timer; // FIXME: Move this into a view class @@ -27,12 +24,6 @@ float scroll_x; unsigned int global_frame_counter; -texture_type img_box_full; -texture_type img_box_empty; -texture_type img_mints; -texture_type img_coffee; -texture_type img_super_bkgd; -texture_type img_red_glow; timer_type time_left; double frame_ratio; diff --git a/src/scene.h b/src/scene.h index 33b361070..daaa4e645 100644 --- a/src/scene.h +++ b/src/scene.h @@ -18,19 +18,16 @@ #define FRAME_RATE 10 // 100 Frames per second (10ms) +// Player stats extern int score; extern int distros; -extern int level; extern int next_level; extern int score_multiplier; -extern bool counting_distros; -extern int distro_counter; extern timer_type super_bkgd_timer; extern float scroll_x; extern unsigned int global_frame_counter; -extern texture_type img_box_full, img_box_empty, img_mints, img_coffee, img_super_bkgd, img_red_glow; extern timer_type time_left; extern double frame_ratio; diff --git a/src/special.cpp b/src/special.cpp index b62a4b766..ff1db1343 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -19,6 +19,7 @@ #include "scene.h" #include "globals.h" #include "player.h" +#include "resources.h" texture_type img_bullet; texture_type img_golden_herring; diff --git a/src/world.cpp b/src/world.cpp index cf9f61643..d4188cd6d 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -27,6 +27,7 @@ #include "world.h" #include "level.h" #include "tile.h" +#include "resources.h" texture_type img_distro[4]; diff --git a/src/world.h b/src/world.h index c3eda1d8e..935918087 100644 --- a/src/world.h +++ b/src/world.h @@ -50,8 +50,10 @@ class World std::vector bullets; std::vector particle_systems; - static World* current_; + int distro_counter; + bool counting_distros; + static World* current_; public: static World* current() { return current_; } static void set_current(World* w) { current_ = w; } @@ -113,3 +115,7 @@ extern World global_world; #endif /*SUPERTUX_WORLD_H*/ +/* Local Variables: */ +/* mode:c++ */ +/* End */ + -- 2.11.0