super-tux-commit Mailing List for Super Tux (Page 14)
Brought to you by:
wkendrick
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(94) |
Apr
(500) |
May
(531) |
Jun
(196) |
Jul
(224) |
Aug
(193) |
Sep
(117) |
Oct
(115) |
Nov
(319) |
Dec
(97) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(19) |
Feb
|
Mar
(105) |
Apr
(41) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
2007 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
(7) |
Oct
(12) |
Nov
(26) |
Dec
(39) |
2009 |
Jan
(6) |
Feb
(15) |
Mar
(10) |
Apr
(25) |
May
(29) |
Jun
(21) |
Jul
(26) |
Aug
(8) |
Sep
(3) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
(5) |
Feb
(5) |
Mar
(2) |
Apr
|
May
(5) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(2) |
Oct
(2) |
Nov
|
Dec
|
From: Matze B. <mat...@us...> - 2004-11-28 14:57:36
|
Update of /cvsroot/super-tux/supertux/data/levels/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13367/data/levels/test Modified Files: bonusblock.stl foresttheme.stl noloktest.stl sectors.stl simple.stl Log Message: move over rewritten lispreader from tuxkart (with additional fixes), generalized TileManager and Tile classes and use them for the worldmap too Index: noloktest.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/noloktest.stl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- noloktest.stl 25 Nov 2004 18:06:08 -0000 1.5 +++ noloktest.stl 28 Nov 2004 14:56:47 -0000 1.6 @@ -11,7 +11,7 @@ (background (image "forest1.jpg") (speed 0.5)) (music "Mortimers_chipdisko.mod") - (spawn-points (name "main") (x 100) (y 100)) + (spawnpoint (name "main") (x 100) (y 100)) (nolok_01 (x 650) (y 512)) (tilemap (layer "background") @@ -48,7 +48,7 @@ (music "Mortimers_chipdisko.mod") (background (image "forest1.jpg") (speed 0.5)) - (spawn-points (name "main2") (x 100) (y 100)) + (spawnpoint (name "main2") (x 100) (y 100)) (secretarea (x 100) (y 100) (message "You found a secret area!")) (dispenser (x 700) (y 500) (badguy "snowball") (cycle 2)) (tilemap Index: bonusblock.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/bonusblock.stl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- bonusblock.stl 25 Nov 2004 18:06:08 -0000 1.11 +++ bonusblock.stl 28 Nov 2004 14:56:46 -0000 1.12 @@ -9,7 +9,7 @@ (gravity 10.000000) (background (image "arctis.jpg") (speed 0.5)) - (spawn-points + (spawnpoint (name "main") (x 100) (y 170) Index: foresttheme.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/foresttheme.stl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- foresttheme.stl 25 Nov 2004 18:06:08 -0000 1.1 +++ foresttheme.stl 28 Nov 2004 14:56:46 -0000 1.2 @@ -9,12 +9,12 @@ (name "main") (gravity 10) (music "forest2.mod") - (spawn-points + (spawnpoint (name "main") (x 100) (y 100) ) - (spawn-points + (spawnpoint (name "main") (x 6381) (y 201) Index: simple.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/simple.stl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- simple.stl 27 Nov 2004 14:14:29 -0000 1.2 +++ simple.stl 28 Nov 2004 14:56:47 -0000 1.3 @@ -12,7 +12,7 @@ (gravity 10.000000) (background (image "arctis.jpg") (speed 0.5)) - (spawn-points (name "main") (x 50) (y 200)) + (spawnpoint (name "main") (x 50) (y 200)) (tilemap (layer "background") (solid #f) Index: sectors.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/sectors.stl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- sectors.stl 25 Nov 2004 18:06:08 -0000 1.1 +++ sectors.stl 28 Nov 2004 14:56:47 -0000 1.2 @@ -10,7 +10,7 @@ (camera (mode "normal") ) - (spawn-points + (spawnpoint (name "main") (x 100) (y 170) @@ -90,7 +90,7 @@ (sector "main") (spawnpoint "main") ) - (spawn-points + (spawnpoint (name "main") (x 300) (y 170) |
From: Matze B. <mat...@us...> - 2004-11-28 14:57:36
|
Update of /cvsroot/super-tux/supertux/lib/audio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13367/lib/audio Modified Files: sound_manager.cpp Log Message: move over rewritten lispreader from tuxkart (with additional fixes), generalized TileManager and Tile classes and use them for the worldmap too Index: sound_manager.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/audio/sound_manager.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- sound_manager.cpp 24 Nov 2004 14:10:20 -0000 1.6 +++ sound_manager.cpp 28 Nov 2004 14:56:47 -0000 1.7 @@ -33,7 +33,8 @@ SoundManager* SoundManager::instance_ = 0; SoundManager::SoundManager() - : current_music(0), m_music_enabled(true) , m_sound_enabled(true) , audio_device(true) + : current_music(0), m_music_enabled(true) , m_sound_enabled(true), + audio_device(true) { } @@ -42,8 +43,7 @@ if(audio_device) Mix_HaltMusic(); -sounds.clear(); -destroy_instance(); + sounds.clear(); } void @@ -184,7 +184,8 @@ if(m_music_enabled == false) { Mix_HaltMusic(); } else { - Mix_PlayMusic(current_music->music, -1); + if(current_music) + Mix_PlayMusic(current_music->music, -1); } } |
From: Matze B. <mat...@us...> - 2004-11-28 14:57:31
|
Update of /cvsroot/super-tux/supertux/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13367/lib Modified Files: Jamfile Log Message: move over rewritten lispreader from tuxkart (with additional fixes), generalized TileManager and Tile classes and use them for the worldmap too Index: Jamfile =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/Jamfile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Jamfile 27 Nov 2004 14:42:37 -0000 1.2 +++ Jamfile 28 Nov 2004 14:56:47 -0000 1.3 @@ -8,6 +8,7 @@ [ Wildcard special : *.cpp *.h ] [ Wildcard utils : *.cpp *.h ] [ Wildcard video : *.cpp *.h ] + [ Wildcard lisp : *.cpp *.h ] ; TRANSLATABLE_SOURCE += [ DoSourceGrist $(sources) ] ; |
From: Matze B. <mat...@us...> - 2004-11-28 14:57:27
|
Update of /cvsroot/super-tux/supertux/lib/lisp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13624/lisp Log Message: Directory /cvsroot/super-tux/supertux/lib/lisp added to the repository |
Update of /cvsroot/super-tux/supertux/src/badguy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13367/src/badguy Modified Files: badguy.h bomb.cpp bomb.h bouncing_snowball.cpp bouncing_snowball.h dispenser.cpp dispenser.h flame.cpp flame.h jumpy.cpp jumpy.h mrbomb.cpp mrbomb.h mriceblock.cpp mriceblock.h nolok_01.cpp nolok_01.h snowball.cpp snowball.h spike.cpp spike.h spiky.cpp spiky.h Log Message: move over rewritten lispreader from tuxkart (with additional fixes), generalized TileManager and Tile classes and use them for the worldmap too Index: snowball.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/snowball.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- snowball.h 25 Nov 2004 16:22:05 -0000 1.3 +++ snowball.h 28 Nov 2004 14:56:51 -0000 1.4 @@ -6,11 +6,11 @@ class SnowBall : public BadGuy { public: - SnowBall(LispReader& reader); + SnowBall(const lisp::Lisp& reader); SnowBall(float pos_x, float pos_y, Direction d); void activate(); - void write(LispWriter& writer); + void write(lisp::Writer& writer); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); protected: Index: spiky.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/spiky.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- spiky.h 20 Nov 2004 22:14:40 -0000 1.1 +++ spiky.h 28 Nov 2004 14:56:51 -0000 1.2 @@ -6,10 +6,10 @@ class Spiky : public BadGuy { public: - Spiky(LispReader& reader); + Spiky(const lisp::Lisp& reader); void activate(); - void write(LispWriter& writer); + void write(lisp::Writer& writer); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); }; Index: mriceblock.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/mriceblock.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- mriceblock.cpp 25 Nov 2004 16:22:05 -0000 1.4 +++ mriceblock.cpp 28 Nov 2004 14:56:51 -0000 1.5 @@ -6,11 +6,11 @@ static const float KICKSPEED = 500; static const int MAXSQUISHES = 10; -MrIceBlock::MrIceBlock(LispReader& reader) +MrIceBlock::MrIceBlock(const lisp::Lisp& reader) : ice_state(ICESTATE_NORMAL), squishcount(0) { - reader.read_float("x", start_position.x); - reader.read_float("y", start_position.y); + reader.get("x", start_position.x); + reader.get("y", start_position.y); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("mriceblock"); set_direction = false; @@ -28,7 +28,7 @@ } void -MrIceBlock::write(LispWriter& writer) +MrIceBlock::write(lisp::Writer& writer) { writer.start_list("mriceblock"); Index: spike.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/spike.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- spike.h 25 Nov 2004 00:49:34 -0000 1.1 +++ spike.h 28 Nov 2004 14:56:51 -0000 1.2 @@ -10,10 +10,10 @@ NORTH=0, SOUTH, WEST, EAST }; Spike(const Vector& pos, Direction dir); - Spike(LispReader& reader); + Spike(const lisp::Lisp& reader); void active_action(float elapsed_time); - void write(LispWriter& writer); + void write(lisp::Writer& writer); void kill_fall(); private: void set_direction(Direction dir); Index: spike.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/spike.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- spike.cpp 25 Nov 2004 00:49:34 -0000 1.1 +++ spike.cpp 28 Nov 2004 14:56:51 -0000 1.2 @@ -9,14 +9,14 @@ set_direction(dir); } -Spike::Spike(LispReader& reader) +Spike::Spike(const lisp::Lisp& reader) { sprite = sprite_manager->create("spike"); - reader.read_float("x", start_position.x); - reader.read_float("y", start_position.y); + reader.get("x", start_position.x); + reader.get("y", start_position.y); bbox.set_size(32, 32); int idir = 0; - reader.read_int("direction", idir); + reader.get("direction", idir); set_direction((Direction) idir); } @@ -43,7 +43,7 @@ } void -Spike::write(LispWriter& writer) +Spike::write(lisp::Writer& writer) { writer.start_list("spike"); writer.write_float("x", start_position.x); Index: jumpy.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/jumpy.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- jumpy.h 20 Nov 2004 22:14:39 -0000 1.1 +++ jumpy.h 28 Nov 2004 14:56:51 -0000 1.2 @@ -2,19 +2,16 @@ #define __JUMPY_H__ #include "badguy.h" -#include "utils/lispreader.h" -#include "utils/lispwriter.h" -#include "serializable.h" class Jumpy : public BadGuy { public: - Jumpy(LispReader& reader); + Jumpy(const lisp::Lisp& reader); virtual HitResponse collision_solid(GameObject& other, const CollisionHit& hit); - virtual void write(LispWriter& writer); + virtual void write(lisp::Writer& writer); }; #endif Index: bouncing_snowball.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/bouncing_snowball.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- bouncing_snowball.cpp 25 Nov 2004 11:16:03 -0000 1.5 +++ bouncing_snowball.cpp 28 Nov 2004 14:56:50 -0000 1.6 @@ -5,10 +5,10 @@ static const float JUMPSPEED = 450; static const float WALKSPEED = 80; -BouncingSnowball::BouncingSnowball(LispReader& reader) +BouncingSnowball::BouncingSnowball(const lisp::Lisp& reader) { - reader.read_float("x", start_position.x); - reader.read_float("y", start_position.y); + reader.get("x", start_position.x); + reader.get("y", start_position.y); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("bouncingsnowball"); set_direction = false; @@ -25,7 +25,7 @@ } void -BouncingSnowball::write(LispWriter& writer) +BouncingSnowball::write(lisp::Writer& writer) { writer.start_list("bouncingsnowball"); Index: mriceblock.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/mriceblock.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- mriceblock.h 25 Nov 2004 16:22:05 -0000 1.2 +++ mriceblock.h 28 Nov 2004 14:56:51 -0000 1.3 @@ -6,11 +6,11 @@ class MrIceBlock : public BadGuy { public: - MrIceBlock(LispReader& reader); + MrIceBlock(const lisp::Lisp& reader); MrIceBlock(float pos_x, float pos_y, Direction d); void activate(); - void write(LispWriter& writer); + void write(lisp::Writer& writer); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); void active_action(float elapsed_time); Index: nolok_01.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/nolok_01.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- nolok_01.h 25 Nov 2004 16:22:05 -0000 1.4 +++ nolok_01.h 28 Nov 2004 14:56:51 -0000 1.5 @@ -7,11 +7,11 @@ class Nolok_01 : public BadGuy { public: - Nolok_01(LispReader& reader); + Nolok_01(const lisp::Lisp& reader); Nolok_01(float pos_x, float pos_y); void activate(); - void write(LispWriter& writer); + void write(lisp::Writer& writer); void active_action(float elapsed_time); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); Index: dispenser.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/dispenser.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- dispenser.h 24 Nov 2004 18:19:51 -0000 1.3 +++ dispenser.h 28 Nov 2004 14:56:50 -0000 1.4 @@ -7,10 +7,10 @@ class Dispenser : public BadGuy { public: - Dispenser(LispReader& reader); + Dispenser(const lisp::Lisp& reader); void activate(); - void write(LispWriter& writer); + void write(lisp::Writer& writer); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); void active_action(float elapsed_time); Index: badguy.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/badguy.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- badguy.h 26 Nov 2004 14:45:41 -0000 1.3 +++ badguy.h 28 Nov 2004 14:56:50 -0000 1.4 @@ -11,8 +11,9 @@ #include "serializable.h" #include "resources.h" #include "sector.h" -#include "utils/lispwriter.h" -#include "utils/lispreader.h" +#include "lisp/parser.h" +#include "lisp/lisp.h" +#include "lisp/writer.h" #include "video/drawing_context.h" #include "special/sprite_manager.h" Index: snowball.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/snowball.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- snowball.cpp 25 Nov 2004 16:22:05 -0000 1.5 +++ snowball.cpp 28 Nov 2004 14:56:51 -0000 1.6 @@ -4,10 +4,10 @@ static const float WALKSPEED = 80; -SnowBall::SnowBall(LispReader& reader) +SnowBall::SnowBall(const lisp::Lisp& reader) { - reader.read_float("x", start_position.x); - reader.read_float("y", start_position.y); + reader.get("x", start_position.x); + reader.get("y", start_position.y); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("snowball"); set_direction = false; @@ -24,7 +24,7 @@ } void -SnowBall::write(LispWriter& writer) +SnowBall::write(lisp::Writer& writer) { writer.start_list("snowball"); Index: flame.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/flame.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- flame.h 20 Nov 2004 22:14:39 -0000 1.1 +++ flame.h 28 Nov 2004 14:56:51 -0000 1.2 @@ -6,9 +6,9 @@ class Flame : public BadGuy { public: - Flame(LispReader& reader); + Flame(const lisp::Lisp& reader); - void write(LispWriter& write); + void write(lisp::Writer& write); void active_action(float elapsed_time); void kill_fall(); Index: bomb.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/bomb.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- bomb.cpp 25 Nov 2004 00:49:34 -0000 1.3 +++ bomb.cpp 28 Nov 2004 14:56:50 -0000 1.4 @@ -18,7 +18,7 @@ } void -Bomb::write(LispWriter& ) +Bomb::write(lisp::Writer& ) { // bombs are only temporarily so don't write them out... } Index: flame.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/flame.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- flame.cpp 20 Nov 2004 22:14:39 -0000 1.1 +++ flame.cpp 28 Nov 2004 14:56:51 -0000 1.2 @@ -2,13 +2,13 @@ #include "flame.h" -Flame::Flame(LispReader& reader) +Flame::Flame(const lisp::Lisp& reader) : angle(0), radius(100), speed(2) { - reader.read_float("x", start_position.x); - reader.read_float("y", start_position.y); - reader.read_float("radius", radius); - reader.read_float("speed", speed); + reader.get("x", start_position.x); + reader.get("y", start_position.y); + reader.get("radius", radius); + reader.get("speed", speed); bbox.set_pos(Vector(start_position.x + cos(angle) * radius, start_position.y + sin(angle) * radius)); bbox.set_size(32, 32); @@ -16,7 +16,7 @@ } void -Flame::write(LispWriter& writer) +Flame::write(lisp::Writer& writer) { writer.start_list("flame"); Index: dispenser.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/dispenser.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- dispenser.cpp 25 Nov 2004 16:38:31 -0000 1.8 +++ dispenser.cpp 28 Nov 2004 14:56:50 -0000 1.9 @@ -6,20 +6,19 @@ #include "badguy/mrbomb.h" #include "badguy/mriceblock.h" - -Dispenser::Dispenser(LispReader& reader) +Dispenser::Dispenser(const lisp::Lisp& reader) { - reader.read_float("x", start_position.x); - reader.read_float("y", start_position.y); - reader.read_float("cycle", cycle); - reader.read_string("badguy", badguy); + reader.get("x", start_position.x); + reader.get("y", start_position.y); + reader.get("cycle", cycle); + reader.get("badguy", badguy); bbox.set_size(32, 32); sprite = sprite_manager->create("dispenser"); sprite->set_action("working"); } void -Dispenser::write(LispWriter& writer) +Dispenser::write(lisp::Writer& writer) { writer.start_list("dispenser"); Index: bomb.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/bomb.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- bomb.h 20 Nov 2004 22:14:39 -0000 1.1 +++ bomb.h 28 Nov 2004 14:56:50 -0000 1.2 @@ -8,7 +8,7 @@ public: Bomb(const Vector& pos, Direction dir); - void write(LispWriter& writer); + void write(lisp::Writer& writer); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); HitResponse collision_player(Player& player, const CollisionHit& hit); void active_action(float elapsed_time); Index: bouncing_snowball.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/bouncing_snowball.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- bouncing_snowball.h 25 Nov 2004 11:16:03 -0000 1.3 +++ bouncing_snowball.h 28 Nov 2004 14:56:50 -0000 1.4 @@ -6,11 +6,11 @@ class BouncingSnowball : public BadGuy { public: - BouncingSnowball(LispReader& reader); + BouncingSnowball(const lisp::Lisp& reader); BouncingSnowball(float pos_x, float pos_y, Direction d); void activate(); - void write(LispWriter& writer); + void write(lisp::Writer& writer); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); protected: Index: jumpy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/jumpy.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- jumpy.cpp 25 Nov 2004 00:49:34 -0000 1.3 +++ jumpy.cpp 28 Nov 2004 14:56:51 -0000 1.4 @@ -4,16 +4,16 @@ static const float JUMPSPEED=600; -Jumpy::Jumpy(LispReader& reader) +Jumpy::Jumpy(const lisp::Lisp& reader) { - reader.read_float("x", start_position.x); - reader.read_float("y", start_position.y); + reader.get("x", start_position.x); + reader.get("y", start_position.y); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("jumpy"); } void -Jumpy::write(LispWriter& writer) +Jumpy::write(lisp::Writer& writer) { writer.start_list("jumpy"); Index: spiky.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/spiky.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- spiky.cpp 25 Nov 2004 00:49:34 -0000 1.3 +++ spiky.cpp 28 Nov 2004 14:56:51 -0000 1.4 @@ -4,16 +4,16 @@ static const float WALKSPEED = 80; -Spiky::Spiky(LispReader& reader) +Spiky::Spiky(const lisp::Lisp& reader) { - reader.read_float("x", start_position.x); - reader.read_float("y", start_position.y); + reader.get("x", start_position.x); + reader.get("y", start_position.y); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("spiky"); } void -Spiky::write(LispWriter& writer) +Spiky::write(lisp::Writer& writer) { writer.start_list("spiky"); Index: mrbomb.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/mrbomb.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- mrbomb.cpp 25 Nov 2004 16:22:05 -0000 1.6 +++ mrbomb.cpp 28 Nov 2004 14:56:51 -0000 1.7 @@ -5,10 +5,10 @@ static const float WALKSPEED = 80; -MrBomb::MrBomb(LispReader& reader) +MrBomb::MrBomb(const lisp::Lisp& reader) { - reader.read_float("x", start_position.x); - reader.read_float("y", start_position.y); + reader.get("x", start_position.x); + reader.get("y", start_position.y); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("mrbomb"); set_direction = false; @@ -25,7 +25,7 @@ } void -MrBomb::write(LispWriter& writer) +MrBomb::write(lisp::Writer& writer) { writer.start_list("mrbomb"); Index: mrbomb.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/mrbomb.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- mrbomb.h 25 Nov 2004 16:22:05 -0000 1.3 +++ mrbomb.h 28 Nov 2004 14:56:51 -0000 1.4 @@ -6,11 +6,11 @@ class MrBomb : public BadGuy { public: - MrBomb(LispReader& reader); + MrBomb(const lisp::Lisp& reader); MrBomb(float pos_x, float pos_y, Direction d); void activate(); - void write(LispWriter& writer); + void write(lisp::Writer& writer); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); protected: Index: nolok_01.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/nolok_01.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- nolok_01.cpp 26 Nov 2004 17:08:53 -0000 1.6 +++ nolok_01.cpp 28 Nov 2004 14:56:51 -0000 1.7 @@ -12,10 +12,10 @@ //TODO: Create sprite, give multiple hitpoints, limit max number of snowballs // Stop actions when pause button is hit (probably a general problem of timers) -Nolok_01::Nolok_01(LispReader& reader) +Nolok_01::Nolok_01(const lisp::Lisp& reader) { - reader.read_float("x", start_position.x); - reader.read_float("y", start_position.y); + reader.get("x", start_position.x); + reader.get("y", start_position.y); bbox.set_size(31.8, 63.8); sprite = sprite_manager->create("dummyguy"); } @@ -29,7 +29,7 @@ } void -Nolok_01::write(LispWriter& writer) +Nolok_01::write(lisp::Writer& writer) { writer.start_list("nolok01"); |
From: Matze B. <mat...@us...> - 2004-11-28 14:57:06
|
Update of /cvsroot/super-tux/supertux/src/object In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13367/src/object Modified Files: background.cpp background.h camera.cpp camera.h gameobjs.cpp gameobjs.h particlesystem.cpp particlesystem.h platform.cpp platform.h tilemap.cpp tilemap.h Log Message: move over rewritten lispreader from tuxkart (with additional fixes), generalized TileManager and Tile classes and use them for the worldmap too Index: platform.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/platform.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- platform.cpp 23 Nov 2004 16:47:26 -0000 1.2 +++ platform.cpp 28 Nov 2004 14:56:51 -0000 1.3 @@ -5,14 +5,15 @@ #include "resources.h" #include "player.h" #include "special/sprite_manager.h" -#include "utils/lispreader.h" +#include "lisp/lisp.h" +#include "lisp/writer.h" -Platform::Platform(LispReader& reader) +Platform::Platform(const lisp::Lisp& reader) { sprite = sprite_manager->create("flying_platform"); movement = Vector(0, 1); - reader.read_float("x", bbox.p1.x); - reader.read_float("y", bbox.p1.y); + reader.get("x", bbox.p1.x); + reader.get("y", bbox.p1.y); bbox.set_size(sprite->get_width(), sprite->get_height()); flags |= FLAG_SOLID; Index: background.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/background.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- background.cpp 26 Nov 2004 14:45:41 -0000 1.1 +++ background.cpp 28 Nov 2004 14:56:51 -0000 1.2 @@ -23,25 +23,26 @@ #include "app/globals.h" #include "camera.h" #include "video/drawing_context.h" -#include "utils/lispwriter.h" +#include "lisp/lisp.h" +#include "lisp/writer.h" Background::Background() : type(INVALID), layer(LAYER_BACKGROUND0), image(0) { } -Background::Background(LispReader& reader) +Background::Background(const lisp::Lisp& reader) : type(INVALID), layer(LAYER_BACKGROUND0), image(0) { - reader.read_int("layer", layer); - if(reader.read_string("image", imagefile) - && reader.read_float("speed", speed)) { + reader.get("layer", layer); + if(reader.get("image", imagefile) + && reader.get("speed", speed)) { set_image(imagefile, speed); } std::vector <unsigned int> bkgd_top_color, bkgd_bottom_color; - if(reader.read_int_vector("top_color", bkgd_top_color) && - reader.read_int_vector("bottom_color", bkgd_bottom_color)) + if(reader.get_vector("top_color", bkgd_top_color) && + reader.get_vector("bottom_color", bkgd_bottom_color)) set_gradient(Color(bkgd_top_color), Color(bkgd_bottom_color)); } @@ -51,7 +52,7 @@ } void -Background::write(LispWriter& writer) +Background::write(lisp::Writer& writer) { if(type == INVALID) return; Index: particlesystem.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/particlesystem.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- particlesystem.cpp 26 Nov 2004 14:45:41 -0000 1.1 +++ particlesystem.cpp 28 Nov 2004 14:56:51 -0000 1.2 @@ -25,9 +25,10 @@ #include "particlesystem.h" #include "app/globals.h" -#include "utils/lispreader.h" -#include "utils/lispwriter.h" #include "video/drawing_context.h" +#include "lisp/parser.h" +#include "lisp/lisp.h" +#include "lisp/writer.h" ParticleSystem::ParticleSystem() { @@ -97,13 +98,13 @@ } void -SnowParticleSystem::parse(LispReader& reader) +SnowParticleSystem::parse(const lisp::Lisp& reader) { - reader.read_int("layer", layer); + reader.get("layer", layer); } void -SnowParticleSystem::write(LispWriter& writer) +SnowParticleSystem::write(lisp::Writer& writer) { writer.start_list("particles-snow"); writer.write_int("layer", layer); @@ -148,13 +149,13 @@ } void -CloudParticleSystem::parse(LispReader& reader) +CloudParticleSystem::parse(const lisp::Lisp& reader) { - reader.read_int("layer", layer); + reader.get("layer", layer); } void -CloudParticleSystem::write(LispWriter& writer) +CloudParticleSystem::write(lisp::Writer& writer) { writer.start_list("particles-clouds"); writer.write_int("layer", layer); Index: tilemap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/tilemap.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tilemap.cpp 26 Nov 2004 14:45:41 -0000 1.1 +++ tilemap.cpp 28 Nov 2004 14:56:52 -0000 1.2 @@ -28,29 +28,30 @@ #include "video/drawing_context.h" #include "level.h" #include "tile.h" +#include "resources.h" #include "tile_manager.h" #include "app/globals.h" -#include "utils/lispreader.h" -#include "utils/lispwriter.h" +#include "lisp/lisp.h" +#include "lisp/writer.h" TileMap::TileMap() : solid(false), speed(1), width(0), height(0), layer(LAYER_TILES), vertical_flip(false) { - tilemanager = TileManager::instance(); + tilemanager = tile_manager; if(solid) flags |= FLAG_SOLID; } -TileMap::TileMap(LispReader& reader) +TileMap::TileMap(const lisp::Lisp& reader) : solid(false), speed(1), width(0), height(0), layer(LAYER_TILES), vertical_flip(false) { - tilemanager = TileManager::instance(); + tilemanager = tile_manager; std::string layer_str; - if(reader.read_string("layer", layer_str)) { + if(reader.get("layer", layer_str)) { if(layer_str == "background") layer = LAYER_BACKGROUNDTILES; else if(layer_str == "interactive") @@ -61,8 +62,8 @@ std::cerr << "Unknown layer '" << layer_str << "' in tilemap.\n"; } - reader.read_bool("solid", solid); - reader.read_float("speed", speed); + reader.get("solid", solid); + reader.get("speed", speed); if(solid && speed != 1) { std::cout << "Speed of solid tilemap is not 1. fixing.\n"; @@ -71,22 +72,23 @@ if(solid) flags |= FLAG_SOLID; - if(!reader.read_int("width", width) || - !reader.read_int("height", height)) + if(!reader.get("width", width) || + !reader.get("height", height)) throw std::runtime_error("No width or height specified in tilemap."); - if(!reader.read_int_vector("tiles", tiles)) + if(!reader.get_vector("tiles", tiles)) throw std::runtime_error("No tiles in tilemap."); - if(int(tiles.size()) != width*height) + if(int(tiles.size()) != width*height) { throw std::runtime_error("wrong number of tiles in tilemap."); + } } TileMap::TileMap(int layer_, bool solid_, size_t width_, size_t height_) : solid(solid_), speed(1), width(0), height(0), layer(layer_), vertical_flip(false) { - tilemanager = TileManager::instance(); + tilemanager = tile_manager; resize(width_, height_); @@ -99,7 +101,7 @@ } void -TileMap::write(LispWriter& writer) +TileMap::write(lisp::Writer& writer) { writer.start_list("tilemap"); @@ -182,7 +184,8 @@ TileMap::set(int newwidth, int newheight, const std::vector<unsigned int>&newt, int newlayer, bool newsolid) { - assert(int(newt.size()) == newwidth * newheight); + if(int(newt.size()) != newwidth * newheight) + throw std::runtime_error("Wrong tilecount count."); width = newwidth; height = newheight; Index: background.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/background.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- background.h 26 Nov 2004 14:45:41 -0000 1.1 +++ background.h 28 Nov 2004 14:56:51 -0000 1.2 @@ -23,19 +23,22 @@ #include "video/surface.h" #include "video/drawing_context.h" #include "special/game_object.h" -#include "utils/lispreader.h" #include "serializable.h" class DisplayManager; +namespace lisp { +class Lisp; +} + class Background : public GameObject, public Serializable { public: Background(); - Background(LispReader& reader); + Background(const lisp::Lisp& reader); virtual ~Background(); - virtual void write(LispWriter& writer); + virtual void write(lisp::Writer& writer); void set_image(const std::string& name, float bkgd_speed); Index: gameobjs.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/gameobjs.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gameobjs.h 26 Nov 2004 14:45:41 -0000 1.1 +++ gameobjs.h 28 Nov 2004 14:56:51 -0000 1.2 @@ -18,7 +18,6 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. - #ifndef SUPERTUX_GAMEOBJS_H #define SUPERTUX_GAMEOBJS_H @@ -29,7 +28,6 @@ #include "special/game_object.h" #include "special/moving_object.h" #include "serializable.h" -#include "utils/lispwriter.h" /* Bounciness of distros: */ #define NO_BOUNCE 0 @@ -84,31 +82,6 @@ Timer2 timer; }; -#if 0 -extern Sprite *img_trampoline; - -class Trampoline : public MovingObject, public Serializable -{ -public: - Trampoline(LispReader& reader); - Trampoline(float x, float y); - - virtual void write(LispWriter& writer); - virtual void action(float frame_ratio); - virtual void draw(DrawingContext& context); - - virtual void collision(const MovingObject& other, int); - void collision(void *p_c_object, int c_object, CollisionType type); - - Physic physic; - enum { M_NORMAL, M_HELD } mode; - - private: - float power; - unsigned int frame; -}; -#endif - extern Sprite *img_smoke_cloud; class SmokeCloud : public GameObject Index: platform.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/platform.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- platform.h 20 Nov 2004 22:14:40 -0000 1.1 +++ platform.h 28 Nov 2004 14:56:51 -0000 1.2 @@ -12,7 +12,7 @@ class Platform : public SuperTux::MovingObject { public: - Platform(LispReader& reader); + Platform(const lisp::Lisp& reader); ~Platform(); virtual HitResponse collision(GameObject& other, const CollisionHit& hit); Index: tilemap.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/tilemap.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- tilemap.h 26 Nov 2004 14:45:41 -0000 1.1 +++ tilemap.h 28 Nov 2004 14:56:52 -0000 1.2 @@ -27,12 +27,12 @@ #include "serializable.h" #include "math/vector.h" -using namespace SuperTux; - -namespace SuperTux { -class LispReader; +namespace lisp { +class Lisp; } +using namespace SuperTux; + class Level; class TileManager; class Tile; @@ -44,11 +44,11 @@ { public: TileMap(); - TileMap(LispReader& reader); + TileMap(const lisp::Lisp& reader); TileMap(int layer_, bool solid_, size_t width_, size_t height_); virtual ~TileMap(); - virtual void write(LispWriter& writer); + virtual void write(lisp::Writer& writer); virtual void action(float elapsed_time); virtual void draw(DrawingContext& context); Index: camera.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/camera.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- camera.h 26 Nov 2004 14:45:41 -0000 1.1 +++ camera.h 28 Nov 2004 14:56:51 -0000 1.2 @@ -30,9 +30,8 @@ #include "serializable.h" using namespace SuperTux; - -namespace SuperTux { -class LispReader; +namespace lisp { +class Lisp; } class Sector; @@ -44,9 +43,9 @@ virtual ~Camera(); /// parse camera mode from lisp file - void parse(LispReader& reader); + void parse(const lisp::Lisp& reader); /// write camera mode to a lisp file - virtual void write(LispWriter& writer); + virtual void write(lisp::Writer& writer); /// reset camera postion virtual void reset(const Vector& tuxpos); Index: gameobjs.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/gameobjs.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gameobjs.cpp 26 Nov 2004 14:45:41 -0000 1.1 +++ gameobjs.cpp 28 Nov 2004 14:56:51 -0000 1.2 @@ -146,289 +146,6 @@ context.pop_transform(); } -/* Trampoline */ - -#if 0 -Sprite *img_trampoline; - -Trampoline::Trampoline(LispReader& reader) -{ - reader.read_float("x", base.x); - reader.read_float("y", base.y); - base.width = 32; - base.height = 32; - power = 7.5; - reader.read_float("power", power); - - frame = 0; - mode = M_NORMAL; - physic.reset(); -} - -Trampoline::Trampoline(float x, float y) -{ - base.x = x; - base.y = y; - base.width = 32; - base.height = 32; - power = 7.5; - - frame = 0; - mode = M_NORMAL; - physic.reset(); -} - -void -Trampoline::write(LispWriter& writer) -{ - writer.start_list("trampoline"); - - writer.write_float("x", base.x); - writer.write_float("y", base.y); - writer.write_float("power", power); - - writer.end_list("trampoline"); -} - -void -Trampoline::draw(DrawingContext& context) -{ - img_trampoline->set_frame(frame); - img_trampoline->draw(context, base, LAYER_OBJECTS); - frame = 0; -} - -void -Trampoline::action(float frame_ratio) -{ - // TODO: Remove if we're too far off the screen - - // Falling - if (mode != M_HELD) - { - if (issolid(base.x + base.width/2, base.y + base.height)) - { - base.y = int((base.y + base.height)/32) * 32 - base.height; - - physic.enable_gravity(false); - physic.set_velocity_y(0.0f); - - physic.set_velocity_x(0); - } - else - { - physic.enable_gravity(true); - } - } - else // Player is carrying us around - { - /* FIXME: The trampoline object shouldn't know about pplayer objects. */ - /* If we're holding the iceblock */ - Player& tux = *Sector::current()->player; - Direction dir = tux.dir; - - if(dir == RIGHT) - { - base.x = tux.base.x + 16; - base.y = tux.base.y + tux.base.height/1.5 - base.height; - } - else /* facing left */ - { - base.x = tux.base.x - 16; - base.y = tux.base.y + tux.base.height/1.5 - base.height; - } - - if(collision_object_map(base)) - { - base.x = tux.base.x; - base.y = tux.base.y + tux.base.height/1.5 - base.height; - } - } - - physic.apply(frame_ratio, base.x, base.y, Sector::current()->gravity); - collision_swept_object_map(&old_base, &base); -} - -void -Trampoline::collision(const MovingObject&, int) -{ - // comes later -} - -void -Trampoline::collision(void *p_c_object, int c_object, CollisionType type) -{ - Player* pplayer_c = NULL; - switch (c_object) - { - case CO_PLAYER: - pplayer_c = (Player*) p_c_object; - - if (type == COLLISION_NORMAL) - { - // Pick up if HELD (done in Player) - } - - else if (type == COLLISION_SQUISH) - { - int squish_amount = (32 - (int)pplayer_c->base.y % 32); - - if (squish_amount < 24) - frame = 3; - else if (squish_amount < 28) - frame = 2; - else if (squish_amount < 30) - frame = 1; - else - frame = 0; - - if (squish_amount < 20) { - pplayer_c->physic.set_velocity_y(power); - pplayer_c->fall_mode = Player::TRAMPOLINE_JUMP; - } - else if (pplayer_c->physic.get_velocity_y() < 0) - pplayer_c->physic.set_velocity_y(-squish_amount/32); - } - - break; - - default: - break; - - } -} -#endif - -/* Flying Platform */ - -#if 0 -Sprite *img_flying_platform; - -FlyingPlatform::FlyingPlatform(LispReader& reader) -{ - reader.read_int_vector("x", pos_x); - reader.read_int_vector("y", pos_y); - - velocity = 2.0; - reader.read_float("velocity", velocity); - - base.x = pos_x[0]; - base.y = pos_y[0]; - base.width = 96; - base.height = 40; - - point = 0; - move = false; - - float x = pos_x[point+1] - pos_x[point]; - float y = pos_y[point+1] - pos_y[point]; - vel_x = x*velocity / sqrt(x*x + y*y); - vel_y = -(velocity - vel_x); - - frame = 0; -} - -FlyingPlatform::FlyingPlatform(int x, int y) -{ -base.x = x; -base.y = y; -point = 0; -move = false; -} - -void -FlyingPlatform::write(LispWriter& writer) -{ - writer.start_list("flying-trampoline"); - - writer.write_int_vector("x", pos_x); - writer.write_int_vector("y", pos_y); - writer.write_float("velocity", velocity); - - writer.end_list("flying-trampoline"); -} - -void -FlyingPlatform::draw(DrawingContext& context) -{ - img_flying_platform->draw(context, base, LAYER_OBJECTS); -} - -void -FlyingPlatform::action(float frame_ratio) -{ - // TODO: Remove if we're too far off the screen - -if(!move) - return; - -if((unsigned)point+1 != pos_x.size()) - { - if(((pos_x[point+1] > pos_x[point] && base.x >= pos_x[point+1]) || - (pos_x[point+1] < pos_x[point] && base.x <= pos_x[point+1]) || - pos_x[point] == pos_x[point+1]) && - ((pos_y[point+1] > pos_y[point] && base.y >= pos_y[point+1]) || - (pos_y[point+1] < pos_y[point] && base.y <= pos_y[point+1]) || - pos_y[point] == pos_y[point+1])) - { - point++; - - float x = pos_x[point+1] - pos_x[point]; - float y = pos_y[point+1] - pos_y[point]; - vel_x = x*velocity / sqrt(x*x + y*y); - vel_y = -(velocity - vel_x); - } - } -else // last point - { - // point = 0; - // reverse vector - return; - } -/* -if(pos_x[point+1] > base.x) - base.x += velocity * frame_ratio; -else if(pos_x[point+1] < base.x) - base.x -= velocity * frame_ratio; - -if(pos_y[point+1] > base.y) - base.y += velocity * frame_ratio; -else if(pos_y[point+1] < base.y) - base.y -= velocity * frame_ratio; -*/ - -base.x += vel_x * frame_ratio; -base.y += vel_y * frame_ratio; -} - -void -FlyingPlatform::collision(const MovingObject&, int) -{ - // comes later -} - -void -FlyingPlatform::collision(void *p_c_object, int c_object, CollisionType type) -{ -(void) p_c_object; -(void) type; - -// Player* pplayer_c = NULL; - switch (c_object) - { - case CO_PLAYER: -// pplayer_c = (Player*) p_c_object; - move = true; - - break; - - default: - break; - - } -} -#endif - Sprite *img_smoke_cloud = 0; SmokeCloud::SmokeCloud(const Vector& pos) Index: camera.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/camera.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- camera.cpp 26 Nov 2004 14:45:41 -0000 1.1 +++ camera.cpp 28 Nov 2004 14:56:51 -0000 1.2 @@ -23,9 +23,10 @@ #include <sstream> #include <cmath> +#include "lisp/lisp.h" +#include "lisp/writer.h" +#include "lisp/list_iterator.h" #include "camera.h" -#include "utils/lispreader.h" -#include "utils/lispwriter.h" #include "player.h" #include "tilemap.h" #include "gameloop.h" @@ -52,43 +53,41 @@ } void -Camera::parse(LispReader& reader) +Camera::parse(const lisp::Lisp& reader) { std::string modename; - reader.read_string("mode", modename); + reader.get("mode", modename); if(modename == "normal") { mode = NORMAL; do_backscrolling = true; - reader.read_bool("backscrolling", do_backscrolling); + reader.get("backscrolling", do_backscrolling); } else if(modename == "autoscroll") { mode = AUTOSCROLL; - lisp_object_t* cur = 0; - reader.read_lisp("path", cur); - if(cur == 0) { + const lisp::Lisp* path_lisp = reader.get_lisp("path"); + if(!path_lisp) throw std::runtime_error("No path specified in autoscroll camera."); - } - float speed = 50; - while(!lisp_nil_p(cur)) { - if(strcmp(lisp_symbol(lisp_car(lisp_car(cur))), "point") != 0) { - std::cerr << "Warning: unknown token in camera path.\n"; + + lisp::ListIterator iter(path_lisp); + float speed = .5; + while(iter.next()) { + if(iter.item() != "point") { + std::cerr << "Warning: unknown token '" << iter.item() + << "' in camera path.\n"; continue; } - - LispReader reader(lisp_cdr(lisp_car(cur))); + const lisp::Lisp* point_lisp = iter.lisp(); ScrollPoint point; - if(!reader.read_float("x", point.position.x) || - !reader.read_float("y", point.position.y)) { + if(!point_lisp->get("x", point.position.x) || + !point_lisp->get("y", point.position.y)) { throw std::runtime_error("x and y missing in point of camerapath"); } - reader.read_float("speed", speed); + point_lisp->get("speed", speed); point.speed = speed; scrollpoints.push_back(point); - - cur = lisp_cdr(cur); } } else if(modename == "manual") { mode = MANUAL; @@ -100,7 +99,7 @@ } void -Camera::write(LispWriter& writer) +Camera::write(lisp::Writer& writer) { writer.start_list("camera"); Index: particlesystem.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/particlesystem.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- particlesystem.h 26 Nov 2004 14:45:41 -0000 1.1 +++ particlesystem.h 28 Nov 2004 14:56:51 -0000 1.2 @@ -28,8 +28,8 @@ using namespace SuperTux; -namespace SuperTux { -class LispReader; +namespace lisp { +class Lisp; } class DisplayManager; @@ -80,8 +80,8 @@ SnowParticleSystem(); virtual ~SnowParticleSystem(); - void parse(LispReader& reader); - void write(LispWriter& writer); + void parse(const lisp::Lisp& lisp); + void write(lisp::Writer& writer); virtual void action(float elapsed_time); @@ -104,8 +104,8 @@ CloudParticleSystem(); virtual ~CloudParticleSystem(); - void parse(LispReader& reader); - void write(LispWriter& writer); + void parse(const lisp::Lisp& lisp); + void write(lisp::Writer& writer); virtual void action(float elapsed_time); |
From: Matze B. <mat...@us...> - 2004-11-28 14:57:05
|
Update of /cvsroot/super-tux/supertux/src/trigger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13367/src/trigger Modified Files: door.cpp door.h secretarea_trigger.cpp secretarea_trigger.h sequence_trigger.cpp sequence_trigger.h Log Message: move over rewritten lispreader from tuxkart (with additional fixes), generalized TileManager and Tile classes and use them for the worldmap too Index: door.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/trigger/door.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- door.h 25 Nov 2004 11:16:03 -0000 1.2 +++ door.h 28 Nov 2004 14:56:52 -0000 1.3 @@ -30,11 +30,11 @@ class Door : public TriggerBase, public Serializable { public: - Door(LispReader& reader); + Door(const lisp::Lisp& reader); Door(int x, int y, std::string sector, std::string spawnpoint); virtual ~Door(); - virtual void write(LispWriter& writer); + virtual void write(lisp::Writer& writer); virtual void action(float elapsed_time); virtual void draw(DrawingContext& context); Index: door.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/trigger/door.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- door.cpp 26 Nov 2004 13:56:32 -0000 1.5 +++ door.cpp 28 Nov 2004 14:56:52 -0000 1.6 @@ -19,25 +19,25 @@ #include <config.h> #include "door.h" -#include "utils/lispreader.h" -#include "utils/lispwriter.h" #include "gameloop.h" #include "resources.h" #include "special/sprite.h" #include "special/sprite_manager.h" #include "video/drawing_context.h" #include "app/globals.h" +#include "lisp/lisp.h" +#include "lisp/writer.h" using namespace SuperTux; -Door::Door(LispReader& reader) +Door::Door(const lisp::Lisp& reader) { - reader.read_float("x", bbox.p1.x); - reader.read_float("y", bbox.p1.y); + reader.get("x", bbox.p1.x); + reader.get("y", bbox.p1.y); bbox.set_size(32, 64); - reader.read_string("sector", target_sector); - reader.read_string("spawnpoint", target_spawnpoint); + reader.get("sector", target_sector); + reader.get("spawnpoint", target_spawnpoint); sprite = sprite_manager->create("door"); } @@ -58,7 +58,7 @@ } void -Door::write(LispWriter& writer) +Door::write(lisp::Writer& writer) { writer.start_list("door"); Index: sequence_trigger.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/trigger/sequence_trigger.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sequence_trigger.h 23 Nov 2004 16:47:26 -0000 1.2 +++ sequence_trigger.h 28 Nov 2004 14:56:52 -0000 1.3 @@ -7,11 +7,11 @@ class SequenceTrigger : public TriggerBase, public Serializable { public: - SequenceTrigger(LispReader& reader); + SequenceTrigger(const lisp::Lisp& reader); SequenceTrigger(const Vector& pos, const std::string& sequence); ~SequenceTrigger(); - void write(LispWriter& writer); + void write(lisp::Writer& writer); void event(Player& player, EventType type); private: Index: secretarea_trigger.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/trigger/secretarea_trigger.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- secretarea_trigger.h 25 Nov 2004 16:22:05 -0000 1.5 +++ secretarea_trigger.h 28 Nov 2004 14:56:52 -0000 1.6 @@ -11,11 +11,11 @@ class SecretAreaTrigger : public TriggerBase, public Serializable { public: - SecretAreaTrigger(LispReader& reader); + SecretAreaTrigger(const lisp::Lisp& reader); SecretAreaTrigger(const Vector& pos); ~SecretAreaTrigger(); - void write(LispWriter& writer); + void write(lisp::Writer& writer); void event(Player& player, EventType type); void draw(DrawingContext& context); Index: secretarea_trigger.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/trigger/secretarea_trigger.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- secretarea_trigger.cpp 25 Nov 2004 16:22:05 -0000 1.5 +++ secretarea_trigger.cpp 28 Nov 2004 14:56:52 -0000 1.6 @@ -1,19 +1,20 @@ #include <config.h> #include "secretarea_trigger.h" -#include "utils/lispwriter.h" #include "gameloop.h" +#include "lisp/lisp.h" +#include "lisp/writer.h" #define MESSAGE_TIME 3.5 //TODO: Count numbers of triggered/total secret areas -SecretAreaTrigger::SecretAreaTrigger(LispReader& reader) +SecretAreaTrigger::SecretAreaTrigger(const lisp::Lisp& reader) { - reader.read_float("x", bbox.p1.x); - reader.read_float("y", bbox.p1.y); + reader.get("x", bbox.p1.x); + reader.get("y", bbox.p1.y); bbox.set_size(32, 32); - reader.read_string("message", message); + reader.get("message", message); message_displayed = false; } @@ -30,7 +31,7 @@ } void -SecretAreaTrigger::write(LispWriter& writer) +SecretAreaTrigger::write(lisp::Writer& writer) { writer.start_list("secretarea"); Index: sequence_trigger.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/trigger/sequence_trigger.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sequence_trigger.cpp 26 Nov 2004 17:16:14 -0000 1.3 +++ sequence_trigger.cpp 28 Nov 2004 14:56:52 -0000 1.4 @@ -1,13 +1,19 @@ #include <config.h> #include "sequence_trigger.h" -#include "utils/lispwriter.h" #include "gameloop.h" +#include "lisp/lisp.h" +#include "lisp/writer.h" -SequenceTrigger::SequenceTrigger(LispReader& reader) +SequenceTrigger::SequenceTrigger(const lisp::Lisp& reader) { - (void) reader; - // TODO + reader.get("x", bbox.p1.x); + reader.get("y", bbox.p1.y); + float w, h; + reader.get("width", w); + reader.get("height", h); + bbox.set_size(w, h); + reader.get("sequence", sequence_name); } SequenceTrigger::SequenceTrigger(const Vector& pos, const std::string& sequence) @@ -23,7 +29,7 @@ } void -SequenceTrigger::write(LispWriter& writer) +SequenceTrigger::write(lisp::Writer& writer) { writer.start_list("sequencetrigger"); |
From: Matze B. <mat...@us...> - 2004-11-28 12:23:25
|
Update of /cvsroot/super-tux/supertux/po In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6058 Removed Files: ChangeLog LINGUAS Makefile.in.in Makevars POTFILES.in Rules-quot boldquot.sed de.po en@boldquot.header en@quot.header es.po fr.po insert-header.sin it.po nl.po nn.po pt.po quot.sed remove-potcdate.sin supertux.pot Log Message: removed old po files --- it.po DELETED --- --- Rules-quot DELETED --- --- fr.po DELETED --- --- nl.po DELETED --- --- de.po DELETED --- --- nn.po DELETED --- --- quot.sed DELETED --- --- ChangeLog DELETED --- --- en@quot.header DELETED --- --- LINGUAS DELETED --- --- es.po DELETED --- --- pt.po DELETED --- --- POTFILES.in DELETED --- --- en@boldquot.header DELETED --- --- boldquot.sed DELETED --- --- Makefile.in.in DELETED --- --- remove-potcdate.sin DELETED --- --- supertux.pot DELETED --- --- Makevars DELETED --- --- insert-header.sin DELETED --- |
From: Ingo R. <gr...@us...> - 2004-11-28 04:56:21
|
Update of /cvsroot/super-tux/supertux/data/images/tilesets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27379 Modified Files: supertux.stgt Log Message: - readded paralax tiles, not so sure why they disappeared in the first place Index: supertux.stgt =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/tilesets/supertux.stgt,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- supertux.stgt 27 Nov 2004 14:14:29 -0000 1.63 +++ supertux.stgt 28 Nov 2004 04:55:42 -0000 1.64 @@ -1136,6 +1136,65 @@ ) (solid #t) ) + + (tile (id 149) + (images (region "snow-para-1.png" 0 0 32 32))) + (tile (id 150) + (images (region "snow-para-1.png" 32 0 32 32))) + (tile (id 151) + (images (region "snow-para-1.png" 64 0 32 32))) + + (tile (id 152) + (images (region "snow-para-1.png" 0 32 32 32))) + (tile (id 153) + (images (region "snow-para-1.png" 32 32 32 32))) + (tile (id 154) + (images (region "snow-para-1.png" 64 32 32 32))) + + (tile (id 155) + (images (region "snow-para-1.png" 0 64 32 32))) + (tile (id 156) + (images (region "snow-para-1.png" 32 64 32 32))) + (tile (id 157) + (images (region "snow-para-1.png" 64 64 32 32))) + + (tile (id 158) + (images (region "snow-para-1.png" 96 0 32 32))) + (tile (id 159) + (images (region "snow-para-1.png" 96 32 32 32))) + (tile (id 160) + (images (region "snow-para-1.png" 96 64 32 32))) + + + (tile (id 161) + (images (region "snow-para-2.png" 0 0 32 32))) + (tile (id 162) + (images (region "snow-para-2.png" 32 0 32 32))) + (tile (id 163) + (images (region "snow-para-2.png" 64 0 32 32))) + + (tile (id 164) + (images (region "snow-para-2.png" 0 32 32 32))) + (tile (id 165) + (images (region "snow-para-2.png" 32 32 32 32))) + (tile (id 166) + (images (region "snow-para-2.png" 64 32 32 32))) + + (tile (id 167) + (images (region "snow-para-2.png" 0 64 32 32))) + (tile (id 168) + (images (region "snow-para-2.png" 32 64 32 32))) + (tile (id 169) + (images (region "snow-para-2.png" 64 64 32 32))) + + (tile (id 170) + (images (region "snow-para-2.png" 96 0 32 32))) + (tile (id 171) + (images (region "snow-para-2.png" 96 32 32 32))) + (tile (id 172) + (images (region "snow-para-2.png" 96 64 32 32))) + + (tile (id 173) (images |
From: Matze B. <mat...@us...> - 2004-11-27 14:48:22
|
Update of /cvsroot/super-tux/supertux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14344 Modified Files: Jamfile configure.ac Log Message: only run xgettext when it is installed Index: configure.ac =================================================================== RCS file: /cvsroot/super-tux/supertux/configure.ac,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- configure.ac 25 Nov 2004 01:08:59 -0000 1.41 +++ configure.ac 27 Nov 2004 14:48:10 -0000 1.42 @@ -27,6 +27,8 @@ AC_PROG_CXX AC_PROG_INSTALL +AC_CHECK_PROGS(XGETTEXT, xgettext) + dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC Index: Jamfile =================================================================== RCS file: /cvsroot/super-tux/supertux/Jamfile,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Jamfile 27 Nov 2004 14:42:37 -0000 1.5 +++ Jamfile 27 Nov 2004 14:48:10 -0000 1.6 @@ -10,12 +10,15 @@ # add some additional files to package Package INSTALL NEWS README COPYING AUTHORS ChangeLog ; - -actions MakePot +if $(XGETTEXT) != "" { - xgettext --keyword='_:1' --c++ -o $(<) $(>) + + actions MakePot + { + $(XGETTEXT) --keyword='_:1' --c++ -o $(<) $(>) + } + MakePot supertux.pot : $(TRANSLATABLE_SOURCES) ; + Depends supertux.pot : $(TRANSLATABLE_SOURCES) ; + MakeLocate supertux.pot : data/locale ; + Depends all : supertux.pot ; } -MakePot supertux.pot : $(TRANSLATABLE_SOURCES) ; -Depends supertux.pot : $(TRANSLATABLE_SOURCES) ; -MakeLocate supertux.pot : data/locale ; -Depends all : supertux.pot ; |
From: Matze B. <mat...@us...> - 2004-11-27 14:42:49
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13444/src Modified Files: Jamfile Log Message: create rules for updating the supertux.pot file Index: Jamfile =================================================================== RCS file: /cvsroot/super-tux/supertux/src/Jamfile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Jamfile 23 Nov 2004 16:47:25 -0000 1.1 +++ Jamfile 27 Nov 2004 14:42:38 -0000 1.2 @@ -1,11 +1,14 @@ SubDir TOP src ; -Application supertux : +sources = [ Wildcard *.cpp *.h ] [ Wildcard object : *.cpp *.h ] [ Wildcard badguy : *.cpp *.h ] [ Wildcard trigger : *.cpp *.h ] ; +TRANSLATABLE_SOURCES += [ DoSourceGrist $(sources) ] ; + +Application supertux : $(sources) ; LinkWith supertux : supertuxlib ; ExternalLibs supertux : SDL SDLMIXER SDLIMAGE GL ; Help supertux : "Build the supertux executable" ; |
From: Matze B. <mat...@us...> - 2004-11-27 14:42:49
|
Update of /cvsroot/super-tux/supertux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13444 Modified Files: Jamfile Log Message: create rules for updating the supertux.pot file Index: Jamfile =================================================================== RCS file: /cvsroot/super-tux/supertux/Jamfile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Jamfile 25 Nov 2004 15:57:14 -0000 1.4 +++ Jamfile 27 Nov 2004 14:42:37 -0000 1.5 @@ -10,3 +10,12 @@ # add some additional files to package Package INSTALL NEWS README COPYING AUTHORS ChangeLog ; + +actions MakePot +{ + xgettext --keyword='_:1' --c++ -o $(<) $(>) +} +MakePot supertux.pot : $(TRANSLATABLE_SOURCES) ; +Depends supertux.pot : $(TRANSLATABLE_SOURCES) ; +MakeLocate supertux.pot : data/locale ; +Depends all : supertux.pot ; |
From: Matze B. <mat...@us...> - 2004-11-27 14:42:49
|
Update of /cvsroot/super-tux/supertux/src/object In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13444/src/object Modified Files: invisible_tile.cpp Log Message: create rules for updating the supertux.pot file Index: invisible_tile.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/invisible_tile.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- invisible_tile.cpp 27 Nov 2004 14:14:30 -0000 1.1 +++ invisible_tile.cpp 27 Nov 2004 14:42:38 -0000 1.2 @@ -13,7 +13,7 @@ } void -InvisibleTile::draw(DrawingContext& context) +InvisibleTile::draw(DrawingContext& ) { } |
From: Matze B. <mat...@us...> - 2004-11-27 14:42:49
|
Update of /cvsroot/super-tux/supertux/lib/special In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13444/lib/special Modified Files: moving_object.h Log Message: create rules for updating the supertux.pot file Index: moving_object.h =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/moving_object.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- moving_object.h 20 Nov 2004 22:14:36 -0000 1.4 +++ moving_object.h 27 Nov 2004 14:42:37 -0000 1.5 @@ -63,6 +63,7 @@ protected: friend class Sector; + friend class CollisionGrid; /** The bounding box of the object (as used for collision detection, this * isn't necessarily the bounding box for graphics) |
From: Matze B. <mat...@us...> - 2004-11-27 14:42:49
|
Update of /cvsroot/super-tux/supertux/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13444/lib Modified Files: Jamfile Log Message: create rules for updating the supertux.pot file Index: Jamfile =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/Jamfile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Jamfile 23 Nov 2004 16:47:23 -0000 1.1 +++ Jamfile 27 Nov 2004 14:42:37 -0000 1.2 @@ -1,6 +1,6 @@ SubDir TOP lib ; -Library supertuxlib : +sources = [ Wildcard app : *.cpp *.h ] [ Wildcard audio : *.cpp *.h ] [ Wildcard gui : *.cpp *.h ] @@ -9,6 +9,9 @@ [ Wildcard utils : *.cpp *.h ] [ Wildcard video : *.cpp *.h ] ; +TRANSLATABLE_SOURCE += [ DoSourceGrist $(sources) ] ; + +Library supertuxlib : $(sources) : noinstall ; ExternalLibs supertuxlib : SDL SDLMIXER SDLIMAGE GL ; C++Flags supertuxlib : -DDATA_PREFIX='\"$(appdatadir)\"' -DLOCALEDIR='\"$(datadir)/locale\"' : export ; Help supertuxlib : "Build supertux library" ; |
From: Marek M. <wa...@us...> - 2004-11-27 14:14:55
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7595/src Modified Files: sector.cpp Log Message: patch contributed by markos_64: -adds invisible tile (permanent, cannot be bumped) -add spiky to sector.cpp (which someone apparantly forgot to do) -fixed fireballs appearing behind tux added an invisible tile to simple.stl, for testing Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- sector.cpp 26 Nov 2004 17:16:14 -0000 1.53 +++ sector.cpp 27 Nov 2004 14:14:29 -0000 1.54 @@ -45,6 +45,7 @@ #include "object/coin.h" #include "object/block.h" #include "object/invisible_block.h" +#include "object/invisible_tile.h" #include "object/platform.h" #include "object/bullet.h" #include "badguy/jumpy.h" @@ -55,6 +56,7 @@ #include "badguy/mrbomb.h" #include "badguy/dispenser.h" #include "badguy/spike.h" +#include "badguy/spiky.h" #include "badguy/nolok_01.h" #include "trigger/door.h" #include "trigger/sequence_trigger.h" @@ -130,6 +132,8 @@ return new Dispenser(reader); } else if(name == "spike") { return new Spike(reader); + } else if(name == "spiky") { + return new Spiky(reader); } else if(name == "nolok_01") { return new Nolok_01(reader); } @@ -334,6 +338,9 @@ if(tile->getID() == 112) { add_object(new InvisibleBlock(pos)); solids->change(x, y, 0); + } else if(tile->getID() == 1311) { + add_object(new InvisibleTile(pos)); + solids->change(x, y, 0); } else if(tile->getID() == 295) { add_object(new Spike(pos, Spike::NORTH)); solids->change(x, y, 0); |
From: Marek M. <wa...@us...> - 2004-11-27 14:14:55
|
Update of /cvsroot/super-tux/supertux/src/object In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7595/src/object Modified Files: player.cpp Added Files: invisible_tile.cpp invisible_tile.h Log Message: patch contributed by markos_64: -adds invisible tile (permanent, cannot be bumped) -add spiky to sector.cpp (which someone apparantly forgot to do) -fixed fireballs appearing behind tux added an invisible tile to simple.stl, for testing Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/player.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- player.cpp 26 Nov 2004 14:45:41 -0000 1.1 +++ player.cpp 27 Nov 2004 14:14:30 -0000 1.2 @@ -661,7 +661,9 @@ /* Shoot! */ if (input.fire == DOWN && input.old_fire == UP && got_power != NONE_POWER) { if(Sector::current()->add_bullet( - get_pos() + Vector(0, bbox.get_height()/2), +// get_pos() + Vector(0, bbox.get_height()/2), + get_pos() + ((dir == LEFT)? Vector(0, bbox.get_height()/2) + : Vector(32, bbox.get_height()/2)), physic.get_velocity_x(), dir)) shooting_timer.start(SHOOTING_TIME); input.old_fire = DOWN; --- NEW FILE: invisible_tile.h --- #ifndef __INBUMPABLE_BLOCK_H__ #define __INBUMPABLE_BLOCK_H__ #include "block.h" class InvisibleTile : public Block { public: InvisibleTile(const Vector& pos); virtual void draw(DrawingContext& context); protected: virtual void hit(Player& player); private: bool visible; }; #endif --- NEW FILE: invisible_tile.cpp --- #include <config.h> #include "invisible_tile.h" #include "resources.h" #include "special/sprite.h" #include "special/sprite_manager.h" #include "video/drawing_context.h" InvisibleTile::InvisibleTile(const Vector& pos) : Block(pos, sprite_manager->create("invisibleblock")), visible(false) { flags |= FLAG_SOLID; } void InvisibleTile::draw(DrawingContext& context) { } void InvisibleTile::hit(Player& ) { } |
From: Marek M. <wa...@us...> - 2004-11-27 14:14:54
|
Update of /cvsroot/super-tux/supertux/data/levels/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7595/data/levels/test Modified Files: simple.stl Log Message: patch contributed by markos_64: -adds invisible tile (permanent, cannot be bumped) -add spiky to sector.cpp (which someone apparantly forgot to do) -fixed fireballs appearing behind tux added an invisible tile to simple.stl, for testing Index: simple.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/simple.stl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- simple.stl 25 Nov 2004 20:20:04 -0000 1.1 +++ simple.stl 27 Nov 2004 14:14:29 -0000 1.2 @@ -64,7 +64,7 @@ 61 0 0 0 0 0 1063 0 1064 0 1065 0 1066 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61 61 48 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61 - 61 48 48 48 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61 + 61 48 48 48 0 1311 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61 61 0 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 61 61 0 0 0 0 0 0 0 0 0 0 0 48 48 0 0 0 0 0 0 48 48 0 0 0 0 0 0 0 61 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 |
From: Marek M. <wa...@us...> - 2004-11-27 14:14:54
|
Update of /cvsroot/super-tux/supertux/data/images/tilesets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7595/data/images/tilesets Modified Files: supertux.stgt Log Message: patch contributed by markos_64: -adds invisible tile (permanent, cannot be bumped) -add spiky to sector.cpp (which someone apparantly forgot to do) -fixed fireballs appearing behind tux added an invisible tile to simple.stl, for testing Index: supertux.stgt =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/tilesets/supertux.stgt,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- supertux.stgt 25 Nov 2004 16:38:28 -0000 1.62 +++ supertux.stgt 27 Nov 2004 14:14:29 -0000 1.63 @@ -4528,4 +4528,9 @@ ) (solid #t) ) + (tile + (id 1311) + (solid #t) + (editor-images "bonus-invisible.png") + ) ) |
From: Matze B. <mat...@us...> - 2004-11-26 17:27:08
|
Update of /cvsroot/super-tux/supertux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv928 Modified Files: TODO Log Message: TODO update Index: TODO =================================================================== RCS file: /cvsroot/super-tux/supertux/TODO,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -r1.93 -r1.94 --- TODO 25 Nov 2004 16:43:39 -0000 1.93 +++ TODO 26 Nov 2004 17:26:58 -0000 1.94 @@ -75,7 +75,6 @@ ingame mode and eventually leveleditor mode [H] introduce a special mode in DrawingContext for objects that want to draw themselfes. This could speed up rendering of tilemaps. -[?] remove badguyspecs and bitmask files [M] Make the gamelogic run in a fixed logical framerate --Miscellaneous-- @@ -121,7 +120,6 @@ - New forest tileset - Badguy sprites - Tux's buttjump animation -[H] Tiles constructed with image-region are not drawn coordinates < 0 [M] Save score on per-level basis to make high-score [M] Save time on per-level basis to make low-time-score @@ -135,3 +133,5 @@ Beyond Milestone2 ----------------- - More things than just levels on the worldmap (similar to SMB3) +- if we have a logical framerate we could record/play demos by simply storing + the pressed keys in each frame... |
From: Matze B. <mat...@us...> - 2004-11-26 17:16:28
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31117/src Modified Files: gameloop.cpp gameloop.h level.cpp level.h leveleditor.cpp sector.cpp tile.cpp tile.h tile_manager.cpp tile_manager.h worldmap.cpp Log Message: lazily load tile images to speedup startup times Index: tile.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- tile.h 23 Nov 2004 02:00:51 -0000 1.34 +++ tile.h 26 Nov 2004 17:16:14 -0000 1.35 @@ -17,79 +17,91 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. - #ifndef TILE_H #define TILE_H #include <vector> -#include "SDL.h" #include "video/surface.h" +#include "utils/lispreader.h" +#include "math/rectangle.h" using namespace SuperTux; -namespace SuperTux { -class LispReader; -} - /** Tile Class */ class Tile { public: - Tile(); - ~Tile(); - - /// parses the tile and returns it's id number - void read(LispReader& reader); - + /// bitset for tile attributes + enum { + /** solid tile that is indestructable by Tux */ + SOLID = 0x0001, + /** uni-directional solid tile */ + UNISOLID = 0x0002, + /** a brick that can be destroyed by jumping under it */ + BRICK = 0x0004, + /** an ice brick that makes tux sliding more than usual */ + ICE = 0x0008, + /** a water tile in which tux starts to swim */ + WATER = 0x0010, + /** a tile that hurts the player if he touches it */ + SPIKE = 0x0020, + /** Bonusbox, content is stored in \a data */ + FULLBOX = 0x0040, + /** Tile is a coin */ + COIN = 0x0080, + /** the level should be finished when touching a goaltile. + * if data is 0 then the endsequence should be triggered, if data is 1 + * then we can finish the level instantly. + */ + GOAL = 0x0100, + /** slope tile */ + SLOPE = 0x0200 + }; + +private: unsigned int id; - std::vector<Surface*> images; - std::vector<Surface*> editor_images; - - /// bitset for tileflags - enum { - /** solid tile that is indestructable by Tux */ - SOLID = 0x0001, - /** uni-directional solid tile */ - UNISOLID = 0x0002, - /** a brick that can be destroyed by jumping under it */ - BRICK = 0x0004, - /** an ice brick that makes tux sliding more than usual */ - ICE = 0x0008, - /** a water tile in which tux starts to swim */ - WATER = 0x0010, - /** a tile that hurts the player if he touches it */ - SPIKE = 0x0020, - /** Bonusbox, content is stored in \a data */ - FULLBOX = 0x0040, - /** Tile is a coin */ - COIN = 0x0080, - /** the level should be finished when touching a goaltile. - * if data is 0 then the endsequence should be triggered, if data is 1 - * then we can finish the level instantly. - */ - GOAL = 0x0100, - /** slope tile */ - SLOPE = 0x0200 + struct ImageSpec { + ImageSpec(const std::string& newfile, const Rectangle& newrect) + : file(newfile), rect(newrect) + { } + + std::string file; + Rectangle rect; }; + std::vector<ImageSpec> imagespecs; + std::vector<Surface*> images; + std::string editor_imagefile; + Surface* editor_image; + /** tile attributes */ Uint32 attributes; /** General purpose data attached to a tile (content of a box, type of coin)*/ int data; - /** Id of the tile that is going to replace this tile once it has - been collected or jumped at */ - int next_tile; - float anim_fps; +public: + ~Tile(); + /** Draw a tile on the screen */ void draw(DrawingContext& context, const Vector& pos, int layer) const; + Surface* get_editor_image() const; + + unsigned int getID() const + { return id; } + + Uint32 getAttributes() const + { return attributes; } + + int getData() const + { return data; } + /// returns the width of the tile in pixels int getWidth() const { @@ -105,8 +117,16 @@ return 0; return images[0]->h; } + +protected: + friend class TileManager; + Tile(); + + void load_images(); + + /// parses the tile and returns it's id number + void parse(LispReader& reader); + void parse_images(lisp_object_t* cur); }; #endif - -/* EOF */ Index: tile_manager.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile_manager.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- tile_manager.cpp 26 Nov 2004 13:56:31 -0000 1.9 +++ tile_manager.cpp 26 Nov 2004 17:16:14 -0000 1.10 @@ -44,9 +44,6 @@ void TileManager::load_tileset(std::string filename) { - if(filename == current_tileset) - return; - // free old tiles for(Tiles::iterator i = tiles.begin(); i != tiles.end(); ++i) delete *i; @@ -71,7 +68,7 @@ LispReader reader(lisp_cdr(element)); Tile* tile = new Tile; - tile->read(reader); + tile->parse(reader); while(tile->id >= tiles.size()) { tiles.push_back(0); @@ -110,6 +107,5 @@ } lisp_free(root_obj); - current_tileset = filename; } Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- sector.cpp 26 Nov 2004 14:54:05 -0000 1.52 +++ sector.cpp 26 Nov 2004 17:16:14 -0000 1.53 @@ -331,31 +331,31 @@ const Tile* tile = solids->get_tile(x, y); Vector pos(x*32, y*32); - if(tile->id == 112) { + if(tile->getID() == 112) { add_object(new InvisibleBlock(pos)); solids->change(x, y, 0); - } else if(tile->id == 295) { + } else if(tile->getID() == 295) { add_object(new Spike(pos, Spike::NORTH)); solids->change(x, y, 0); - } else if(tile->id == 296) { + } else if(tile->getID() == 296) { add_object(new Spike(pos, Spike::EAST)); solids->change(x, y, 0); - } else if(tile->id == 297) { + } else if(tile->getID() == 297) { add_object(new Spike(pos, Spike::SOUTH)); solids->change(x, y, 0); - } else if(tile->id == 298) { + } else if(tile->getID() == 298) { add_object(new Spike(pos, Spike::WEST)); solids->change(x, y, 0); - } else if(tile->attributes & Tile::COIN) { + } else if(tile->getAttributes() & Tile::COIN) { add_object(new Coin(pos)); solids->change(x, y, 0); - } else if(tile->attributes & Tile::FULLBOX) { - add_object(new BonusBlock(pos, tile->data)); + } else if(tile->getAttributes() & Tile::FULLBOX) { + add_object(new BonusBlock(pos, tile->getData())); solids->change(x, y, 0); - } else if(tile->attributes & Tile::BRICK) { - add_object(new Brick(pos, tile->data)); + } else if(tile->getAttributes() & Tile::BRICK) { + add_object(new Brick(pos, tile->getData())); solids->change(x, y, 0); - } else if(tile->attributes & Tile::GOAL) { + } else if(tile->getAttributes() & Tile::GOAL) { add_object(new SequenceTrigger(pos, "endsequence")); solids->change(x, y, 0); } @@ -600,16 +600,16 @@ const Tile* tile = solids->get_tile(x, y); if(!tile) continue; - if(!(tile->attributes & Tile::SOLID)) + if(!(tile->getAttributes() & Tile::SOLID)) continue; - if((tile->attributes & Tile::UNISOLID) && object->movement.y < 0) + if((tile->getAttributes() & Tile::UNISOLID) && object->movement.y < 0) continue; - if(tile->attributes & Tile::SLOPE) { // slope tile + if(tile->getAttributes() & Tile::SLOPE) { // slope tile AATriangle triangle; Vector p1(x*32, y*32); Vector p2((x+1)*32, (y+1)*32); - triangle = AATriangle(p1, p2, tile->data); + triangle = AATriangle(p1, p2, tile->getData()); if(Collision::rectangle_aatriangle(temphit, dest, object->movement, triangle)) { Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.134 retrieving revision 1.135 diff -u -d -r1.134 -r1.135 --- worldmap.cpp 25 Nov 2004 19:48:36 -0000 1.134 +++ worldmap.cpp 26 Nov 2004 17:16:14 -0000 1.135 @@ -865,8 +865,7 @@ + offset.y)), 500); GameSession session( get_resource_filename(std::string("levels/" + level->name)), - ST_GL_LOAD_LEVEL_FILE, level->vertical_flip, - &level->statistics); + ST_GL_LOAD_LEVEL_FILE, &level->statistics); switch (session.run()) { Index: tile_manager.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile_manager.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- tile_manager.h 26 Nov 2004 13:56:31 -0000 1.7 +++ tile_manager.h 26 Nov 2004 17:16:14 -0000 1.8 @@ -27,8 +27,7 @@ #include <map> #include <stdint.h> #include <assert.h> - -class Tile; +#include "tile.h" struct TileGroup { @@ -43,7 +42,7 @@ class TileManager { - private: +private: TileManager(); ~TileManager(); @@ -54,9 +53,7 @@ std::set<TileGroup> tilegroups; void load_tileset(std::string filename); - std::string current_tileset; - - public: +public: static TileManager* instance() { return instance_ ? instance_ : instance_ = new TileManager(); } static void destroy_instance() @@ -70,16 +67,16 @@ const Tile* get(uint32_t id) const { assert(id < tiles.size()); - Tile* t = tiles[id]; - if (t) - { - return t; - } - else - { - std::cout << "TileManager: Invalid tile: " << id << std::endl; - return tiles[0]; - } + Tile* tile = tiles[id]; + if(!tile) { + std::cout << "TileManager: Invalid tile: " << id << std::endl; + return tiles[0]; + } + + if(tile->images.size() == 0 && tile->imagespecs.size() != 0) + tile->load_images(); + + return tile; } uint32_t get_max_tileid() const Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.205 retrieving revision 1.206 diff -u -d -r1.205 -r1.206 --- gameloop.cpp 26 Nov 2004 14:54:05 -0000 1.205 +++ gameloop.cpp 26 Nov 2004 17:16:12 -0000 1.206 @@ -80,10 +80,10 @@ } GameSession::GameSession(const std::string& levelfile_, int mode, - bool flip_level_, Statistics* statistics) + Statistics* statistics) : level(0), currentsector(0), st_gl_mode(mode), end_sequence(NO_ENDSEQUENCE), levelfile(levelfile_), - flip_level(flip_level_), best_level_statistics(statistics) + best_level_statistics(statistics) { current_ = this; @@ -92,9 +92,6 @@ context = new DrawingContext(); - if(flip_levels_mode) - flip_level = true; - last_swap_point = Vector(-1, -1); last_swap_stats.reset(); @@ -124,8 +121,6 @@ level = new Level; level->load(levelfile); - if(flip_level) - level->do_vertical_flip(); global_stats.reset(); global_stats.set_total_points(COINS_COLLECTED_STAT, level->get_total_coins()); @@ -209,11 +204,6 @@ Vector(screen->w/2, 350), CENTER_ALLIGN, LAYER_FOREGROUND1); - if(flip_level) - context.draw_text(white_text, - _("Level Vertically Flipped!"), - Vector(screen->w/2, 310), CENTER_ALLIGN, LAYER_FOREGROUND1); - if(best_level_statistics != NULL) best_level_statistics->draw_message_info(context, _("Best Level Statistics")); Index: level.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.h,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -r1.69 -r1.70 --- level.h 26 Nov 2004 14:45:32 -0000 1.69 +++ level.h 26 Nov 2004 17:16:13 -0000 1.70 @@ -64,9 +64,6 @@ const std::string& get_author() const { return author; } - /** Flips the level vertically */ - void do_vertical_flip(); - void add_sector(Sector* sector); Sector* get_sector(const std::string& name); Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.171 retrieving revision 1.172 diff -u -d -r1.171 -r1.172 --- leveleditor.cpp 26 Nov 2004 14:45:32 -0000 1.171 +++ leveleditor.cpp 26 Nov 2004 17:16:13 -0000 1.172 @@ -110,12 +110,8 @@ if(!tile) continue; - Surface* surface; - if(tile->editor_images.size()) - surface = tile->editor_images[0]; - else if(tile->images.size()) - surface = tile->images[0]; - else + Surface* surface = tile->get_editor_image(); + if(!surface) continue; Button button = Button(surface, "", SDLKey(0)); @@ -459,7 +455,7 @@ { vector.push_back(tilemap->get_tile(x + (int)(((selection_ini.x+scroll.x)*zoom)/32), - y + (int)(((selection_ini.y+scroll.y)*zoom)/32))->id); + y + (int)(((selection_ini.y+scroll.y)*zoom)/32))->getID()); } selection.push_back(vector); } Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- gameloop.h 25 Nov 2004 19:48:25 -0000 1.65 +++ gameloop.h 26 Nov 2004 17:16:12 -0000 1.66 @@ -79,7 +79,6 @@ bool game_pause; std::string levelfile; - bool flip_level; // the sector and spawnpoint we shoudl spawn after this frame std::string newsector; @@ -93,8 +92,7 @@ DrawingContext* context; Timer2 time_left; - GameSession(const std::string& levelfile, int mode, bool flip_level_ = false, - Statistics* statistics = 0); + GameSession(const std::string& levelfile, int mode, Statistics* statistics=0); ~GameSession(); /** Enter the busy loop */ Index: level.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v retrieving revision 1.111 retrieving revision 1.112 diff -u -d -r1.111 -r1.112 --- level.cpp 26 Nov 2004 14:45:32 -0000 1.111 +++ level.cpp 26 Nov 2004 17:16:12 -0000 1.112 @@ -42,6 +42,7 @@ #include "object/gameobjs.h" #include "object/camera.h" #include "object/tilemap.h" +#include "object/coin.h" using namespace std; @@ -155,15 +156,6 @@ } void -Level::do_vertical_flip() -{ -#if 0 - for(Sectors::iterator i = sectors.begin(); i != sectors.end(); ++i) - i->second->do_vertical_flip(); -#endif -} - -void Level::add_sector(Sector* sector) { sectors.insert(std::make_pair(sector->get_name(), sector)); @@ -233,18 +225,13 @@ { int total_coins = 0; for(Sectors::iterator i = sectors.begin(); i != sectors.end(); ++i) { - TileMap* solids = i->second->solids; - assert(solids != 0); - for(size_t x = 0; x < solids->get_width(); ++x) - for(size_t y = 0; y < solids->get_height(); ++y) { - const Tile* tile = solids->get_tile(x, y); - if(tile == 0) { - std::cerr << "Invalid tile in sector '" << i->first << "'.\n"; - continue; - } - if(tile->attributes & Tile::COIN) - total_coins++; - } + Sector* sector = i->second; + for(Sector::GameObjects::iterator o = sector->gameobjects.begin(); + o != sector->gameobjects.end(); ++o) { + Coin* coin = dynamic_cast<Coin*> (*o); + if(coin) + total_coins++; + } } return total_coins; } Index: tile.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- tile.cpp 23 Nov 2004 02:00:51 -0000 1.40 +++ tile.cpp 26 Nov 2004 17:16:14 -0000 1.41 @@ -27,80 +27,13 @@ #include "app/globals.h" #include "tile.h" #include "scene.h" +#include "resources.h" #include "utils/lispreader.h" #include "math/vector.h" #include "video/drawing_context.h" -/** Dirty little helper to create a surface from a snipped of lisp: - * - * "filename" - * (region "filename" x y w h) - */ -static -Surface* create_surface(lisp_object_t* cur) -{ - if (lisp_string_p(cur)) - { - return new Surface(datadir + "/images/tilesets/" + lisp_string(cur), - true); - } - else if (lisp_cons_p(cur) && lisp_symbol_p(lisp_car(cur))) - { - lisp_object_t* sym = lisp_car(cur); - lisp_object_t* data = lisp_cdr(cur); - - if (strcmp(lisp_symbol(sym), "region") == 0) - { - if (lisp_list_length(data) == 5) // (image-region filename x y w h) - { - return new Surface(datadir + "/images/tilesets/" + lisp_string(lisp_car(data)), - lisp_integer(lisp_list_nth(data, 1)), - lisp_integer(lisp_list_nth(data, 2)), - lisp_integer(lisp_list_nth(data, 3)), - lisp_integer(lisp_list_nth(data, 4)), - true); - } - else - { - std::cout << "Tile: Type mispatch, should be '(region \"somestring\" x y w h)'" << std::endl; - return 0; - } - } - else - { - std::cout << "Tile: Unhandled tag: " << lisp_symbol(sym) << std::endl; - return 0; - } - } - - std::cout << "Tile: unhandled element" << std::endl; - return 0; -} - -/** Create a vector of surfaces (aka Sprite) from a piece of lisp: - ((image "bla.png") (image-region "bla.png") ...) - */ -static -std::vector<Surface*> create_surfaces(lisp_object_t* cur) -{ - std::vector<Surface*> surfs; - - while(cur) - { - Surface* surface = create_surface(lisp_car(cur)); - if (surface) - surfs.push_back(surface); - else - std::cout << "Tile: Couldn't create image" << std::endl; - - cur = lisp_cdr(cur); - } - - return surfs; -} - Tile::Tile() - : id(0), attributes(0), data(0), next_tile(0), anim_fps(1) + : id(0), editor_image(0), attributes(0), data(0), anim_fps(1) { } @@ -110,14 +43,11 @@ ++i) { delete *i; } - for(std::vector<Surface*>::iterator i = editor_images.begin(); - i != editor_images.end(); ++i) { - delete *i; - } + delete editor_image; } void -Tile::read(LispReader& reader) +Tile::parse(LispReader& reader) { if(!reader.read_uint("id", id)) { throw std::runtime_error("Missing tile-id."); @@ -147,14 +77,83 @@ reader.read_int("data", data); reader.read_float("anim-fps", anim_fps); - reader.read_int("next-tile", next_tile); if(reader.read_int("slope-type", data)) { attributes |= SOLID | SLOPE; } - images = create_surfaces(reader.read_lisp("images")); - editor_images = create_surfaces(reader.read_lisp("editor-images")); + parse_images(reader.read_lisp("images")); + reader.read_string("editor-images", editor_imagefile); +} + +void +Tile::parse_images(lisp_object_t* list) +{ + while(!lisp_nil_p(list)) { + lisp_object_t* cur = lisp_car(list); + if(lisp_string_p(cur)) { + imagespecs.push_back(ImageSpec(lisp_string(cur), Rectangle(0, 0, 0, 0))); + } else if(lisp_cons_p(cur) && lisp_symbol_p(lisp_car(cur))) { + lisp_object_t* sym = lisp_car(cur); + lisp_object_t* data = lisp_cdr(cur); + + if (strcmp(lisp_symbol(sym), "region") == 0) { + float x = lisp_integer(lisp_list_nth(data, 1)); + float y = lisp_integer(lisp_list_nth(data, 2)); + float width = lisp_integer(lisp_list_nth(data, 3)); + float height = lisp_integer(lisp_list_nth(data, 4)); + imagespecs.push_back(ImageSpec(lisp_string(lisp_car(data)), + Rectangle(x, y, x+width, y+height))); + } else { + std::cerr << "Tile: Type mismatch, should be '(region \"somestring\" x y w h)'" << std::endl; + continue; + } + } else { + std::cerr << "Expected string or list in images tag.\n"; + continue; + } + + list = lisp_cdr(list); + } +} + +void +Tile::load_images() +{ + assert(images.size() == 0); + for(std::vector<ImageSpec>::iterator i = imagespecs.begin(); i != + imagespecs.end(); ++i) { + const ImageSpec& spec = *i; + Surface* surface; + std::string file + = get_resource_filename(std::string("images/tilesets/") + spec.file); + if(spec.rect.get_width() <= 0) { + surface = new Surface(file, true); + } else { + surface = new Surface(file, + (int) spec.rect.p1.x, + (int) spec.rect.p1.y, + (int) spec.rect.get_width(), + (int) spec.rect.get_height(), true); + } + images.push_back(surface); + } + if(editor_imagefile != "") { + editor_image = new Surface( + get_resource_filename( + std::string("images/tilesets/") + editor_imagefile), true); + } +} + +Surface* +Tile::get_editor_image() const +{ + if(editor_image) + return editor_image; + if(images.size() > 0) + return images[0]; + + return 0; } void |
From: Matze B. <mat...@us...> - 2004-11-26 17:16:24
|
Update of /cvsroot/super-tux/supertux/src/trigger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31117/src/trigger Modified Files: sequence_trigger.cpp Log Message: lazily load tile images to speedup startup times Index: sequence_trigger.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/trigger/sequence_trigger.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sequence_trigger.cpp 23 Nov 2004 16:47:26 -0000 1.2 +++ sequence_trigger.cpp 26 Nov 2004 17:16:14 -0000 1.3 @@ -10,8 +10,7 @@ // TODO } -SequenceTrigger::SequenceTrigger(const Vector& pos, - const std::string& sequence) +SequenceTrigger::SequenceTrigger(const Vector& pos, const std::string& sequence) { bbox.set_pos(pos); bbox.set_size(32, 32); |
From: Marek M. <wa...@us...> - 2004-11-26 17:09:06
|
Update of /cvsroot/super-tux/supertux/src/badguy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29401/src/badguy Modified Files: nolok_01.cpp Log Message: small fixes (timing and animation) on nolok Index: nolok_01.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/nolok_01.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- nolok_01.cpp 25 Nov 2004 16:22:05 -0000 1.5 +++ nolok_01.cpp 26 Nov 2004 17:08:53 -0000 1.6 @@ -6,7 +6,7 @@ #define WALK_TIME 2.5 #define SHOOT_TIME 0.4 -#define JUMP_TIME 0.3 +#define JUMP_TIME 0.5 static const float WALKSPEED = 90; @@ -55,6 +55,7 @@ switch (action) { case WALKING: { + sprite->set_action("jump"); physic.set_velocity_y(700); action = JUMPING; action_timer.start(JUMP_TIME); |
From: Matze B. <mat...@us...> - 2004-11-26 14:54:17
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1294/src Modified Files: gameloop.cpp sector.cpp sector.h Log Message: fixed background drawing problems introduced with my last commit Index: sector.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- sector.h 26 Nov 2004 14:45:41 -0000 1.26 +++ sector.h 26 Nov 2004 14:54:05 -0000 1.27 @@ -134,7 +134,6 @@ // some special objects, where we need direct access Player* player; TileMap* solids; - Background* background; Camera* camera; private: Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- sector.cpp 26 Nov 2004 14:45:41 -0000 1.51 +++ sector.cpp 26 Nov 2004 14:54:05 -0000 1.52 @@ -63,7 +63,7 @@ Sector* Sector::_current = 0; Sector::Sector() - : gravity(10), player(0), solids(0), background(0), camera(0), + : gravity(10), player(0), solids(0), camera(0), currentmusic(LEVEL_MUSIC) { song_title = "Mortimers_chipdisko.mod"; @@ -93,8 +93,7 @@ Sector::parse_object(const std::string& name, LispReader& reader) { if(name == "background") { - background = new Background(reader); - return background; + return new Background(reader); } else if(name == "camera") { Camera* camera = new Camera(this); camera->parse(reader); Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.204 retrieving revision 1.205 diff -u -d -r1.204 -r1.205 --- gameloop.cpp 26 Nov 2004 14:45:32 -0000 1.204 +++ gameloop.cpp 26 Nov 2004 14:54:05 -0000 1.205 @@ -185,8 +185,13 @@ char str[60]; DrawingContext context; - if(currentsector->background) - currentsector->background->draw(context); + for(Sector::GameObjects::iterator i = currentsector->gameobjects.begin(); + i != currentsector->gameobjects.end(); ++i) { + Background* background = dynamic_cast<Background*> (*i); + if(background) { + background->draw(context); + } + } // context.draw_text(gold_text, level->get_name(), Vector(screen->w/2, 160), // CENTER_ALLIGN, LAYER_FOREGROUND1); @@ -905,12 +910,18 @@ } void -GameSession::drawresultscreen(void) +GameSession::drawresultscreen() { char str[80]; DrawingContext context; - currentsector->background->draw(context); + for(Sector::GameObjects::iterator i = currentsector->gameobjects.begin(); + i != currentsector->gameobjects.end(); ++i) { + Background* background = dynamic_cast<Background*> (*i); + if(background) { + background->draw(context); + } + } context.draw_text(blue_text, _("Result:"), Vector(screen->w/2, 200), CENTER_ALLIGN, LAYER_FOREGROUND1); |
From: Matze B. <mat...@us...> - 2004-11-26 14:54:16
|
Update of /cvsroot/super-tux/supertux/lib/special In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1294/lib/special Modified Files: collision.cpp Log Message: fixed background drawing problems introduced with my last commit Index: collision.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/collision.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- collision.cpp 26 Nov 2004 13:56:30 -0000 1.6 +++ collision.cpp 26 Nov 2004 14:54:05 -0000 1.7 @@ -146,7 +146,6 @@ return false; float time = depth / -(normal * movement); if(time < hit.time) { - printf("Time: %f.\n", time); hit.depth = depth; hit.time = time; hit.normal = normal; |