Make it build with -DCOMPILE_AMALGATION=ON. Still not certain how intern_draw/next_po...
authormathnerd314 <mathnerd314@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Fri, 1 Jan 2010 05:01:41 +0000 (05:01 +0000)
committermathnerd314 <mathnerd314@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Fri, 1 Jan 2010 05:01:41 +0000 (05:01 +0000)
Also remove loop for leveldone music

git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6236 837edb03-e0f3-0310-88ca-d4d4e8b29345

35 files changed:
data/music/leveldone.music
src/badguy/captainsnowball.cpp
src/badguy/flame.cpp
src/badguy/mole.cpp
src/badguy/skullyhop.cpp
src/badguy/spidermite.cpp
src/badguy/stalactite.cpp
src/badguy/stumpy.cpp
src/badguy/toad.cpp
src/badguy/totem.cpp
src/badguy/treewillowisp.cpp
src/badguy/willowisp.cpp
src/badguy/yeti.cpp
src/badguy/yeti_stalactite.cpp
src/object/ambient_sound.cpp
src/object/camera.cpp
src/object/candle.cpp
src/object/level_time.cpp
src/object/platform.cpp
src/object/star.cpp
src/object/thunderstorm.cpp
src/object/tilemap.cpp
src/object/wind.cpp
src/scripting/functions.cpp
src/scripting/squirrel_util.cpp
src/scripting/squirrel_util.hpp
src/supertux/colorscheme.cpp
src/supertux/sector.cpp
src/video/drawing_context.cpp
src/video/drawing_context.hpp
src/video/drawing_request.hpp
src/video/gl/gl_lightmap.cpp
src/video/gl/gl_renderer.cpp
src/video/gl/gl_renderer.hpp
src/worldmap/worldmap.cpp

index 74496ff..8f049e3 100644 (file)
@@ -1,5 +1,3 @@
 (supertux-music
   (file "leveldone.ogg")
-  (loop-begin 0.653061224489796) ;sample no. 28800
-  (loop-at    5.514739229024940) ;sample no. 243200
 )
index d482641..4e3e7da 100644 (file)
@@ -21,7 +21,7 @@
 #include "supertux/sector.hpp"
 
 namespace{
-  static const float WALK_SPEED = 100; 
+  static const float CAPTAIN_WALK_SPEED = 100; 
   static const float BOARDING_SPEED = 200;
 }
 
@@ -82,7 +82,7 @@ void
 CaptainSnowball::collision_solid(const CollisionHit& hit)
 {
   if (is_active() && (walk_speed == BOARDING_SPEED)) {
-    walk_speed = WALK_SPEED;
+    walk_speed = CAPTAIN_WALK_SPEED;
     physic.set_velocity_x(dir == LEFT ? -walk_speed : walk_speed);
   }
   WalkingBadguy::collision_solid(hit);
index ff3c062..5387b74 100644 (file)
@@ -22,7 +22,7 @@
 #include "supertux/object_factory.hpp"
 #include "util/reader.hpp"
 
-static const std::string SOUNDFILE = "sounds/flame.wav";
+static const std::string FLAME_SOUND = "sounds/flame.wav";
 
 Flame::Flame(const Reader& reader) :
   BadGuy(reader, "images/creatures/flame/flame.sprite", LAYER_FLOATINGOBJECTS), 
@@ -36,7 +36,7 @@ Flame::Flame(const Reader& reader) :
   bbox.set_pos(Vector(start_position.x + cos(angle) * radius,
                       start_position.y + sin(angle) * radius));
   countMe = false;
-  sound_manager->preload(SOUNDFILE);
+  sound_manager->preload(FLAME_SOUND);
 
   set_colgroup_active(COLGROUP_TOUCHABLE);
 }
@@ -55,7 +55,7 @@ Flame::active_update(float elapsed_time)
 void
 Flame::activate()
 {
-  sound_source.reset(sound_manager->create_sound_source(SOUNDFILE));
+  sound_source.reset(sound_manager->create_sound_source(FLAME_SOUND));
   sound_source->set_position(get_pos());
   sound_source->set_looping(true);
   sound_source->set_gain(2.0);
index 291d86e..302d089 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <math.h>
 
-static const float IDLE_TIME = 0.2f; /**< time to wait before and after throwing */
+static const float MOLE_WAIT_TIME = 0.2f; /**< time to wait before and after throwing */
 static const float THROW_TIME = 4.6f; /**< time to spend throwing */
 static const float THROW_INTERVAL = 1; /**< time between two thrown rocks */
 static const float THROW_VELOCITY = 400; /**< initial velocity of thrown rocks */
@@ -139,7 +139,7 @@ Mole::set_state(MoleState new_state)
     case PRE_THROWING:
       sprite->set_action("idle");
       set_colgroup_active(COLGROUP_DISABLED);
-      timer.start(IDLE_TIME);
+      timer.start(MOLE_WAIT_TIME);
       break;
     case THROWING:
       sprite->set_action("idle");
@@ -150,7 +150,7 @@ Mole::set_state(MoleState new_state)
     case POST_THROWING:
       sprite->set_action("idle");
       set_colgroup_active(COLGROUP_DISABLED);
-      timer.start(IDLE_TIME);
+      timer.start(MOLE_WAIT_TIME);
       break;
     case PEEKING:
       sprite->set_action("peeking", 1);
index a401cd6..c76bace 100644 (file)
 #include "supertux/object_factory.hpp"
 
 namespace {
-const float VERTICAL_SPEED = -450;   /**< y-speed when jumping */
-const float HORIZONTAL_SPEED = 220; /**< x-speed when jumping */
 const float MIN_RECOVER_TIME = 0.1f; /**< minimum time to stand still before starting a (new) jump */
 const float MAX_RECOVER_TIME = 1.0f; /**< maximum time to stand still before starting a (new) jump */
-static const std::string HOP_SOUND = "sounds/hop.ogg";
+static const std::string SKULLYHOP_SOUND = "sounds/hop.ogg";
 }
 
 SkullyHop::SkullyHop(const Reader& reader) :
@@ -34,7 +32,7 @@ SkullyHop::SkullyHop(const Reader& reader) :
   recover_timer(),
   state()
 {
-  sound_manager->preload( HOP_SOUND );
+  sound_manager->preload( SKULLYHOP_SOUND );
 }
 
 SkullyHop::SkullyHop(const Vector& pos, Direction d) :
@@ -42,7 +40,7 @@ SkullyHop::SkullyHop(const Vector& pos, Direction d) :
   recover_timer(),
   state()
 {
-  sound_manager->preload( HOP_SOUND );
+  sound_manager->preload( SKULLYHOP_SOUND );
 }
 
 void
@@ -69,9 +67,11 @@ SkullyHop::set_state(SkullyHopState newState)
     } else
       if (newState == JUMPING) {
         sprite->set_action(dir == LEFT ? "jumping-left" : "jumping-right");
+const float HORIZONTAL_SPEED = 220; /**< x-speed when jumping */
         physic.set_velocity_x(dir == LEFT ? -HORIZONTAL_SPEED : HORIZONTAL_SPEED);
+const float VERTICAL_SPEED = -450;   /**< y-speed when jumping */
         physic.set_velocity_y(VERTICAL_SPEED);
-        sound_manager->play( HOP_SOUND, get_pos());
+        sound_manager->play( SKULLYHOP_SOUND, get_pos());
       }
 
   state = newState;
index 389d70e..634088a 100644 (file)
@@ -21,7 +21,7 @@
 #include "supertux/object_factory.hpp"
 
 static const float FLYTIME = 1.2f;
-static const float FLYSPEED = -100.0f;
+static const float MOVE_SPEED = -100.0f;
 
 SpiderMite::SpiderMite(const Reader& reader) :
   BadGuy(reader, "images/creatures/spidermite/spidermite.sprite"),
@@ -44,7 +44,7 @@ SpiderMite::initialize()
 {
   sprite->set_action(dir == LEFT ? "left" : "right");
   mode = FLY_UP;
-  physic.set_velocity_y(FLYSPEED);
+  physic.set_velocity_y(MOVE_SPEED);
   timer.start(FLYTIME/2);
 }
 
@@ -70,10 +70,10 @@ SpiderMite::active_update(float elapsed_time)
   if(timer.check()) {
     if(mode == FLY_UP) {
       mode = FLY_DOWN;
-      physic.set_velocity_y(-FLYSPEED);
+      physic.set_velocity_y(-MOVE_SPEED);
     } else if(mode == FLY_DOWN) {
       mode = FLY_UP;
-      physic.set_velocity_y(FLYSPEED);
+      physic.set_velocity_y(MOVE_SPEED);
     }
     timer.start(FLYTIME);
   }
index 3c63bea..6742c73 100644 (file)
@@ -23,7 +23,6 @@
 
 static const int SHAKE_RANGE_X = 40;
 static const float SHAKE_TIME = .8f;
-static const float SQUISH_TIME = 2;
 static const float SHAKE_RANGE_Y = 400;
 
 Stalactite::Stalactite(const Reader& lisp) :
@@ -55,10 +54,8 @@ Stalactite::active_update(float elapsed_time)
       physic.enable_gravity(true);
       set_colgroup_active(COLGROUP_MOVING);
     }
-  } else if(state == STALACTITE_FALLING || state == STALACTITE_SQUISHED) {
+  } else if(state == STALACTITE_FALLING) {
     movement = physic.get_movement(elapsed_time);
-    if(state == STALACTITE_SQUISHED && timer.check())
-      remove_me();
   }
 }
 
@@ -66,10 +63,12 @@ void
 Stalactite::squish()
 {
   state = STALACTITE_SQUISHED;
-  set_colgroup_active(COLGROUP_MOVING_ONLY_STATIC);
-  sprite->set_action("squished");
-  if(!timer.started())
-    timer.start(SQUISH_TIME);
+  physic.enable_gravity(true);
+  physic.set_velocity_x(0);
+  physic.set_velocity_y(0);
+  set_state(STATE_SQUISHED);
+  set_group(COLGROUP_MOVING_ONLY_STATIC);
+  run_dead_script();
 }
 
 void
index 1ad03a6..218d871 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <math.h>
 
-static const float WALKSPEED = 120;
+static const float STUMPY_SPEED = 120;
 static const float INVINCIBLE_TIME = 1;
 
 Stumpy::Stumpy(const Reader& reader) :
@@ -33,7 +33,7 @@ Stumpy::Stumpy(const Reader& reader) :
   mystate(STATE_NORMAL),
   invincible_timer()
 {
-  walk_speed = WALKSPEED;
+  walk_speed = STUMPY_SPEED;
   max_drop_height = 16;
   sound_manager->preload("sounds/mr_treehit.ogg");
 }
@@ -43,7 +43,7 @@ Stumpy::Stumpy(const Vector& pos, Direction d) :
   mystate(STATE_INVINCIBLE),
   invincible_timer()
 {
-  walk_speed = WALKSPEED;
+  walk_speed = STUMPY_SPEED;
   max_drop_height = 16;
   sound_manager->preload("sounds/mr_treehit.ogg");
   invincible_timer.start(INVINCIBLE_TIME);
index 9925739..9fc27c6 100644 (file)
@@ -24,7 +24,7 @@
 namespace {
 const float VERTICAL_SPEED = -450;   /**< y-speed when jumping */
 const float HORIZONTAL_SPEED = 320; /**< x-speed when jumping */
-const float RECOVER_TIME = 0.5; /**< time to stand still before starting a (new) jump */
+const float TOAD_RECOVER_TIME = 0.5; /**< time to stand still before starting a (new) jump */
 static const std::string HOP_SOUND = "sounds/hop.ogg";
 }
 
@@ -60,7 +60,7 @@ Toad::set_state(ToadState newState)
     physic.set_velocity_y(0);
     sprite->set_action(dir == LEFT ? "idle-left" : "idle-right");
 
-    recover_timer.start(RECOVER_TIME);
+    recover_timer.start(TOAD_RECOVER_TIME);
   } else
     if (newState == JUMPING) {
       sprite->set_action(dir == LEFT ? "jumping-left" : "jumping-right");
index 068472e..70bd850 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <math.h>
 
-static const float WALKSPEED = 100;
 static const float JUMP_ON_SPEED_Y = -400;
 static const float JUMP_OFF_SPEED_Y = -500;
 static const std::string LAND_ON_TOTEM_SOUND = "sounds/totem.ogg";
@@ -61,6 +60,7 @@ void
 Totem::initialize()
 {
   if (!carried_by) {
+static const float WALKSPEED = 100;
     physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED);
     sprite->set_action(dir == LEFT ? "walking-left" : "walking-right");
     return;
index ff84108..2b6c87e 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <math.h>
 
-static const std::string SOUNDFILE = "sounds/willowisp.wav";
+static const std::string TREEWILLOSOUND = "sounds/willowisp.wav";
 static const float       SUCKSPEED = 25;
 
 TreeWillOWisp::TreeWillOWisp(GhostTree* tree, const Vector& pos,
@@ -42,7 +42,7 @@ TreeWillOWisp::TreeWillOWisp(GhostTree* tree, const Vector& pos,
   tree(tree),
   suck_target()
 {
-  sound_manager->preload(SOUNDFILE);
+  sound_manager->preload(TREEWILLOSOUND);
 
   this->radius = radius;
   this->angle  = 0;
@@ -58,7 +58,7 @@ TreeWillOWisp::~TreeWillOWisp()
 void
 TreeWillOWisp::activate()
 {
-  sound_source.reset(sound_manager->create_sound_source(SOUNDFILE));
+  sound_source.reset(sound_manager->create_sound_source(TREEWILLOSOUND));
   sound_source->set_position(get_pos());
   sound_source->set_looping(true);
   sound_source->set_gain(2.0);
index 748a443..7fb4082 100644 (file)
@@ -278,8 +278,8 @@ WillOWisp::expose(HSQUIRRELVM vm, SQInteger table_idx)
     return;
 
   std::cout << "Expose me '" << name << "'\n";
-  scripting::WillOWisp* interface = static_cast<scripting::WillOWisp*> (this);
-  expose_object(vm, table_idx, interface, name);
+  scripting::WillOWisp* _this = static_cast<scripting::WillOWisp*> (this);
+  expose_object(vm, table_idx, _this, name);
 }
   
 void
index ba8b54a..6249ea9 100644 (file)
@@ -48,7 +48,7 @@ const float STOMP_WAIT = .5; /**< time we stay on the dais before jumping again
 const float SAFE_TIME = .5; /**< the time we are safe when tux just hit us */
 const int INITIAL_HITPOINTS = 3; /**< number of hits we can take */
 
-const float SQUISH_TIME = 5;
+const float YETI_SQUISH_TIME = 5;
 }
 
 Yeti::Yeti(const Reader& reader) :
@@ -222,7 +222,7 @@ void Yeti::take_hit(Player& )
     physic.set_velocity_y(0);
 
     state = SQUISHED;
-    state_timer.start(SQUISH_TIME);
+    state_timer.start(YETI_SQUISH_TIME);
     set_colgroup_active(COLGROUP_MOVING_ONLY_STATIC);
     sprite->set_action("dead");
 
index 12a925e..59d819b 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "supertux/object_factory.hpp"
 
-static const float SHAKE_TIME = .8f;
+static const float YT_SHAKE_TIME = .8f;
 
 YetiStalactite::YetiStalactite(const Reader& lisp)
   : Stalactite(lisp)
@@ -32,7 +32,7 @@ YetiStalactite::~YetiStalactite()
 void
 YetiStalactite::start_shaking()
 {
-  timer.start(SHAKE_TIME);
+  timer.start(YT_SHAKE_TIME);
   state = STALACTITE_SHAKING;
 }
 
index d0d651b..730e7a7 100644 (file)
@@ -235,8 +235,8 @@ AmbientSound::draw(DrawingContext &)
 void
 AmbientSound::expose(HSQUIRRELVM vm, SQInteger table_idx)
 {
-  scripting::AmbientSound* interface = static_cast<scripting::AmbientSound*> (this);
-  expose_object(vm, table_idx, interface, name, false);
+  scripting::AmbientSound* _this = static_cast<scripting::AmbientSound*> (this);
+  expose_object(vm, table_idx, _this, name, false);
 }
 
 void
index 4ecf5b5..9e1f53f 100644 (file)
@@ -146,8 +146,8 @@ void
 Camera::expose(HSQUIRRELVM vm, SQInteger table_idx)
 {
   if(name.empty()) return;
-  scripting::Camera* interface = new scripting::Camera(this);
-  expose_object(vm, table_idx, interface, name, true);
+  scripting::Camera* _this = new scripting::Camera(this);
+  expose_object(vm, table_idx, _this, name, true);
 }
 
 void
@@ -229,7 +229,7 @@ Camera::scroll_to(const Vector& goal, float scrolltime)
   mode = SCROLLTO;
 }
 
-static const float EPSILON = .00001f;
+static const float CAMERA_EPSILON = .00001f;
 static const float MAX_SPEED_Y = 140;
 
 void
@@ -312,7 +312,7 @@ Camera::update_scroll_normal(float elapsed_time)
   last_player_pos = player_pos;
 
   // check that we don't have division by zero later
-  if(elapsed_time < EPSILON)
+  if(elapsed_time < CAMERA_EPSILON)
     return;
 
   /****** Vertical Scrolling part ******/
@@ -360,14 +360,14 @@ Camera::update_scroll_normal(float elapsed_time)
     float upperend = SCREEN_HEIGHT * config.edge_x;
     float lowerend = SCREEN_HEIGHT * (1 - config.edge_x);
 
-    if (player_delta.y < -EPSILON) {
+    if (player_delta.y < -CAMERA_EPSILON) {
       // walking left
       lookahead_pos.y -= player_delta.y * config.dynamic_speed_sm;
 
       if(lookahead_pos.y > lowerend) {
         lookahead_pos.y = lowerend;
       }
-    } else if (player_delta.y > EPSILON) {
+    } else if (player_delta.y > CAMERA_EPSILON) {
       // walking right
       lookahead_pos.y -= player_delta.y * config.dynamic_speed_sm;
       if(lookahead_pos.y < upperend) {
@@ -445,8 +445,8 @@ Camera::update_scroll_normal(float elapsed_time)
 
     // Find out direction in which the player moves
     LookaheadMode walkDirection;
-    if (player_delta.x < -EPSILON) walkDirection = LOOKAHEAD_LEFT;
-    else if (player_delta.x > EPSILON) walkDirection = LOOKAHEAD_RIGHT;
+    if (player_delta.x < -CAMERA_EPSILON) walkDirection = LOOKAHEAD_LEFT;
+    else if (player_delta.x > CAMERA_EPSILON) walkDirection = LOOKAHEAD_RIGHT;
     else if (player->dir == ::LEFT) walkDirection = LOOKAHEAD_LEFT;
     else walkDirection = LOOKAHEAD_RIGHT;
 
@@ -531,14 +531,14 @@ Camera::update_scroll_normal(float elapsed_time)
     float LEFTEND = SCREEN_WIDTH * config.edge_x;
     float RIGHTEND = SCREEN_WIDTH * (1 - config.edge_x);
 
-    if (player_delta.x < -EPSILON) {
+    if (player_delta.x < -CAMERA_EPSILON) {
       // walking left
       lookahead_pos.x -= player_delta.x * config.dynamic_speed_sm;
       if(lookahead_pos.x > RIGHTEND) {
         lookahead_pos.x = RIGHTEND;
       }
 
-    } else if (player_delta.x > EPSILON) {
+    } else if (player_delta.x > CAMERA_EPSILON) {
       // walking right
       lookahead_pos.x -= player_delta.x * config.dynamic_speed_sm;
       if(lookahead_pos.x < LEFTEND) {
index d428745..1123ce0 100644 (file)
@@ -70,8 +70,8 @@ void
 Candle::expose(HSQUIRRELVM vm, SQInteger table_idx)
 {
   if (name.empty()) return;
-  scripting::Candle* interface = new scripting::Candle(this);
-  expose_object(vm, table_idx, interface, name, true);
+  scripting::Candle* _this = new scripting::Candle(this);
+  expose_object(vm, table_idx, _this, name, true);
 }
 
 void
index 44d656b..011cb4f 100644 (file)
@@ -46,8 +46,8 @@ void
 LevelTime::expose(HSQUIRRELVM vm, SQInteger table_idx)
 {
   if (name.empty()) return;
-  scripting::LevelTime* interface = new scripting::LevelTime(this);
-  expose_object(vm, table_idx, interface, name, true);
+  scripting::LevelTime* _this = new scripting::LevelTime(this);
+  expose_object(vm, table_idx, _this, name, true);
 }
 
 void
index aa03923..7c38238 100644 (file)
@@ -133,8 +133,8 @@ void
 Platform::expose(HSQUIRRELVM vm, SQInteger table_idx)
 {
   if (name.empty()) return;
-  scripting::Platform* interface = new scripting::Platform(this);
-  expose_object(vm, table_idx, interface, name, true);
+  scripting::Platform* _this = new scripting::Platform(this);
+  expose_object(vm, table_idx, _this, name, true);
 }
 
 void
index 9e7932a..f421d43 100644 (file)
 #include "object/star.hpp"
 
 static const float INITIALJUMP = -400;
-static const float SPEED = 150;
-static const float JUMPSPEED = -300;
+static const float STAR_SPEED = 150;
+static const float JUMPSTAR_SPEED = -300;
 
 Star::Star(const Vector& pos, Direction direction) :
   MovingSprite(pos, "images/powerups/star/star.sprite", LAYER_OBJECTS, COLGROUP_MOVING),
   physic()
 {
-  physic.set_velocity((direction == LEFT) ? -SPEED : SPEED, INITIALJUMP);
+  physic.set_velocity((direction == LEFT) ? -STAR_SPEED : STAR_SPEED, INITIALJUMP);
 }
 
 void
@@ -38,7 +38,7 @@ void
 Star::collision_solid(const CollisionHit& hit)
 {
   if(hit.bottom) {
-    physic.set_velocity_y(JUMPSPEED);
+    physic.set_velocity_y(JUMPSTAR_SPEED);
   } else if(hit.top) {
     physic.set_velocity_y(0);
   } else if(hit.left || hit.right) {
index ba4e549..253c823 100644 (file)
@@ -86,8 +86,8 @@ void
 Thunderstorm::expose(HSQUIRRELVM vm, SQInteger table_idx)
 {
   if (name == "") return;
-  scripting::Thunderstorm* interface = new scripting::Thunderstorm(this);
-  expose_object(vm, table_idx, interface, name, true);
+  scripting::Thunderstorm* _this = new scripting::Thunderstorm(this);
+  expose_object(vm, table_idx, _this, name, true);
 }
 
 void
index a4c8510..1c5466e 100644 (file)
@@ -256,8 +256,8 @@ void
 TileMap::expose(HSQUIRRELVM vm, SQInteger table_idx)
 {
   if (name.empty()) return;
-  scripting::TileMap* interface = new scripting::TileMap(this);
-  expose_object(vm, table_idx, interface, name, true);
+  scripting::TileMap* _this = new scripting::TileMap(this);
+  expose_object(vm, table_idx, _this, name, true);
 }
 
 void
index 0072fe2..49c5a97 100644 (file)
@@ -95,8 +95,8 @@ Wind::expose(HSQUIRRELVM vm, SQInteger table_idx)
   if (name == "")
     return;
 
-  scripting::Wind* interface = new scripting::Wind(this);
-  expose_object(vm, table_idx, interface, name, true);
+  scripting::Wind* _this = new scripting::Wind(this);
+  expose_object(vm, table_idx, _this, name, true);
 }
 
 void
index 21b33bd..6c84d30 100644 (file)
@@ -113,16 +113,6 @@ void load_level(const std::string& filename)
   g_screen_manager->push_screen(new GameSession(filename, GameSession::current()->get_player_status()));
 }
 
-static SQInteger squirrel_read_char(SQUserPointer file)
-{
-  std::istream* in = reinterpret_cast<std::istream*> (file);
-  char c = in->get();
-  if(in->eof())
-    return 0;
-
-  return c;
-}
-
 void import(HSQUIRRELVM vm, const std::string& filename)
 {
   IFileStream in(filename);
index ffc7b4f..d3e50e0 100644 (file)
@@ -308,7 +308,7 @@ void print_squirrel_stack(HSQUIRRELVM v)
   printf("--------------------------------------------------------------\n");
 }
 
-static SQInteger squirrel_read_char(SQUserPointer file)
+SQInteger squirrel_read_char(SQUserPointer file)
 {
   std::istream* in = reinterpret_cast<std::istream*> (file);
   char c = in->get();
index f419bdf..aac6492 100644 (file)
@@ -33,6 +33,8 @@ void update_debugger();
 std::string squirrel2string(HSQUIRRELVM vm, SQInteger i);
 void print_squirrel_stack(HSQUIRRELVM vm);
 
+SQInteger squirrel_read_char(SQUserPointer file);
+
 HSQOBJECT create_thread(HSQUIRRELVM vm);
 SQObject vm_to_object(HSQUIRRELVM vm);
 HSQUIRRELVM object_to_vm(HSQOBJECT object);
index 112288d..462cfe2 100644 (file)
@@ -1,61 +1,65 @@
+//  SuperTux
+//  Copyright (C) 2009 qMax
+//
+//  This program 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 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#include "gui/menu.hpp"
+#include "object/floating_text.hpp"
+#include "object/level_time.hpp"
+#include "object/text_object.hpp"
+#include "supertux/levelintro.hpp"
+#include "supertux/player_status.hpp"
+#include "supertux/statistics.hpp"
+#include "supertux/textscroller.hpp"
+#include "trigger/climbable.hpp"
+#include "trigger/secretarea_trigger.hpp"
 #include "video/color.hpp"
+#include "worldmap/worldmap.hpp"
+
+Color LevelIntro::header_color(1.0,1.0,0.6);
+Color LevelIntro::author_color(1.0,1.0,1.0);
+Color LevelIntro::stat_hdr_color(0.2,0.5,1.0);
+Color LevelIntro::stat_color(1.0,1.0,1.0);
+
+Color Statistics::header_color(1.0,1.0,1.0);
+Color Statistics::text_color(1.0,1.0,0.6);
+
+Color Menu::default_color(1.0,1.0,1.0);
+Color Menu::active_color(0.2,0.5,1.0);
+Color Menu::inactive_color(0.5,0.5,0.5);
+Color Menu::label_color(0.0,1.0,1.0);
+Color Menu::field_color(1.0,1.0,0.6);
+
+Color PlayerStatus::text_color(1.0,1.0,0.6);
+
+Color TextObject::default_color(1.0,1.0,1.0);
+
+Color FloatingText::text_color(1.0,1.0,0.6);
+
+Color LevelTime::text_color(1.0,1.0,0.6);
+
+Color SecretAreaTrigger::text_color(1.0,1.0,0.6);
+
+Color Climbable::text_color(1.0,1.0,0.6);
+
+Color worldmap::WorldMap::level_title_color(1.0,1.0,1.0);
+Color worldmap::WorldMap::message_color(1.0,1.0,0.6);
+Color worldmap::WorldMap::teleporter_message_color(1.0,1.0,1.0);
 
-namespace LevelIntro {
-Color header_color(1.0,1.0,0.6);
-Color author_color(1.0,1.0,1.0);
-Color stat_hdr_color(0.2,0.5,1.0);
-Color stat_color(1.0,1.0,1.0);
-}
-
-namespace Statistics {
-Color header_color(1.0,1.0,1.0);
-Color text_color(1.0,1.0,0.6);
-}
-
-namespace Menu {
-Color default_color(1.0,1.0,1.0);
-Color active_color(0.2,0.5,1.0);
-Color inactive_color(0.5,0.5,0.5);
-Color label_color(0.0,1.0,1.0);
-Color field_color(1.0,1.0,0.6);
-}
-
-namespace PlayerStatus {
-Color text_color(1.0,1.0,0.6);
-}
-
-namespace TextObject {
-Color default_color(1.0,1.0,1.0);
-}
-
-namespace FloatingText {
-Color text_color(1.0,1.0,0.6);
-}
-
-namespace LevelTime {
-Color text_color(1.0,1.0,0.6);
-}
-
-namespace SecretAreaTrigger {
-Color text_color(1.0,1.0,0.6);
-}
-
-namespace Climbable {
-Color text_color(1.0,1.0,0.6);
-}
-
-namespace worldmap { 
-namespace WorldMap {
-Color level_title_color(1.0,1.0,1.0);
-Color message_color(1.0,1.0,0.6);
-Color teleporter_message_color(1.0,1.0,1.0);
-}}
-
-namespace TextScroller {
-Color small_color(1.0,1.0,1.0);
-Color heading_color(1.0,1.0,0.6);
-Color reference_color(0.2,0.6,1.0);
-Color normal_color(1.0,1.0,1.0);
-}
+Color TextScroller::small_color(1.0,1.0,1.0);
+Color TextScroller::heading_color(1.0,1.0,0.6);
+Color TextScroller::reference_color(0.2,0.6,1.0);
+Color TextScroller::normal_color(1.0,1.0,1.0);
 
 /* EOF */
index 126253a..76ebf06 100644 (file)
@@ -768,11 +768,11 @@ Sector::before_object_add(GameObject* object)
 void
 Sector::try_expose(GameObject* object)
 {
-  ScriptInterface* interface = dynamic_cast<ScriptInterface*> (object);
-  if(interface != NULL) {
+  ScriptInterface* object_ = dynamic_cast<ScriptInterface*> (object);
+  if(object_ != NULL) {
     HSQUIRRELVM vm = scripting::global_vm;
     sq_pushobject(vm, sector_table);
-    interface->expose(vm, -1);
+    object_->expose(vm, -1);
     sq_pop(vm, 1);
   }
 }
@@ -782,8 +782,8 @@ Sector::try_expose_me()
 {
   HSQUIRRELVM vm = scripting::global_vm;
   sq_pushobject(vm, sector_table);
-  scripting::SSector* interface = static_cast<scripting::SSector*> (this);
-  expose_object(vm, -1, interface, "settings", false);
+  scripting::SSector* this_ = static_cast<scripting::SSector*> (this);
+  expose_object(vm, -1, this_, "settings", false);
   sq_pop(vm, 1);
 }
 
@@ -811,13 +811,13 @@ Sector::before_object_remove(GameObject* object)
 void
 Sector::try_unexpose(GameObject* object)
 {
-  ScriptInterface* interface = dynamic_cast<ScriptInterface*> (object);
-  if(interface != NULL) {
+  ScriptInterface* object_ = dynamic_cast<ScriptInterface*> (object);
+  if(object_ != NULL) {
     HSQUIRRELVM vm = scripting::global_vm;
     SQInteger oldtop = sq_gettop(vm);
     sq_pushobject(vm, sector_table);
     try {
-      interface->unexpose(vm, -1);
+      object_->unexpose(vm, -1);
     } catch(std::exception& e) {
       log_warning << "Couldn't unregister object: " << e.what() << std::endl;
     }
index 5814c04..57b0a76 100644 (file)
 #include "video/texture_manager.hpp"
 #include "video/video_systems.hpp"
 
-static inline int next_po2(int val)
-{
-  int result = 1;
-  while(result < val)
-    result *= 2;
-
-  return result;
-}
-
 DrawingContext::DrawingContext() :
   renderer(0), 
   lightmap(0),
index 3bfedc8..5715df6 100644 (file)
@@ -36,6 +36,15 @@ class Texture;
 class Renderer;
 class Lightmap;
 
+inline int next_po2(int val)
+{
+  int result = 1;
+  while(result < val)
+    result *= 2;
+
+  return result;
+}
+
 /**
  * This class provides functions for drawing things on screen. It also
  * maintains a stack of transforms that are applied to graphics.
index 859d952..757d199 100644 (file)
@@ -32,16 +32,27 @@ class Surface;
 
 // some constants for predefined layer values
 enum {
+  // Image/gradient backgrounds (should cover entire screen)
   LAYER_BACKGROUND0 = -300,
+  // Particle backgrounds
   LAYER_BACKGROUND1 = -200,
+  // Tilemap backgrounds
   LAYER_BACKGROUNDTILES = -100,
+  // Solid tilemaps
   LAYER_TILES = 0,
+  // Ordinary objects
   LAYER_OBJECTS = 50,
+  // Objects that pass through walls
   LAYER_FLOATINGOBJECTS = 150,
+  // 
   LAYER_FOREGROUNDTILES = 200,
+  // 
   LAYER_FOREGROUND0 = 300,
+  // 
   LAYER_FOREGROUND1 = 400,
+  // Hitpoints, time, coins, etc.
   LAYER_HUD = 500,
+  // Menus, mouse, console etc.
   LAYER_GUI         = 600
 };
 
index 57b9730..30df72a 100644 (file)
@@ -33,6 +33,7 @@
 #include "video/drawing_request.hpp"
 #include "video/font.hpp"
 #include "video/gl/gl_surface_data.hpp"
+#include "video/gl/gl_renderer.hpp"
 #include "video/gl/gl_texture.hpp"
 #include "video/glutil.hpp"
 #include "video/lightmap.hpp"
 #include "video/surface.hpp"
 #include "video/texture_manager.hpp"
 
-namespace {
-
-inline void intern_draw(float left, float top, float right, float bottom,
-                        float uv_left, float uv_top,
-                        float uv_right, float uv_bottom,
-                        float angle, float alpha,
-                        const Color& color,
-                        const Blend& blend,
-                        DrawingEffect effect)
-{
-  if(effect & HORIZONTAL_FLIP)
-    std::swap(uv_left, uv_right);
-  if(effect & VERTICAL_FLIP) 
-    std::swap(uv_top, uv_bottom);
-
-  // unrotated blit
-  glBlendFunc(blend.sfactor, blend.dfactor);
-  glColor4f(color.red, color.green, color.blue, color.alpha * alpha);
-  if (angle == 0.0f) {
-    float vertices[] = {
-      left, top,
-      right, top,
-      right, bottom,
-      left, bottom,
-    };
-    glVertexPointer(2, GL_FLOAT, 0, vertices);
-
-    float uvs[] = {
-      uv_left, uv_top,
-      uv_right, uv_top,
-      uv_right, uv_bottom,
-      uv_left, uv_bottom,
-    };
-    glTexCoordPointer(2, GL_FLOAT, 0, uvs);
-
-    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-  } else {
-    // rotated blit
-    float center_x = (left + right) / 2;
-    float center_y = (top + bottom) / 2;
-
-    float sa = sinf(angle/180.0f*M_PI);
-    float ca = cosf(angle/180.0f*M_PI);
-
-    left  -= center_x;
-    right -= center_x;
-
-    top    -= center_y;
-    bottom -= center_y;
-
-    float vertices[] = {
-      left*ca - top*sa + center_x, left*sa + top*ca + center_y,
-      right*ca - top*sa + center_x, right*sa + top*ca + center_y,
-      right*ca - bottom*sa + center_x, right*sa + bottom*ca + center_y,
-      left*ca - bottom*sa + center_x, left*sa + bottom*ca + center_y
-    };
-    glVertexPointer(2, GL_FLOAT, 0, vertices);
-
-    float uvs[] = {
-      uv_left, uv_top,
-      uv_right, uv_top,
-      uv_right, uv_bottom,
-      uv_left, uv_bottom,
-    };
-    glTexCoordPointer(2, GL_FLOAT, 0, uvs);
-
-    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-  }
-
-  // FIXME: find a better way to restore the blend mode
-  glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
-  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-}
-
-static inline int next_po2(int val)
-{
-  int result = 1;
-  while(result < val)
-    result *= 2;
-
-  return result;
-}
-
-} // namespace
-
 GLLightmap::GLLightmap() :
   screen(),
   lightmap(),
index b271848..81d8743 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <iomanip>
 #include <iostream>
-#include <math.h>
 #include <physfs.h>
 
 #include "supertux/gameconfig.hpp"
 #  define glOrtho glOrthof
 #endif
 
-namespace {
-
-inline void intern_draw(float left, float top, float right, float bottom,
-                        float uv_left, float uv_top,
-                        float uv_right, float uv_bottom,
-                        float angle, float alpha,
-                        const Color& color,
-                        const Blend& blend,
-                        DrawingEffect effect)
-{
-  if(effect & HORIZONTAL_FLIP)
-    std::swap(uv_left, uv_right);
-  if(effect & VERTICAL_FLIP) 
-    std::swap(uv_top, uv_bottom);
-
-  glBlendFunc(blend.sfactor, blend.dfactor);
-  glColor4f(color.red, color.green, color.blue, color.alpha * alpha);
-  // unrotated blit
-  if (angle == 0.0f) {
-    float vertices[] = {
-      left, top,
-      right, top,
-      right, bottom,
-      left, bottom,
-    };
-    glVertexPointer(2, GL_FLOAT, 0, vertices);
-
-    float uvs[] = {
-      uv_left, uv_top,
-      uv_right, uv_top,
-      uv_right, uv_bottom,
-      uv_left, uv_bottom,
-    };
-    glTexCoordPointer(2, GL_FLOAT, 0, uvs);
-
-    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-  } else {
-    // rotated blit
-    float center_x = (left + right) / 2;
-    float center_y = (top + bottom) / 2;
-
-    float sa = sinf(angle/180.0f*M_PI);
-    float ca = cosf(angle/180.0f*M_PI);
-
-    left  -= center_x;
-    right -= center_x;
-
-    top    -= center_y;
-    bottom -= center_y;
-
-    float vertices[] = {
-      left*ca - top*sa + center_x, left*sa + top*ca + center_y,
-      right*ca - top*sa + center_x, right*sa + top*ca + center_y,
-      right*ca - bottom*sa + center_x, right*sa + bottom*ca + center_y,
-      left*ca - bottom*sa + center_x, left*sa + bottom*ca + center_y
-    };
-    glVertexPointer(2, GL_FLOAT, 0, vertices);
-
-    float uvs[] = {
-      uv_left, uv_top,
-      uv_right, uv_top,
-      uv_right, uv_bottom,
-      uv_left, uv_bottom,
-    };
-    glTexCoordPointer(2, GL_FLOAT, 0, uvs);
-
-    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-  }
-
-  // FIXME: find a better way to restore the blend mode
-  glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
-  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-}
-
-} // namespace
-
 GLRenderer::GLRenderer() :
   desktop_size(-1, -1),
   screen_size(-1, -1),
index a11ddfb..9e20859 100644 (file)
 #define HEADER_SUPERTUX_VIDEO_GL_RENDERER_HPP
 
 #include "math/size.hpp"
+#include "video/drawing_request.hpp"
 #include "video/renderer.hpp"
 
+#include <math.h>
+
+namespace {
+
+inline void intern_draw(float left, float top, float right, float bottom,
+                        float uv_left, float uv_top,
+                        float uv_right, float uv_bottom,
+                        float angle, float alpha,
+                        const Color& color,
+                        const Blend& blend,
+                        DrawingEffect effect)
+{
+  if(effect & HORIZONTAL_FLIP)
+    std::swap(uv_left, uv_right);
+  if(effect & VERTICAL_FLIP) 
+    std::swap(uv_top, uv_bottom);
+
+  glBlendFunc(blend.sfactor, blend.dfactor);
+  glColor4f(color.red, color.green, color.blue, color.alpha * alpha);
+  // unrotated blit
+  if (angle == 0.0f) {
+    float vertices[] = {
+      left, top,
+      right, top,
+      right, bottom,
+      left, bottom,
+    };
+    glVertexPointer(2, GL_FLOAT, 0, vertices);
+
+    float uvs[] = {
+      uv_left, uv_top,
+      uv_right, uv_top,
+      uv_right, uv_bottom,
+      uv_left, uv_bottom,
+    };
+    glTexCoordPointer(2, GL_FLOAT, 0, uvs);
+
+    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+  } else {
+    // rotated blit
+    float center_x = (left + right) / 2;
+    float center_y = (top + bottom) / 2;
+
+    float sa = sinf(angle/180.0f*M_PI);
+    float ca = cosf(angle/180.0f*M_PI);
+
+    left  -= center_x;
+    right -= center_x;
+
+    top    -= center_y;
+    bottom -= center_y;
+
+    float vertices[] = {
+      left*ca - top*sa + center_x, left*sa + top*ca + center_y,
+      right*ca - top*sa + center_x, right*sa + top*ca + center_y,
+      right*ca - bottom*sa + center_x, right*sa + bottom*ca + center_y,
+      left*ca - bottom*sa + center_x, left*sa + bottom*ca + center_y
+    };
+    glVertexPointer(2, GL_FLOAT, 0, vertices);
+
+    float uvs[] = {
+      uv_left, uv_top,
+      uv_right, uv_top,
+      uv_right, uv_bottom,
+      uv_left, uv_bottom,
+    };
+    glTexCoordPointer(2, GL_FLOAT, 0, uvs);
+
+    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+  }
+
+  // FIXME: find a better way to restore the blend mode
+  glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+}
+
+} // namespace
+
+
+
 class GLRenderer : public Renderer
 {
 private:
index 05004ed..372196d 100644 (file)
@@ -186,11 +186,11 @@ WorldMap::add_object(GameObject* object)
 void
 WorldMap::try_expose(GameObject* object)
 {
-  ScriptInterface* interface = dynamic_cast<ScriptInterface*> (object);
-  if(interface != NULL) {
+  ScriptInterface* object_ = dynamic_cast<ScriptInterface*> (object);
+  if(object_ != NULL) {
     HSQUIRRELVM vm = scripting::global_vm;
     sq_pushobject(vm, worldmap_table);
-    interface->expose(vm, -1);
+    object_->expose(vm, -1);
     sq_pop(vm, 1);
   }
 }
@@ -198,13 +198,13 @@ WorldMap::try_expose(GameObject* object)
 void
 WorldMap::try_unexpose(GameObject* object)
 {
-  ScriptInterface* interface = dynamic_cast<ScriptInterface*> (object);
-  if(interface != NULL) {
+  ScriptInterface* object_ = dynamic_cast<ScriptInterface*> (object);
+  if(object_ != NULL) {
     HSQUIRRELVM vm = scripting::global_vm;
     SQInteger oldtop = sq_gettop(vm);
     sq_pushobject(vm, worldmap_table);
     try {
-      interface->unexpose(vm, -1);
+      object_->unexpose(vm, -1);
     } catch(std::exception& e) {
       log_warning << "Couldn't unregister object: " << e.what() << std::endl;
     }