super-tux-commit Mailing List for Super Tux (Page 28)
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: Ricardo C. <rm...@us...> - 2004-10-18 20:42:24
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28268/src Modified Files: leveleditor.cpp Log Message: Ooops. I've alligned help text on center to test draw_text() and mistakely commit it. Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.158 retrieving revision 1.159 diff -u -d -r1.158 -r1.159 --- leveleditor.cpp 18 Oct 2004 16:52:28 -0000 1.158 +++ leveleditor.cpp 18 Oct 2004 20:42:11 -0000 1.159 @@ -992,7 +992,7 @@ context.draw_text(blue_text, _("- Level Editor's Help -"), Vector(screen->w/2, 60), CENTER_ALLIGN, LAYER_GUI); - context.draw_text(white_small_text, *text[i], Vector(/*20*/screen->w/2, 120), CENTER_ALLIGN, LAYER_GUI); + context.draw_text(white_small_text, *text[i], Vector(20, 120), LEFT_ALLIGN, LAYER_GUI); sprintf(str,_("Press any key to continue - Page %d/%d"), i+1, sizeof(text) / sizeof(text[0])); context.draw_text(gold_text, str, Vector(screen->w/2, screen->h-60), CENTER_ALLIGN, LAYER_GUI); |
From: Ricardo C. <rm...@us...> - 2004-10-18 20:34:05
|
Update of /cvsroot/super-tux/supertux/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25939/data Modified Files: Makefile.am Log Message: Install badguys.strf. Bug reported by unDEFER. Index: Makefile.am =================================================================== RCS file: /cvsroot/super-tux/supertux/data/Makefile.am,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Makefile.am 9 Oct 2004 15:36:31 -0000 1.18 +++ Makefile.am 18 Oct 2004 20:33:56 -0000 1.19 @@ -9,6 +9,7 @@ extro.txt \ extro-bonus.txt \ CREDITS \ + badguys.strf \ images/supertux.strf \ $(wildcard sounds/*.wav) \ $(wildcard images/*.png) \ |
From: Ricardo C. <rm...@us...> - 2004-10-18 16:54:22
|
Update of /cvsroot/super-tux/supertux/data/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1323/data/images Modified Files: supertux.strf Log Message: I had to change badguys sprite to organize them using actions. Index: supertux.strf =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/supertux.strf,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- supertux.strf 11 Oct 2004 11:44:22 -0000 1.17 +++ supertux.strf 18 Oct 2004 16:54:13 -0000 1.18 @@ -781,138 +781,138 @@ ; "shared/tux-grow-right-7.png"))) +;; Bad Guys follow + ;; Laptop - (sprite (name "mriceblock-left") + (sprite (name "mriceblock") (action + (name "left") (x-offset 2) (y-offset 3) (images "shared/mriceblock-left-0.png" "shared/mriceblock-left-1.png" "shared/mriceblock-left-2.png" - "shared/mriceblock-left-1.png"))) + "shared/mriceblock-left-1.png")) - (sprite (name "mriceblock-right") - (action + (action (name "right") (x-offset 2) (y-offset 3) - (images "shared/mriceblock-right-0.png" - "shared/mriceblock-right-1.png" - "shared/mriceblock-right-2.png" - "shared/mriceblock-right-1.png"))) + (mirror-action "left")) - (sprite (name "mriceblock-falling-right") - (action + (action (name "falling-right") (x-offset 2) (y-offset 3) - (images "shared/mriceblock-flat-right.png"))) + (images "shared/mriceblock-flat-right.png")) - (sprite (name "mriceblock-falling-left") - (action + (action (name "falling-left") (x-offset 2) (y-offset 3) - (images "shared/mriceblock-flat-left.png"))) + (images "shared/mriceblock-flat-left.png")) - (sprite (name "mriceblock-flat-left") - (action + (action (name "flat-left") (x-offset 2) (y-offset 3) - (images "shared/mriceblock-flat-left.png"))) + (images "shared/mriceblock-flat-left.png")) - (sprite (name "mriceblock-flat-right") - (action + (action (name "flat-right") (x-offset 2) (y-offset 3) - (images "shared/mriceblock-flat-right.png"))) - -; (sprite (name "mriceblock-falling-left") -; (images "shared/mriceblock-falling-left.png"))) + (mirror-action "falling-left"))) -; (sprite (name "mriceblock-falling-right") -; (images "shared/mriceblock-falling-right.png"))) + (sprite (name "snowball") + (action + (name "left") + (x-offset 2) + (y-offset 4) + (images "shared/snowball-left-0.png" + "shared/snowball-left-1.png" + "shared/snowball-left-2.png" + "shared/snowball-left-1.png")) - (sprite (name "snowball-squished-left") (action + (name "right") + (x-offset 2) + (y-offset 4) + (mirror-action "left")) + (action + (name "squished-left") (x-offset 1) (y-offset -19) - (images "shared/snowball-squished-left.png"))) + (images "shared/snowball-squished-left.png")) - (sprite (name "snowball-squished-right") (action + (name "squished-right") (x-offset 1) (y-offset -19) - (images "shared/snowball-squished-right.png"))) + (mirror-action "squished-left"))) - (sprite (name "jumpy-left-up") + (sprite (name "jumpy") (action + (name "left-up") (x-offset 7) (y-offset 8) - (images "shared/jumpy-left-up-0.png"))) - (sprite (name "jumpy-left-down") + (images "shared/jumpy-left-up-0.png")) (action + (name "left-down") (x-offset 7) (y-offset 8) - (images "shared/jumpy-left-down-0.png"))) - (sprite (name "jumpy-left-middle") + (images "shared/jumpy-left-down-0.png")) (action + (name "left-middle") (x-offset 7) (y-offset 8) - (images "shared/jumpy-left-middle-0.png"))) - (sprite (name "jumpy-left-iced") + (images "shared/jumpy-left-middle-0.png")) (action + (name "left-iced") (x-offset 7) (y-offset 8) (images "shared/jumpy-iced-left-up-0.png"))) - (sprite (name "mrbomb-left") + (sprite (name "mrbomb") (action + (name "left") (fps 10.0) (x-offset 3) (y-offset 12) (images "shared/mrbomb-left-0.png" "shared/mrbomb-left-1.png" "shared/mrbomb-left-2.png" - "shared/mrbomb-left-3.png"))) + "shared/mrbomb-left-3.png")) - (sprite (name "mrbomb-right") (action + (name "right") (fps 10.0) (x-offset 7) (y-offset 12) - (images "shared/mrbomb-right-0.png" - "shared/mrbomb-right-1.png" - "shared/mrbomb-right-2.png" - "shared/mrbomb-right-3.png"))) - (sprite (name "mrbomb-iced-left") + (mirror-action "left")) (action + (name "iced-left") (x-offset 3) (y-offset 12) - (images "shared/mrbomb-iced-left-0.png"))) + (images "shared/mrbomb-iced-left-0.png")) - (sprite (name "mrbomb-iced-right") (action + (name "iced-right") (x-offset 7) (y-offset 12) - (images "shared/mrbomb-iced-right-0.png"))) - + (mirror-action "iced-left"))) - (sprite (name "mrbomb-ticking-left") + (sprite (name "bomb") (action + (name "ticking-left") (fps 15.0) (x-offset 3) (y-offset 8) (images "shared/mrbombx-left-0.png" - "shared/mrbombx-left-1.png"))) - - (sprite (name "mrbomb-ticking-right") + "shared/mrbombx-left-1.png")) (action + (name "ticking-right") (fps 15.0) (x-offset 10) (y-offset 8) - (images "shared/mrbombx-right-0.png" - "shared/mrbombx-right-1.png"))) - - (sprite (name "mrbomb-explosion") + (mirror-action "ticking-left")) (action + (name "explosion") (fps 15.0) (x-offset 32) (y-offset 32) @@ -921,61 +921,65 @@ (sprite (name "stalactite") (action + (name "normal") (x-offset 0) (y-offset 0) - (images "shared/stalactite.png"))) - - (sprite (name "stalactite-broken") + (images "shared/stalactite.png")) (action + (name "broken") (x-offset 0) (y-offset 16) (images "shared/stalactite-broken.png"))) (sprite (name "flame") (action + (name "normal") (images "shared/flame-0.png" "shared/flame-1.png"))) (sprite (name "fish") (action + (name "normal") (x-offset 2) (y-offset 3) (images "shared/fish-left-0.png" - "shared/fish-left-1.png"))) + "shared/fish-left-1.png")) - (sprite (name "fish-down") (action + (name "down") (x-offset 2) (y-offset 11) - (images "shared/fish-down-0.png"))) + (images "shared/fish-down-0.png")) - (sprite (name "fish-iced") (action + (name "iced") (x-offset 2) (y-offset 3) - (images "shared/fish-iced-left-0.png"))) + (images "shared/fish-iced-left-0.png")) - (sprite (name "fish-iced-down") (action + (name "iced-down") (x-offset 2) (y-offset 11) (images "shared/fish-iced-down-0.png"))) (sprite (name "flamefish") (action + (name "normal") (x-offset 2) (y-offset 3) (images "shared/flamefish-left-0.png" - "shared/flamefish-left-1.png"))) + "shared/flamefish-left-1.png")) - (sprite (name "flamefish-down") (action + (name "down") (x-offset 2) (y-offset 11) (images "shared/flamefish-down-0.png"))) - (sprite (name "bouncingsnowball-left") + (sprite (name "bouncingsnowball") (action + (name "left") (x-offset 1) (y-offset 0) (images "shared/bouncingsnowball-left-0.png" @@ -983,80 +987,79 @@ "shared/bouncingsnowball-left-2.png" "shared/bouncingsnowball-left-3.png" "shared/bouncingsnowball-left-4.png" - "shared/bouncingsnowball-left-5.png"))) + "shared/bouncingsnowball-left-5.png")) - (sprite (name "bouncingsnowball-right") (action + (name "right") (x-offset 1) (y-offset 0) - (images "shared/bouncingsnowball-right-0.png" - "shared/bouncingsnowball-right-1.png" - "shared/bouncingsnowball-right-2.png" - "shared/bouncingsnowball-right-3.png" - "shared/bouncingsnowball-right-4.png" - "shared/bouncingsnowball-right-5.png"))) + (mirror-action "left")) - (sprite (name "bouncingsnowball-squished") (action + (name "squished") (x-offset 1) (y-offset -19) (images "shared/snowball-squished-left.png"))) (sprite (name "flyingsnowball") (action + (name "normal") (x-offset 4) (y-offset 3) (images "shared/flyingsnowball-left-0.png" - "shared/flyingsnowball-left-1.png"))) + "shared/flyingsnowball-left-1.png")) - (sprite (name "flyingsnowball-squished") (action + (name "squished") (x-offset 4) (y-offset -12) (images "shared/flyingsnowball-squished-left.png"))) - (sprite (name "spiky-left") + (sprite (name "spiky") (action + (name "left") (x-offset 6) (y-offset 10) (images "shared/spiky-left-0.png" "shared/spiky-left-1.png" - "shared/spiky-left-2.png"))) - (sprite (name "spiky-right") + "shared/spiky-left-2.png")) (action + (name "right") (x-offset 6) (y-offset 10) - (images "shared/spiky-right-0.png" - "shared/spiky-right-1.png" - "shared/spiky-right-2.png"))) - (sprite (name "spiky-iced-left") + (mirror-action "left")) (action + (name "iced-left") (x-offset 6) (y-offset 10) - (images "shared/spiky-iced-left-0.png"))) - (sprite (name "spiky-iced-right") + (images "shared/spiky-iced-left-0.png")) (action + (name "iced-right") (x-offset 6) (y-offset 10) - (images "shared/spiky-iced-right-0.png"))) + (mirror-action "iced-left"))) - (sprite (name "snowball-left") + ; Wingling + (sprite (name "wingling") (action - (x-offset 2) - (y-offset 4) - (images "shared/snowball-left-0.png" - "shared/snowball-left-1.png" - "shared/snowball-left-2.png" - "shared/snowball-left-1.png"))) + (name "left") + (x-offset 0) + (y-offset 0) + (images "shared/wingling-1.png"))) - (sprite (name "snowball-right") + ; Walkingtree + (sprite (name "walkingtree") (action - (x-offset 2) - (y-offset 4) - (images "shared/snowball-right-0.png" - "shared/snowball-right-1.png" - "shared/snowball-right-2.png" - "shared/snowball-right-1.png"))) + (name "left") + (x-offset 0) + (y-offset 0) + (images "shared/walkingtree-left-1.png")) + (action + (name "left-small") + (x-offset 0) + (y-offset 0) + (images "shared/walkingtree-left-small-1.png"))) + (sprite (name "egg") (action @@ -1122,26 +1125,6 @@ "shared/flying_platform-2.png" "shared/flying_platform-3.png" "shared/flying_platform-4.png"))) - - ; Wingling - (sprite (name "wingling-left") - (action - (x-offset 0) - (y-offset 0) - (images "shared/wingling-1.png"))) - - ; Walkingtree - (sprite (name "walkingtree-left") - (action - (x-offset 0) - (y-offset 0) - (images "shared/walkingtree-left-1.png"))) - (sprite (name "walkingtree-left-small") - (action - (x-offset 0) - (y-offset 0) - (images "shared/walkingtree-left-small-1.png"))) - ; Door (sprite (name "door") (action |
From: Ricardo C. <rm...@us...> - 2004-10-18 16:53:45
|
Update of /cvsroot/super-tux/supertux/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1152/data Added Files: badguys.strf Log Message: Uploading badguys config file. Currently, it only keeps sprites. Feel free to suggest other stuff together with how the badguys.strf entry should look like. --- NEW FILE: badguys.strf --- ; Bad Guys(tm) config file (supertux-badguys-specifications (badguy (kind "mriceblock") (sprite "mriceblock") ) (badguy (kind "jumpy") (sprite "jumpy") ) (badguy (kind "mrbomb") (sprite "mrbomb") ) (badguy (kind "bomb") (sprite "bomb") ) (badguy (kind "stalactite") (sprite "stalactite") ) (badguy (kind "flame") (sprite "flame") ) (badguy (kind "fish") (sprite "fish") ) (badguy (kind "flamefish") (sprite "flamefish") ) (badguy (kind "bouncingsnowball") (sprite "bouncingsnowball") ) (badguy (kind "flyingsnowball") (sprite "flyingsnowball") ) (badguy (kind "spiky") (sprite "spiky") ) (badguy (kind "snowball") (sprite "snowball") ) (badguy (kind "wingling") (sprite "wingling") ) (badguy (kind "walkingtree") (sprite "walkingtree") ) ) |
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv662/src Modified Files: camera.cpp Makefile.am resources.cpp badguy.h badguy.cpp leveleditor.cpp Added Files: badguy_specs.cpp badguy_specs.h Log Message: This is a first implementation of a bridge from BadGuys objects to a config file. Currently, it only keeps sprites. Feel free to suggest other stuff together with how the badguys.strf entry should look like. A lot of bugs like enemies with a different face might occur! Feel free to make a list of the issues, but I'd really appreaciate if you'd fix yourself. ;) Index: Makefile.am =================================================================== RCS file: /cvsroot/super-tux/supertux/src/Makefile.am,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- Makefile.am 14 Sep 2004 22:26:23 -0000 1.42 +++ Makefile.am 18 Oct 2004 16:52:28 -0000 1.43 @@ -15,7 +15,7 @@ worldmap.h tile.h tile.cpp tile_manager.h tile_manager.cpp resources.h \ resources.cpp gameobjs.h gameobjs.cpp background.h background.cpp tilemap.h \ tilemap.cpp serializable.h sector.cpp sector.h misc.h misc.cpp defines.h \ - statistics.cpp + statistics.cpp badguy_specs.cpp # EOF # INCLUDES = -I$(top_srcdir)/lib Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.157 retrieving revision 1.158 diff -u -d -r1.157 -r1.158 --- leveleditor.cpp 9 Oct 2004 22:55:56 -0000 1.157 +++ leveleditor.cpp 18 Oct 2004 16:52:28 -0000 1.158 @@ -992,7 +992,7 @@ context.draw_text(blue_text, _("- Level Editor's Help -"), Vector(screen->w/2, 60), CENTER_ALLIGN, LAYER_GUI); - context.draw_text(white_small_text, *text[i], Vector(20, 120), LEFT_ALLIGN, LAYER_GUI); + context.draw_text(white_small_text, *text[i], Vector(/*20*/screen->w/2, 120), CENTER_ALLIGN, LAYER_GUI); sprintf(str,_("Press any key to continue - Page %d/%d"), i+1, sizeof(text) / sizeof(text[0])); context.draw_text(gold_text, str, Vector(screen->w/2, screen->h-60), CENTER_ALLIGN, LAYER_GUI); Index: badguy.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.h,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- badguy.h 30 Aug 2004 19:11:14 -0000 1.62 +++ badguy.h 18 Oct 2004 16:52:28 -0000 1.63 @@ -25,10 +25,9 @@ #include "SDL.h" +#include "utils/lispreader.h" #include "special/timer.h" -#include "video/surface.h" #include "math/physic.h" -#include "special/sprite.h" #include "defines.h" #include "special/moving_object.h" #include "collision.h" @@ -64,10 +63,9 @@ BadGuyKind badguykind_from_string(const std::string& str); std::string badguykind_to_string(BadGuyKind kind); -void load_badguy_gfx(); -void free_badguy_gfx(); class Player; +class BadGuySpecs; /* Badguy type: */ class BadGuy : public MovingObject, public Serializable @@ -120,8 +118,9 @@ Physic physic; float angle; - Sprite* sprite_left; - Sprite* sprite_right; + std::string action_left, action_right; + + BadGuySpecs* specs; int animation_offset; @@ -147,8 +146,7 @@ /** initializes the badguy (when he appears on screen) */ void activate(Direction direction); // should only be used by BadGuy's objects - Surface* get_image() - { return sprite_left->get_frame(0); } + Surface* get_image(); private: void init(); @@ -184,8 +182,8 @@ void squish(Player* player); /** squish ourself, give player score and set dying to DYING_SQICHED */ void squish_me(Player* player); - /** set image of the badguy */ - void set_sprite(Sprite* left, Sprite* right); + /** set sprite's action of the badguy */ + void set_action(std::string action_left, std::string action_right); }; #endif /*SUPERTUX_BADGUY_H*/ Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.124 retrieving revision 1.125 diff -u -d -r1.124 -r1.125 --- badguy.cpp 17 Sep 2004 12:22:39 -0000 1.124 +++ badguy.cpp 18 Oct 2004 16:52:28 -0000 1.125 @@ -35,58 +35,16 @@ #include "sector.h" #include "tilemap.h" #include "statistics.h" - -Sprite* img_mriceblock_flat_left; -Sprite* img_mriceblock_flat_right; -Sprite* img_mriceblock_falling_left; -Sprite* img_mriceblock_falling_right; -Sprite* img_mriceblock_left; -Sprite* img_mriceblock_right; -Sprite* img_jumpy_left_up; -Sprite* img_jumpy_left_down; -Sprite* img_jumpy_left_middle; -Sprite* img_jumpy_left_iced; -Sprite* img_mrbomb_left; -Sprite* img_mrbomb_right; -Sprite* img_mrbomb_iced_left; -Sprite* img_mrbomb_iced_right; -Sprite* img_mrbomb_ticking_left; -Sprite* img_mrbomb_ticking_right; -Sprite* img_mrbomb_explosion; -Sprite* img_stalactite; -Sprite* img_stalactite_broken; -Sprite* img_flame; -Sprite* img_fish; -Sprite* img_fish_down; -Sprite* img_fish_iced; -Sprite* img_fish_iced_down; -Sprite* img_flamefish; -Sprite* img_flamefish_down; -Sprite* img_bouncingsnowball_left; -Sprite* img_bouncingsnowball_right; -Sprite* img_bouncingsnowball_squished; -Sprite* img_flyingsnowball; -Sprite* img_flyingsnowball_squished; -Sprite* img_spiky_left; -Sprite* img_spiky_right; -Sprite* img_spiky_iced_left; -Sprite* img_spiky_iced_right; -Sprite* img_snowball_left; -Sprite* img_snowball_right; -Sprite* img_snowball_squished_left; -Sprite* img_snowball_squished_right; -Sprite* img_wingling_left; -Sprite* img_walkingtree_left; -Sprite* img_walkingtree_left_small; +#include "badguy_specs.h" #define BADGUY_WALK_SPEED .8f #define WINGLING_FLY_SPEED 1.6f BadGuyKind badguykind_from_string(const std::string& str) { - if (str == "money" || str == "jumpy") // was money in old maps + if (str == "jumpy" || str == "money") // was "money" in ancient versions return BAD_JUMPY; - else if (str == "laptop" || str == "mriceblock") // was laptop in old maps + else if (str == "mriceblock" || str == "laptop") // was "laptop" in ancient versions return BAD_MRICEBLOCK; else if (str == "mrbomb") return BAD_MRBOMB; @@ -104,7 +62,7 @@ return BAD_FLYINGSNOWBALL; else if (str == "spiky") return BAD_SPIKY; - else if (str == "snowball" || str == "bsod") // was bsod in old maps + else if (str == "snowball" || str == "bsod") // was "bsod" in ancient versions return BAD_SNOWBALL; else if (str == "wingling") return BAD_WINGLING; @@ -208,11 +166,12 @@ seen = false; animation_offset = 0; target.x = target.y = -1; - sprite_left = sprite_right = 0; physic.reset(); frozen_timer.init(true); timer.init(true); + specs = badguyspecs_manager->load(badguykind_to_string(kind)); + // if we're in a solid tile at start correct that now if(Sector::current()) { if(kind != BAD_FLAME && kind != BAD_FISH && kind != BAD_FLAMEFISH && collision_object_map(base)) @@ -264,52 +223,48 @@ dir = activation_dir; float dirsign = activation_dir == LEFT ? -1 : 1; + set_action("left", "right"); if(kind == BAD_MRBOMB) { physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0); - set_sprite(img_mrbomb_left, img_mrbomb_right); } else if (kind == BAD_MRICEBLOCK) { physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0); - set_sprite(img_mriceblock_left, img_mriceblock_right); } else if(kind == BAD_JUMPY) { - set_sprite(img_jumpy_left_up, img_jumpy_left_up); + set_action("left-up", "left-up"); } else if(kind == BAD_BOMB) { - set_sprite(img_mrbomb_ticking_left, img_mrbomb_ticking_right); + set_action("ticking-left", "ticking-right"); // hack so that the bomb doesn't hurt until it expldes... dying = DYING_SQUISHED; } else if(kind == BAD_FLAME) { angle = 0; physic.enable_gravity(false); - set_sprite(img_flame, img_flame); + set_action("normal", "normal"); } else if(kind == BAD_BOUNCINGSNOWBALL) { physic.set_velocity(dirsign * 1.3, 0); - set_sprite(img_bouncingsnowball_left, img_bouncingsnowball_right); } else if(kind == BAD_STALACTITE) { physic.enable_gravity(false); - set_sprite(img_stalactite, img_stalactite); + set_action("normal", "normal"); } else if(kind == BAD_FISH) { - set_sprite(img_fish, img_fish); + set_action("normal", "normal"); physic.enable_gravity(true); } else if(kind == BAD_FLAMEFISH) { - set_sprite(img_flamefish, img_flamefish); + set_action("normal", "normal"); physic.enable_gravity(true); } else if(kind == BAD_FLYINGSNOWBALL) { - set_sprite(img_flyingsnowball, img_flyingsnowball); + set_action("normal", "normal"); physic.enable_gravity(false); } else if(kind == BAD_SPIKY) { physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0); - set_sprite(img_spiky_left, img_spiky_right); } else if(kind == BAD_SNOWBALL) { physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0); - set_sprite(img_snowball_left, img_snowball_right); } else if(kind == BAD_WINGLING) { physic.set_velocity(dirsign * WINGLING_FLY_SPEED, 0); physic.enable_gravity(false); - set_sprite(img_wingling_left, img_wingling_left); + set_action("left", "left"); } else if (kind == BAD_WALKINGTREE) { - // TODO: why isn't the height/width being set properly in set_sprite? + // TODO: why isn't the height/width being set properly in set_action? physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0); mode = BGM_BIG; - set_sprite(img_walkingtree_left, img_walkingtree_left); + set_action("left", "left"); base.width = 66; base.height = 66; } @@ -320,6 +275,12 @@ seen = true; } +Surface* +BadGuy::get_image() +{ +return specs->sprite->get_frame(0); +} + void BadGuy::action_mriceblock(double elapsed_time) { @@ -373,7 +334,7 @@ mode=KICK; tux.kick_timer.start(KICKING_TIME); - set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); + set_action("flat-left", "flat-right"); physic.set_velocity_x((dir == LEFT) ? -3.5 : 3.5); SoundManager::get()->play_sound(IDToSound(SND_KICK), this, Sector::current()->player->get_pos()); } @@ -395,7 +356,7 @@ if(!timer.check()) { mode = NORMAL; - set_sprite(img_mriceblock_left, img_mriceblock_right); + set_action("left", "right"); physic.set_velocity( (dir == LEFT) ? -.8 : .8, 0); } } @@ -505,7 +466,7 @@ { if(frozen_timer.check()) { - set_sprite(img_jumpy_left_iced, img_jumpy_left_iced); + set_action("left-iced", "left-iced"); return; } @@ -513,11 +474,11 @@ // XXX: These tests *should* use location from ground, not velocity if (fabsf(vy) > 5.6f) - set_sprite(img_jumpy_left_down, img_jumpy_left_down); + set_action("left-down", "left-down"); else if (fabsf(vy) > 5.3f) - set_sprite(img_jumpy_left_middle, img_jumpy_left_middle); + set_action("left-middle", "left-middle"); else - set_sprite(img_jumpy_left_up, img_jumpy_left_up); + set_action("left-up", "left-up"); Player& tux = *Sector::current()->player; @@ -554,7 +515,7 @@ { if(frozen_timer.check()) { - set_sprite(img_mrbomb_iced_left, img_mrbomb_iced_right); + set_action("iced-left", "iced-right"); return; } @@ -582,7 +543,7 @@ } else if(!timer.check()) { if(mode == BOMB_TICKING) { mode = BOMB_EXPLODE; - set_sprite(img_mrbomb_explosion, img_mrbomb_explosion); + set_action("explosion", "explosion"); dying = DYING_NOT; // now the bomb hurts timer.start(EXPLODETIME); @@ -628,7 +589,7 @@ timer.start(2000); dying = DYING_SQUISHED; mode = FLAT; - set_sprite(img_stalactite_broken, img_stalactite_broken); + set_action("broken", "broken"); } } else if(mode == FLAT) { fall(); @@ -658,9 +619,9 @@ if(frozen_timer.check()) { if(physic.get_velocity_y() < 0) - set_sprite(img_fish_iced_down, img_fish_iced_down); + set_action("iced-down", "iced-down"); else - set_sprite(img_fish_iced, img_fish_iced); + set_action("iced", "iced"); return; } @@ -675,7 +636,7 @@ && physic.get_velocity_y() <= 0 && mode == NORMAL) { mode = FISH_WAIT; - set_sprite(0, 0); + set_action("hide", "hide"); physic.set_velocity(0, 0); physic.enable_gravity(false); timer.start(WAITTIME); @@ -683,10 +644,7 @@ else if(mode == FISH_WAIT && !timer.check()) { // jump again - if(kind == BAD_FISH) - set_sprite(img_fish, img_fish); - else // BAD_FLAMEFISH - set_sprite(img_flamefish, img_flamefish); + set_action("normal", "normal"); mode = NORMAL; physic.set_velocity(0, JUMPV); physic.enable_gravity(true); @@ -698,10 +656,7 @@ if(physic.get_velocity_y() < 0) { - if(kind == BAD_FISH) - set_sprite(img_fish_down, img_fish_down); - else // BAD_FLAMEFISH - set_sprite(img_flamefish_down, img_flamefish_down); + set_action("down", "down"); } } @@ -776,7 +731,7 @@ { if(frozen_timer.check()) { - set_sprite(img_spiky_iced_left, img_spiky_iced_right); + set_action("iced-left", "iced-right"); return; } @@ -982,14 +937,19 @@ void BadGuy::draw(DrawingContext& context) { - Sprite* sprite = (dir == LEFT) ? sprite_left : sprite_right; - if(sprite == 0) + if((dir == LEFT && action_left == "hide") || + (dir == RIGHT && action_right == "hide")) return; + if(dir == LEFT) + specs->sprite->set_action(action_left); + else // if(dir == RIGHT) + specs->sprite->set_action(action_right); + if(dying == DYING_FALLING && physic.get_velocity_y() < 0) - sprite->draw(context, Vector(base.x, base.y), LAYER_FOREGROUNDTILES+1, VERTICAL_FLIP); + specs->sprite->draw(context, Vector(base.x, base.y), LAYER_FOREGROUNDTILES+1, VERTICAL_FLIP); else - sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS); + specs->sprite->draw(context, Vector(base.x, base.y), LAYER_OBJECTS); if(debug_mode) context.draw_filled_rect(Vector(base.x, base.y), @@ -997,8 +957,15 @@ } void -BadGuy::set_sprite(Sprite* left, Sprite* right) +BadGuy::set_action(std::string left, std::string right) { + base.width = 32; + base.height = 32; + + action_left = left; + action_right = right; + +#if 0 if (1) { base.width = 32; @@ -1028,6 +995,7 @@ animation_offset = 0; sprite_left = left; sprite_right = right; +#endif } void @@ -1081,7 +1049,7 @@ /* Flatten! */ SoundManager::get()->play_sound(IDToSound(SND_STOMP), get_pos(), Sector::current()->player->get_pos()); mode = FLAT; - set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); + set_action("flat-left", "flat-right"); physic.set_velocity_x(0); timer.start(4000); @@ -1099,7 +1067,7 @@ mode = KICK; player->kick_timer.start(KICKING_TIME); - set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); + set_action("flat-left", "flat-right"); } player->bounce(this); @@ -1131,23 +1099,23 @@ return; } else if(kind == BAD_BOUNCINGSNOWBALL) { squish_me(player); - set_sprite(img_bouncingsnowball_squished,img_bouncingsnowball_squished); + set_action("squished", "squished"); return; } else if(kind == BAD_FLYINGSNOWBALL) { squish_me(player); - set_sprite(img_flyingsnowball_squished,img_flyingsnowball_squished); + set_action("squished", "squished"); return; } else if(kind == BAD_SNOWBALL) { squish_me(player); - set_sprite(img_snowball_squished_left, img_snowball_squished_right); + set_action("squished-left", "squished-right"); return; } else if(kind == BAD_WINGLING) { squish_me(player); - set_sprite(img_wingling_left, img_wingling_left); + set_action("left", "right"); } else if(kind == BAD_WALKINGTREE) { if (mode == BGM_BIG) { - set_sprite(img_walkingtree_left_small, img_walkingtree_left_small); + set_action("left-small", "left-small"); physic.set_velocity_x(physic.get_velocity_x() * 2.0f); /* Move to the player's direction */ @@ -1182,7 +1150,7 @@ dying = DYING_FALLING; if(kind == BAD_MRICEBLOCK) { - set_sprite(img_mriceblock_falling_left, img_mriceblock_falling_right); + set_action("falling-left", "falling-right"); if(mode == HELD) { mode = NORMAL; Player& tux = *Sector::current()->player; @@ -1379,64 +1347,11 @@ mode = KICK; player->kick_timer.start(KICKING_TIME); - set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); + set_action("flat-left", "flat-right"); } break; } } - -//--------------------------------------------------------------------------- - -void load_badguy_gfx() -{ - img_mriceblock_flat_left = sprite_manager->load("mriceblock-flat-left"); - img_mriceblock_flat_right = sprite_manager->load("mriceblock-flat-right"); - img_mriceblock_falling_left = sprite_manager->load("mriceblock-falling-left"); - img_mriceblock_falling_right = sprite_manager->load("mriceblock-falling-right"); - img_mriceblock_left = sprite_manager->load("mriceblock-left"); - img_mriceblock_right = sprite_manager->load("mriceblock-right"); - img_jumpy_left_up = sprite_manager->load("jumpy-left-up"); - img_jumpy_left_down = sprite_manager->load("jumpy-left-down"); - img_jumpy_left_middle = sprite_manager->load("jumpy-left-middle"); - img_jumpy_left_iced = sprite_manager->load("jumpy-left-iced"); - img_mrbomb_left = sprite_manager->load("mrbomb-left"); - img_mrbomb_right = sprite_manager->load("mrbomb-right"); - img_mrbomb_iced_left = sprite_manager->load("mrbomb-iced-left"); - img_mrbomb_iced_right = sprite_manager->load("mrbomb-iced-right"); - img_mrbomb_ticking_left = sprite_manager->load("mrbomb-ticking-left"); - img_mrbomb_ticking_right = sprite_manager->load("mrbomb-ticking-right"); - img_mrbomb_explosion = sprite_manager->load("mrbomb-explosion"); - img_stalactite = sprite_manager->load("stalactite"); - img_stalactite_broken = sprite_manager->load("stalactite-broken"); - img_flame = sprite_manager->load("flame"); - img_fish = sprite_manager->load("fish"); - img_fish_down = sprite_manager->load("fish-down"); - img_fish_iced = sprite_manager->load("fish-iced"); - img_fish_iced_down = sprite_manager->load("fish-iced-down"); - img_flamefish = sprite_manager->load("flamefish"); - img_flamefish_down = sprite_manager->load("flamefish-down"); - img_bouncingsnowball_left = sprite_manager->load("bouncingsnowball-left"); - img_bouncingsnowball_right = sprite_manager->load("bouncingsnowball-right"); - img_bouncingsnowball_squished = sprite_manager->load("bouncingsnowball-squished"); - img_flyingsnowball = sprite_manager->load("flyingsnowball"); - img_flyingsnowball_squished = sprite_manager->load("flyingsnowball-squished"); - img_spiky_left = sprite_manager->load("spiky-left"); - img_spiky_right = sprite_manager->load("spiky-right"); - img_spiky_iced_left = sprite_manager->load("spiky-iced-left"); - img_spiky_iced_right = sprite_manager->load("spiky-iced-right"); - img_snowball_left = sprite_manager->load("snowball-left"); - img_snowball_right = sprite_manager->load("snowball-right"); - img_snowball_squished_left = sprite_manager->load("snowball-squished-left"); - img_snowball_squished_right = sprite_manager->load("snowball-squished-right"); - img_wingling_left = sprite_manager->load("wingling-left"); - img_walkingtree_left = sprite_manager->load("walkingtree-left"); - img_walkingtree_left_small = sprite_manager->load("walkingtree-left-small"); -} - -void free_badguy_gfx() -{ -} - // EOF // Index: camera.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/camera.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- camera.cpp 21 Jul 2004 16:51:53 -0000 1.14 +++ camera.cpp 18 Oct 2004 16:52:28 -0000 1.15 @@ -22,6 +22,7 @@ #include <cmath> #include "camera.h" +#include "utils/lispreader.h" #include "utils/lispwriter.h" #include "player.h" #include "tilemap.h" --- NEW FILE: badguy_specs.h --- /*************************************************************************** badguy_specs.h - badguys properties table ------------------- begin : Oct, 11 2004 copyright : (C) 2004 by Ricardo Cruz email : ri...@ae... ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef SUPERTUX_BADGUY_SPECS_H #define SUPERTUX_BADGUY_SPECS_H #include <string> #include <map> #include "utils/lispreader.h" using namespace SuperTux; namespace SuperTux { class Sprite; } class BadGuySpecs; class BadGuySpecsManager; extern BadGuySpecsManager* badguyspecs_manager; class BadGuySpecsManager { public: BadGuySpecsManager(const std::string& filename); ~BadGuySpecsManager(); void load_resfile(const std::string& filename); /** loads a sprite. * WARNING: You must not delete the returned object. */ BadGuySpecs* load(const std::string& name); private: typedef std::map<std::string, BadGuySpecs*> BadGuysSpecs; BadGuysSpecs badguys_specs; }; class BadGuySpecs { public: BadGuySpecs(LispReader& reader); BadGuySpecs(std::string& kind); ~BadGuySpecs(); std::string get_name(); // proprities std::string kind; Sprite* sprite; private: void reset(); }; #endif /*SUPERTUX_BADGUY_SPECS_H*/ --- NEW FILE: badguy_specs.cpp --- /*************************************************************************** badguy_specs.cpp - badguys properties table ------------------- begin : Oct, 11 2004 copyright : (C) 2004 by Ricardo Cruz email : ri...@ae... ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include <iostream> #include "special/sprite_manager.h" #include "resources.h" #include "badguy_specs.h" BadGuySpecsManager* badguyspecs_manager = 0; BadGuySpecsManager::BadGuySpecsManager(const std::string& filename) { load_resfile(filename); } BadGuySpecsManager::~BadGuySpecsManager() { for(std::map<std::string, BadGuySpecs*>::iterator i = badguys_specs.begin(); i != badguys_specs.end(); ++i) delete i->second; } void BadGuySpecsManager::load_resfile(const std::string& filename) { lisp_object_t* root_obj = lisp_read_from_file(filename); if (!root_obj) { std::cout << "BadGuySpecsManager: Couldn't load: " << filename << std::endl; return; } lisp_object_t* cur = root_obj; if (strcmp(lisp_symbol(lisp_car(cur)), "supertux-badguys-specifications") != 0) return; cur = lisp_cdr(cur); while(cur) { lisp_object_t* el = lisp_car(cur); if (strcmp(lisp_symbol(lisp_car(el)), "badguy") == 0) { LispReader reader(lisp_cdr(lisp_car(cur))); BadGuySpecs* badguy_specs = new BadGuySpecs(reader); BadGuysSpecs::iterator i = badguys_specs.find(badguy_specs->get_name()); if (i == badguys_specs.end()) { badguys_specs[badguy_specs->get_name()] = badguy_specs; } else { delete i->second; i->second = badguy_specs; std::cerr << "Warning: dulpicate entry: '" << badguy_specs->get_name() << "'" << std::endl; } } else { std::cout << "BadGuySpecsManager: Unknown tag" << std::endl; } cur = lisp_cdr(cur); } lisp_free(root_obj); } BadGuySpecs* BadGuySpecsManager::load(const std::string& name) { BadGuysSpecs::iterator i = badguys_specs.find(name); if (i == badguys_specs.end()) { std::cerr << "Warning: BadGuy specification '" << name << "' not found" << std::endl; return 0; } return i->second; } BadGuySpecs::BadGuySpecs(LispReader& reader) { reset(); std::string str; reader.read_string("kind", str); kind = str; str.clear(); reader.read_string("inherits", str); if(!str.empty()) { BadGuySpecs* bgspecs = badguyspecs_manager->load(str); if(bgspecs) { sprite = bgspecs->sprite; } else std::cerr << "Warning: inherited '" << str << "was not found.\nProbably, it was declared after" "this entry '" << kind << std::endl; } str.clear(); reader.read_string("sprite", str); if(str.empty()) std::cerr << "Warning: No sprite has been set to badguy " << kind << std::endl; else sprite = sprite_manager->load(str); if(!sprite) { std::cerr << "Warning: Sprite '" << str << "' could not be loaded.\n"; } } BadGuySpecs::BadGuySpecs(std::string& kind_) { reset(); kind = kind_; } BadGuySpecs::~BadGuySpecs() { } void BadGuySpecs::reset() { kind.clear(); } std::string BadGuySpecs::get_name() { return kind; } // EOF // Index: resources.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- resources.cpp 14 Sep 2004 10:27:05 -0000 1.53 +++ resources.cpp 18 Oct 2004 16:52:28 -0000 1.54 @@ -18,17 +18,18 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "app/globals.h" +#include "special/sprite_manager.h" +#include "audio/sound_manager.h" +#include "app/setup.h" +#include "gui/button.h" #include "scene.h" #include "player.h" #include "badguy.h" #include "gameobjs.h" #include "special.h" #include "resources.h" -#include "special/sprite_manager.h" -#include "audio/sound_manager.h" -#include "app/setup.h" #include "door.h" -#include "gui/button.h" +#include "badguy_specs.h" Surface* img_waves[3]; Surface* img_water; @@ -157,6 +158,9 @@ ice_tux->arms = sprite_manager->load("big-tux-arms"); ice_tux->feet = sprite_manager->load("big-tux-feet"); + /* Load Bad Guys resources */ + badguyspecs_manager = new BadGuySpecsManager(datadir + "/badguys.strf"); + /* Water: */ img_water = new Surface(datadir + "/images/shared/water.png", false); @@ -213,10 +217,6 @@ img_cloud[1][3] = new Surface(datadir + "/images/shared/cloud-13.png", true); - - /* Bad guys: */ - load_badguy_gfx(); - /* Upgrades: */ load_special_gfx(); @@ -286,7 +286,6 @@ int i; free_special_gfx(); - free_badguy_gfx(); delete img_water; for (i = 0; i < 3; i++) |
From: Marek M. <wa...@us...> - 2004-10-18 12:21:24
|
Update of /cvsroot/super-tux/supertux/data/music In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25154/data/music Modified Files: ghostforest2-fast.mod ghostforest2.mod Log Message: added the rest of the melody to ghost forest 2 (not yet finished though, still needs some cleanup) Index: ghostforest2.mod =================================================================== RCS file: /cvsroot/super-tux/supertux/data/music/ghostforest2.mod,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 Binary files /tmp/cvsNdfTjf and /tmp/cvsk31Jcz differ Index: ghostforest2-fast.mod =================================================================== RCS file: /cvsroot/super-tux/supertux/data/music/ghostforest2-fast.mod,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 Binary files /tmp/cvsdnZgLI and /tmp/cvs5dmP52 differ |
From: Marek M. <wa...@us...> - 2004-10-17 23:06:33
|
Update of /cvsroot/super-tux/supertux/data/music In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14361/data/music Modified Files: ghostforest2-fast.mod ghostforest2.mod Log Message: fixed one of the ghost forest tune - made the choir sound less staccatoish Index: ghostforest2.mod =================================================================== RCS file: /cvsroot/super-tux/supertux/data/music/ghostforest2.mod,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsLg58lo and /tmp/cvs0Vv00Y differ Index: ghostforest2-fast.mod =================================================================== RCS file: /cvsroot/super-tux/supertux/data/music/ghostforest2-fast.mod,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsZWWNyZ and /tmp/cvs7aKDNA differ |
From: Marek M. <wa...@us...> - 2004-10-17 10:25:10
|
Update of /cvsroot/super-tux/supertux/data/music In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5583/data/music Added Files: ghostforest-fast.mod ghostforest.mod ghostforest2-fast.mod ghostforest2.mod scary-fast.mod scary.mod Log Message: updated (i.e. shortened) scary.mod (not sure if it is useful at all) added two work-in-progress ghost forest tunes for you to criticize :) --- NEW FILE: ghostforest2.mod --- (This appears to be a binary file; contents omitted.) --- NEW FILE: scary-fast.mod --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ghostforest2-fast.mod --- (This appears to be a binary file; contents omitted.) --- NEW FILE: scary.mod --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ghostforest-fast.mod --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ghostforest.mod --- (This appears to be a binary file; contents omitted.) |
From: Marek M. <wa...@us...> - 2004-10-17 10:07:56
|
Update of /cvsroot/super-tux/supertux/data/music In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4286/data/music Removed Files: scary-fast.mod scary.mod Log Message: about to update music files - removing some old files --- scary-fast.mod DELETED --- --- scary.mod DELETED --- |
From: Ricardo C. <rm...@us...> - 2004-10-16 11:20:38
|
Update of /cvsroot/super-tux/supertux/lib/video In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9169/lib/video Modified Files: font.cpp Log Message: get_text_width() was broken. Fixed. Also, made all text being alligned in draw_text(), instead of a floated alligned text. Might be good to allow a setup of this. Index: font.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- font.cpp 15 Oct 2004 22:40:47 -0000 1.12 +++ font.cpp 16 Oct 2004 11:20:28 -0000 1.13 @@ -74,15 +74,16 @@ Font::get_text_width(const std::string& text) const { /** Let's calculate the size of the biggest paragraph */ - std::string::size_type l, hl; + std::string::size_type l, hl, ol; hl = 0; l = 0; while(true) { + ol = l; l = text.find("\n", l+1); if(l == std::string::npos) break; - if(hl < l) - hl = l; + if(hl < l-ol) + hl = l-ol; } if(hl == 0) hl = text.size(); @@ -99,7 +100,7 @@ while(true) { l = text.find("\n", l+1); - if(l == (int)std::string::npos) + if(l == std::string::npos) break; hh += h + 2; } @@ -116,31 +117,33 @@ void Font::draw(const std::string& text, const Vector& pos_, int allignment, Uint32 drawing_effect, int alpha) { - // calculate X positions based on the allignment type - Vector pos = Vector(pos_); - if(allignment == CENTER_ALLIGN) - pos.x -= get_text_width(text) / 2; - else if(allignment == RIGHT_ALLIGN) - pos.x -= get_text_width(text); - /* Cut lines changes into seperate strings, needed to support center/right text allignments with break lines. Feel free to replace this hack with a more elegant solution */ char temp[1024]; std::string::size_type l, i, y; + bool done = false; i = y = 0; - while(true) + while(!done) { l = text.find("\n", i); if(l == std::string::npos) { - temp[text.copy(temp, text.size() - i, i)] = '\0'; - draw_text(temp, pos + Vector(0,y), drawing_effect, alpha); - break; + l = text.size(); + done = true; } + temp[text.copy(temp, l - i, i)] = '\0'; + + // calculate X positions based on the allignment type + Vector pos = Vector(pos_); + if(allignment == CENTER_ALLIGN) + pos.x -= get_text_width(temp) / 2; + else if(allignment == RIGHT_ALLIGN) + pos.x -= get_text_width(temp); + draw_text(temp, pos + Vector(0,y), drawing_effect, alpha); i = l+1; |
From: Ryan F. <sik...@us...> - 2004-10-15 22:40:58
|
Update of /cvsroot/super-tux/supertux/lib/video In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20547/lib/video Modified Files: font.cpp Log Message: - fixed warnings--hopefully this doesn't break anything (ie error checking) Index: font.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- font.cpp 12 Oct 2004 06:27:13 -0000 1.11 +++ font.cpp 15 Oct 2004 22:40:47 -0000 1.12 @@ -75,7 +75,7 @@ { /** Let's calculate the size of the biggest paragraph */ std::string::size_type l, hl; - hl = 0; l = -1; + hl = 0; l = 0; while(true) { l = text.find("\n", l+1); @@ -95,7 +95,7 @@ { /** Let's calculate height of the text */ std::string::size_type l, hh; - hh = h; l = -1; + hh = h; l = 0; while(true) { l = text.find("\n", l+1); |
From: Ryan F. <sik...@us...> - 2004-10-12 06:27:36
|
Update of /cvsroot/super-tux/supertux/lib/video In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9915/lib/video Modified Files: font.cpp Log Message: - fix pointed out by Matt Mets Index: font.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- font.cpp 9 Oct 2004 07:04:04 -0000 1.10 +++ font.cpp 12 Oct 2004 06:27:13 -0000 1.11 @@ -217,7 +217,7 @@ // Split text string lines into a vector names.clear(); - unsigned int i, l; + std::string::size_type i, l; i = 0; while(true) { |
From: Benjamin P. J. <lit...@us...> - 2004-10-11 11:44:32
|
Update of /cvsroot/super-tux/supertux/data/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31248/data/images Modified Files: supertux.strf Log Message: ducking fire tux now wears his helmet. :-) Index: supertux.strf =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/supertux.strf,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- supertux.strf 11 Oct 2004 08:49:23 -0000 1.16 +++ supertux.strf 11 Oct 2004 11:44:22 -0000 1.17 @@ -666,7 +666,7 @@ (fps 15.0) (x-offset 5) (y-offset 62) - (images "shared/bigtux/head-duck-0.png")) + (images "shared/bigtux/head-fire-duck-0.png")) (action (name "duck-left") |
From: Benjamin P. J. <lit...@us...> - 2004-10-11 11:42:51
|
Update of /cvsroot/super-tux/supertux/data/images/shared/bigtux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30844/data/images/shared/bigtux Added Files: head-fire-duck-0.png Log Message: Did a (very poor) head of tux (ducking) whilst wearing the firefighter helmet... --- NEW FILE: head-fire-duck-0.png --- (This appears to be a binary file; contents omitted.) |
From: Ricardo C. <rm...@us...> - 2004-10-11 08:49:50
|
Update of /cvsroot/super-tux/supertux/data/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25608/data/images Modified Files: supertux.strf Log Message: Left offsets fixed by Joeri Samson. Also changed duck fire Tux. Index: supertux.strf =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/supertux.strf,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- supertux.strf 11 Sep 2004 13:32:04 -0000 1.15 +++ supertux.strf 11 Oct 2004 08:49:23 -0000 1.16 @@ -192,8 +192,8 @@ (action (name "walk-left") (fps 15.0) - (x-offset 5) - (y-offset 14) + (x-offset 27) + (y-offset 32) (mirror-action "walk-right")) (action @@ -206,7 +206,7 @@ (action (name "stand-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "stand-right")) @@ -220,7 +220,7 @@ (action (name "jump-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 30) (mirror-action "jump-right")) @@ -232,7 +232,7 @@ (action (name "duck-left") - (x-offset 5) + (x-offset 27) (y-offset 62) (mirror-action "duck-right")) @@ -245,7 +245,7 @@ (action (name "skid-left") (fps 15.0) - (x-offset 6) + (x-offset 27) (y-offset 31) (mirror-action "skid-right")) @@ -257,7 +257,7 @@ (action (name "kick-left") - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "kick-right")) @@ -269,7 +269,7 @@ (action (name "buttjump-left") - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "buttjump-right")) @@ -283,7 +283,7 @@ (action (name "grab-left") - (x-offset 5) + (x-offset 27) (y-offset 32) (z-order 2) (mirror-action "grab-right")) @@ -297,7 +297,7 @@ (action (name "duck+grab-left") - (x-offset 5) + (x-offset 27) (y-offset 62) (z-order 2) (mirror-action "duck+grab-right"))) @@ -315,7 +315,7 @@ (action (name "walk-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "walk-right")) @@ -329,7 +329,7 @@ (action (name "stand-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "stand-right")) @@ -343,7 +343,7 @@ (action (name "jump-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 30) (mirror-action "jump-right")) @@ -357,7 +357,7 @@ (action (name "duck-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 62) (mirror-action "duck-right")) @@ -370,7 +370,7 @@ (action (name "skid-left") (fps 15.0) - (x-offset 6) + (x-offset 27) (y-offset 31) (mirror-action "skid-right")) @@ -383,7 +383,7 @@ (action (name "kick-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "kick-right")) @@ -395,7 +395,7 @@ (action (name "buttjump-left") - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "buttjump-right")) @@ -411,7 +411,7 @@ (action (name "idle-left") (fps 1.0) - (x-offset 6) + (x-offset 27) (y-offset 31) (mirror-action "idle-right"))) @@ -428,7 +428,7 @@ (action (name "walk-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "walk-right")) @@ -442,7 +442,7 @@ (action (name "stand-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "stand-right")) @@ -456,7 +456,7 @@ (action (name "jump-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 30) (mirror-action "jump-right")) @@ -470,7 +470,7 @@ (action (name "duck-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 62) (mirror-action "duck-right")) @@ -483,7 +483,7 @@ (action (name "skid-left") (fps 15.0) - (x-offset 6) + (x-offset 27) (y-offset 31) (mirror-action "skid-right")) @@ -496,7 +496,7 @@ (action (name "kick-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "kick-right")) @@ -509,7 +509,7 @@ (action (name "buttjump-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "buttjump-right"))) @@ -531,7 +531,7 @@ (action (name "walk-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "walk-right")) @@ -545,7 +545,7 @@ (action (name "stand-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "stand-right")) @@ -559,7 +559,7 @@ (action (name "jump-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 30) (mirror-action "jump-right")) @@ -573,7 +573,7 @@ (action (name "duck-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 62) (mirror-action "duck-right")) @@ -585,7 +585,7 @@ (action (name "skid-left") - (x-offset 6) + (x-offset 27) (y-offset 31) (mirror-action "skid-right")) @@ -597,7 +597,7 @@ (action (name "kick-left") - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "kick-right")) @@ -609,7 +609,7 @@ (action (name "buttjump-left") - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "buttjump-right"))) @@ -629,7 +629,7 @@ (action (name "walk-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "walk-right")) @@ -643,7 +643,7 @@ (action (name "stand-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "stand-right")) @@ -657,7 +657,7 @@ (action (name "jump-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 30) (mirror-action "jump-right")) @@ -666,12 +666,12 @@ (fps 15.0) (x-offset 5) (y-offset 62) - (images "shared/bigtux/head-fire-stand-0.png")) + (images "shared/bigtux/head-duck-0.png")) (action (name "duck-left") (fps 15.0) - (x-offset 5) + (x-offset 27) (y-offset 62) (mirror-action "duck-right")) @@ -683,7 +683,7 @@ (action (name "skid-left") - (x-offset 6) + (x-offset 27) (y-offset 31) (mirror-action "skid-right")) @@ -695,7 +695,7 @@ (action (name "kick-left") - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "kick-right")) @@ -707,7 +707,7 @@ (action (name "buttjump-left") - (x-offset 5) + (x-offset 27) (y-offset 32) (mirror-action "buttjump-right")) @@ -722,7 +722,7 @@ (action (name "idle-left") (fps 1.0) - (x-offset 6) + (x-offset 27) (y-offset 31) (mirror-action "idle-right"))) |
From: Ricardo C. <rm...@us...> - 2004-10-09 22:56:07
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19917/src Modified Files: leveleditor.cpp Log Message: Got rid of some of the debugging messages. Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.156 retrieving revision 1.157 diff -u -d -r1.156 -r1.157 --- leveleditor.cpp 9 Oct 2004 22:49:39 -0000 1.156 +++ leveleditor.cpp 9 Oct 2004 22:55:56 -0000 1.157 @@ -65,10 +65,7 @@ subset_menu->additem(MN_HL,"",0,0); int i = 0; for(std::set<std::string>::iterator it = level_subsets.begin(); it != level_subsets.end(); ++it, ++i) -{ -std::cerr << "adding entry level subset " << i << " entry: " << (*it) << std::endl; subset_menu->additem(MN_ACTION, (*it),0,0,i); -} subset_menu->additem(MN_HL,"",0,0); subset_menu->additem(MN_BACK,_("Back"),0,0); @@ -295,7 +292,6 @@ std::set<std::string>::iterator it = level_subsets.begin(); for(int t = 0; t < i; t++) it++; -std::cerr << "load subset level_subsets " << i << ": " << (*it) << std::endl; load_level_subset(*it); Menu::set_current(0); } @@ -705,8 +701,6 @@ void LevelEditor::load_level_subset(std::string filename) { -std::cerr << "loading subset...\n"; -std::cerr << "filename: " << filename << std::endl; delete level_subset; level_subset = new LevelSubset(); level_subset->load(filename.c_str()); @@ -749,8 +743,6 @@ } level_nb = nb; -std::cerr << "level_nb: " << level_nb << std::endl; -std::cerr << "level_subset->get_level_filename(level_nb): " << level_subset->get_level_filename(level_nb) << std::endl; level_filename = level_subset->get_level_filename(level_nb); load_level(level_filename); @@ -827,7 +819,6 @@ void LevelEditor::save_level() { -std::cerr << "saving level...\n"; level->save(level_filename); level_changed = false; } |
From: Ricardo C. <rm...@us...> - 2004-10-09 22:55:11
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19726/src Modified Files: title.cpp Log Message: Fixed crash when exiting level editor. Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.124 retrieving revision 1.125 diff -u -d -r1.124 -r1.125 --- title.cpp 9 Oct 2004 21:25:09 -0000 1.124 +++ title.cpp 9 Oct 2004 22:54:58 -0000 1.125 @@ -78,7 +78,7 @@ static std::set<std::string> worldmap_list; -static LevelEditor* leveleditor; +static FrameRate frame_rate(100); void update_load_save_game_menu(Menu* pmenu) { @@ -238,6 +238,20 @@ } } +/* If the demo was stopped - because game started, level + editor was excuted, etc - call this when you get back + to the title code. + */ +void resume_demo() +{ + // FIXME: shouldn't be needed if GameSession + // didn't relay on global variables + titlesession->get_current_sector()->activate(); + titlesession->set_current(); + + frame_rate.update(); +} + void draw_demo(double frame_ratio) { Sector* world = titlesession->get_current_sector(); @@ -287,10 +301,10 @@ /* --- TITLE SCREEN --- */ void title(void) { - random_timer.init(true); - walking = true; + LevelEditor* leveleditor; + random_timer.init(true); Ticks::pause_init(); titlesession = new GameSession(datadir + "/levels/misc/menu.stl", ST_GL_DEMO_GAME); @@ -309,7 +323,6 @@ /* --- Main title loop: --- */ frame = 0; - FrameRate frame_rate(100); frame_rate.set_frame_limit(false); random_timer.start(rand() % 2000 + 2000); @@ -381,7 +394,7 @@ leveleditor->run(); delete leveleditor; Menu::set_current(main_menu); - frame_rate.update(); + resume_demo(); break; case MNID_CREDITS: display_text_file("CREDITS", SCROLL_SPEED_CREDITS, white_big_text , white_text, white_small_text, blue_text ); @@ -414,15 +427,11 @@ update_load_save_game_menu(load_game_menu); Menu::set_current(main_menu); - frame_rate.update(); + resume_demo(); } else if (process_load_game_menu()) { - // FIXME: shouldn't be needed if GameSession doesn't relay on global variables - titlesession->get_current_sector()->activate(); - titlesession->set_current(); - //titletux.level_begin(); - frame_rate.update(); + resume_demo(); } } else if(menu == contrib_menu) |
From: Ricardo C. <rm...@us...> - 2004-10-09 22:49:50
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18855/src Modified Files: leveleditor.h leveleditor.cpp Log Message: Bugfix: change of level or level_subset is possible now. This should make Level Editor usable. Index: leveleditor.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- leveleditor.h 8 Oct 2004 11:07:38 -0000 1.20 +++ leveleditor.h 9 Oct 2004 22:49:39 -0000 1.21 @@ -105,7 +105,7 @@ void load_buttons_gfx(); void free_buttons_gfx(); - Level level; + Level* level; std::string level_filename; Sector* sector; // current sector @@ -113,7 +113,7 @@ std::string sector_name; std::set<std::string> level_subsets; - LevelSubset level_subset; + LevelSubset* level_subset; int level_nb; Menu* main_menu; Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.155 retrieving revision 1.156 diff -u -d -r1.155 -r1.156 --- leveleditor.cpp 9 Oct 2004 21:04:23 -0000 1.155 +++ leveleditor.cpp 9 Oct 2004 22:49:39 -0000 1.156 @@ -49,6 +49,8 @@ level_name_timer.init(true); selection_end = selection_ini = Vector(0,0); left_button = middle_button = mouse_moved = false; +level = 0; +level_subset = 0; cur_layer = LAYER_TILES; level_changed = false; @@ -169,6 +171,9 @@ delete create_subset_menu; delete main_menu; delete settings_menu; + +delete level; +delete level_subset; } void LevelEditor::load_buttons_gfx() @@ -267,10 +272,13 @@ else if(create_subset_menu->check() == MN_ID_CREATE_SUBSET) { // applying settings: LevelSubset::create(create_subset_menu->get_item_by_id(MN_ID_FILENAME_SUBSET).input); - level_subset.load(create_subset_menu->get_item_by_id(MN_ID_FILENAME_SUBSET).input); - level_subset.title = create_subset_menu->item[MN_ID_TITLE_SUBSET].input; - level_subset.description = create_subset_menu->item[MN_ID_DESCRIPTION_SUBSET].input; + delete level_subset; + level_subset = new LevelSubset(); + level_subset->load(create_subset_menu->get_item_by_id(MN_ID_FILENAME_SUBSET).input); + + level_subset->title = create_subset_menu->item[MN_ID_TITLE_SUBSET].input; + level_subset->description = create_subset_menu->item[MN_ID_DESCRIPTION_SUBSET].input; load_level(1); @@ -298,8 +306,8 @@ { // applying settings: level_changed = true; - level.name = settings_menu->get_item_by_id(MN_ID_NAME).input; - level.author = settings_menu->get_item_by_id(MN_ID_AUTHOR).input; + level->name = settings_menu->get_item_by_id(MN_ID_NAME).input; + level->author = settings_menu->get_item_by_id(MN_ID_AUTHOR).input; solids->resize(atoi(settings_menu->get_item_by_id(MN_ID_WIDTH).input.c_str()), atoi(settings_menu->get_item_by_id(MN_ID_HEIGHT).input.c_str())); @@ -341,17 +349,17 @@ Menu::set_current(settings_menu); break; case BT_NEXT_LEVEL: - if(level_nb+1 < level_subset.get_num_levels()) + if(level_nb+1 < level_subset->get_num_levels()) load_level(level_nb + 1); else { - Level new_lev; char str[1024]; sprintf(str,_("Level %d doesn't exist. Create it?"), level_nb + 1); if(confirm_dialog(NULL, str)) { - level_subset.add_level("new_level.stl"); - new_lev.save(level_subset.get_level_filename(level_nb + 1)); + Level new_lev; + level_subset->add_level("new_level.stl"); + new_lev.save(level_subset->get_level_filename(level_nb + 1)); load_level(level_nb); } } @@ -362,12 +370,12 @@ break; case BT_NEXT_SECTOR: std::cerr << "next sector.\n"; -std::cerr << "total sectors: " << level.get_total_sectors() << std::endl; - load_sector(level.get_next_sector(sector)); +std::cerr << "total sectors: " << level->get_total_sectors() << std::endl; + load_sector(level->get_next_sector(sector)); break; case BT_PREVIOUS_SECTOR: std::cerr << "previous sector.\n"; - load_sector(level.get_previous_sector(sector)); + load_sector(level->get_previous_sector(sector)); break; } level_options->set_unselected(); @@ -561,11 +569,11 @@ if(level_name_timer.get_left() < FADING_TIME) context.set_alpha(level_name_timer.get_left() * 255 / FADING_TIME); - context.draw_text(gold_text, level.name, Vector(screen->w/2, 30), CENTER_ALLIGN, LAYER_GUI); + context.draw_text(gold_text, level->name, Vector(screen->w/2, 30), CENTER_ALLIGN, LAYER_GUI); if(level_nb != -1) { char str[128]; - sprintf(str, "%i/%i", level_nb+1, level_subset.get_num_levels()); + sprintf(str, "%i/%i", level_nb+1, level_subset->get_num_levels()); context.draw_text(gold_text, str, Vector(screen->w/2, 50), CENTER_ALLIGN, LAYER_GUI); } @@ -699,7 +707,9 @@ { std::cerr << "loading subset...\n"; std::cerr << "filename: " << filename << std::endl; -level_subset.load(filename.c_str()); +delete level_subset; +level_subset = new LevelSubset(); +level_subset->load(filename.c_str()); load_level(1); } @@ -714,15 +724,18 @@ } level_filename = filename; -level.load(filename); + +delete level; +level = new Level(); +level->load(filename); load_sector("main"); level_name_timer.start(3000); scroll.x = scroll.y = 0; level_changed = false; -settings_menu->get_item_by_id(MN_ID_NAME).change_input(level.name.c_str()); -settings_menu->get_item_by_id(MN_ID_AUTHOR).change_input(level.author.c_str()); +settings_menu->get_item_by_id(MN_ID_NAME).change_input(level->name.c_str()); +settings_menu->get_item_by_id(MN_ID_AUTHOR).change_input(level->author.c_str()); } void LevelEditor::load_level(int nb) @@ -737,8 +750,8 @@ level_nb = nb; std::cerr << "level_nb: " << level_nb << std::endl; -std::cerr << "level_subset.get_level_filename(level_nb): " << level_subset.get_level_filename(level_nb) << std::endl; -level_filename = level_subset.get_level_filename(level_nb); +std::cerr << "level_subset->get_level_filename(level_nb): " << level_subset->get_level_filename(level_nb) << std::endl; +level_filename = level_subset->get_level_filename(level_nb); load_level(level_filename); } @@ -746,7 +759,7 @@ void LevelEditor::load_sector(std::string name) { sector_name = name; -sector = level.get_sector(sector_name); +sector = level->get_sector(sector_name); if(!sector) Termination::abort("Level has no " + sector_name + " sector.", ""); @@ -760,7 +773,7 @@ if(confirm_dialog(NULL, _("No more sectors exist. Create another?"))) { Sector* nsector = new Sector(); - level.add_sector(nsector); + level->add_sector(nsector); sector = nsector; } return; @@ -815,7 +828,7 @@ void LevelEditor::save_level() { std::cerr << "saving level...\n"; -level.save(level_filename); +level->save(level_filename); level_changed = false; } |
From: Ricardo C. <rm...@us...> - 2004-10-09 21:27:53
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1285/src Modified Files: level_subset.h Log Message: Just took out unncessary declaration. Index: level_subset.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level_subset.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- level_subset.h 9 Oct 2004 21:25:09 -0000 1.6 +++ level_subset.h 9 Oct 2004 21:27:30 -0000 1.7 @@ -27,10 +27,6 @@ using namespace SuperTux; -namespace SuperTux { -class Surface; -}; - /** This type holds meta-information about a level-subset. It could be extended to handle manipulation of subsets. */ class LevelSubset |
From: Ricardo C. <rm...@us...> - 2004-10-09 21:25:26
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv695/src Modified Files: level_subset.h level_subset.cpp title.cpp Log Message: Added a "hide-from-contribs" tag for info files. Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.123 retrieving revision 1.124 diff -u -d -r1.123 -r1.124 --- title.cpp 9 Oct 2004 15:32:06 -0000 1.123 +++ title.cpp 9 Oct 2004 21:25:09 -0000 1.124 @@ -74,6 +74,7 @@ static std::vector<LevelSubset*> contrib_subsets; static LevelSubset* current_contrib_subset = 0; +static int first_level_index; static std::set<std::string> worldmap_list; @@ -111,16 +112,7 @@ contrib_menu->additem(MN_LABEL,_("Contrib Levels"),0,0); contrib_menu->additem(MN_HL,"",0,0); int i = 0; - for (std::set<std::string>::iterator it = level_subsets.begin(); it != level_subsets.end(); ++it) - { - LevelSubset* subset = new LevelSubset(); - subset->load(*it); - contrib_menu->additem(MN_GOTO, subset->title, 0, contrib_subset_menu, i); - contrib_subsets.push_back(subset); - ++i; - } - i = level_subsets.size(); for(std::set<std::string>::iterator it = worldmap_list.begin(); it != worldmap_list.end(); ++it) { WorldMapNS::WorldMap worldmap; @@ -130,6 +122,23 @@ } contrib_menu->additem(MN_HL,"",0,0); + + first_level_index = i; + for (std::set<std::string>::iterator it = level_subsets.begin(); it != level_subsets.end(); ++it) + { + LevelSubset* subset = new LevelSubset(); + subset->load(*it); + if(subset->hide_from_contribs) + { + delete subset; + continue; + } + contrib_menu->additem(MN_GOTO, subset->title, 0, contrib_subset_menu, i); + contrib_subsets.push_back(subset); + ++i; + } + + contrib_menu->additem(MN_HL,"",0,0); contrib_menu->additem(MN_BACK,_("Back"),0,0); level_subsets.clear(); @@ -143,8 +152,32 @@ if (index == -1) return; - if (index < (int)contrib_subsets.size()) + if((unsigned)index < worldmap_list.size()) + { + WorldMapNS::WorldMap worldmap; + std::set<std::string>::iterator it = worldmap_list.begin(); + for(int i = index; i > 0; --i) + ++it; + + std::string map_filename = *it; + + worldmap.set_map_filename(map_filename); + + // hack to erase the extension + unsigned int ext_pos = it->find_last_of("."); + if(ext_pos != std::string::npos) + map_filename.erase(ext_pos, map_filename.size() - ext_pos); + + // TODO: slots should be available for contrib maps + worldmap.loadgame(st_save_dir + "/" + map_filename + "-slot1.stsg"); + + worldmap.display(); // run the map + + Menu::set_current(main_menu); + } + else if (index < (int)contrib_subsets.size() + first_level_index) { + index -= first_level_index; if (current_subset != index) { current_subset = index; @@ -183,29 +216,6 @@ titlesession->set_current(); } } - else if((unsigned)index < worldmap_list.size() + (int)contrib_subsets.size()) - { - WorldMapNS::WorldMap worldmap; - std::set<std::string>::iterator it = worldmap_list.begin(); - for(int i = index - contrib_subsets.size(); i > 0; --i) - ++it; - - std::string map_filename = *it; - - worldmap.set_map_filename(map_filename); - - // hack to erase the extension - unsigned int ext_pos = it->find_last_of("."); - if(ext_pos != std::string::npos) - map_filename.erase(ext_pos, map_filename.size() - ext_pos); - - // TODO: slots should be available for contrib maps - worldmap.loadgame(st_save_dir + "/" + map_filename + "-slot1.stsg"); - - worldmap.display(); // run the map - - Menu::set_current(main_menu); - } } void check_contrib_subset_menu() Index: level_subset.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level_subset.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- level_subset.cpp 9 Oct 2004 15:32:06 -0000 1.12 +++ level_subset.cpp 9 Oct 2004 21:25:09 -0000 1.13 @@ -52,6 +52,7 @@ new_subset.name = subset_name; new_subset.title = "Unknown Title"; new_subset.description = "No description so far."; + new_subset.hide_from_contribs = false; new_subset.save(); } @@ -67,6 +68,8 @@ reader.read_string("title", title, true); reader.read_string("description", description, true); reader.read_string_vector("levels", levels); + hide_from_contribs = false; + reader.read_bool("hide-from-contribs", hide_from_contribs); } else { @@ -154,6 +157,9 @@ /* Save the description: */ fprintf(fi," (description \"%s\")\n", description.c_str()); + /* Save the hide from Contrbis menu boolean: */ + fprintf(fi," (hide-from-contribs \"%s\")\n", hide_from_contribs ? "#t" : "#f"); + fprintf( fi,")"); fclose(fi); } Index: level_subset.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level_subset.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- level_subset.h 24 Sep 2004 15:10:10 -0000 1.5 +++ level_subset.h 9 Oct 2004 21:25:09 -0000 1.6 @@ -59,7 +59,7 @@ std::string name; std::string title; std::string description; - Surface* image; + bool hide_from_contribs; private: void read_info_file(const std::string& info_file); |
From: Ricardo C. <rm...@us...> - 2004-10-09 21:04:51
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28449/src Modified Files: leveleditor.cpp Log Message: Bugfix: its finally possible to open a levelsubset. However, there seems to exist problems with changing levels and levelsubsets. I'll look at these issues later. Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.154 retrieving revision 1.155 diff -u -d -r1.154 -r1.155 --- leveleditor.cpp 8 Oct 2004 21:59:25 -0000 1.154 +++ leveleditor.cpp 9 Oct 2004 21:04:23 -0000 1.155 @@ -341,7 +341,7 @@ Menu::set_current(settings_menu); break; case BT_NEXT_LEVEL: - if(level_nb < level_subset.get_num_levels()) + if(level_nb+1 < level_subset.get_num_levels()) load_level(level_nb + 1); else { @@ -357,7 +357,7 @@ } break; case BT_PREVIOUS_LEVEL: - if(level_nb > 1) + if(level_nb-1 > 0) load_level(level_nb - 1); break; case BT_NEXT_SECTOR: @@ -557,11 +557,9 @@ if(level_name_timer.check()) { + context.push_transform(); if(level_name_timer.get_left() < FADING_TIME) - { - context.push_transform(); context.set_alpha(level_name_timer.get_left() * 255 / FADING_TIME); - } context.draw_text(gold_text, level.name, Vector(screen->w/2, 30), CENTER_ALLIGN, LAYER_GUI); if(level_nb != -1) @@ -571,8 +569,7 @@ context.draw_text(gold_text, str, Vector(screen->w/2, 50), CENTER_ALLIGN, LAYER_GUI); } - if(level_name_timer.get_left() < FADING_TIME) - context.pop_transform(); + context.pop_transform(); } if(sector) context.draw_text(white_small_text, _("F1 for help"), Vector(5, 510), LEFT_ALLIGN, LAYER_GUI-10); @@ -708,8 +705,13 @@ void LevelEditor::load_level(std::string filename) { -if(!level_changed) - save_level(); +if(level_changed) + { + if(confirm_dialog(NULL, _("Level not saved. Wanna to?"))) + save_level(); + else + return; + } level_filename = filename; level.load(filename); @@ -725,8 +727,13 @@ void LevelEditor::load_level(int nb) { -if(!level_changed) - save_level(); +if(level_changed) + { + if(confirm_dialog(NULL, _("Level not saved. Wanna to?"))) + save_level(); + else + return; + } level_nb = nb; std::cerr << "level_nb: " << level_nb << std::endl; @@ -807,6 +814,7 @@ void LevelEditor::save_level() { +std::cerr << "saving level...\n"; level.save(level_filename); level_changed = false; } |
From: Marek M. <wa...@us...> - 2004-10-09 18:01:14
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22441/src Modified Files: player.cpp player.h Log Message: further tweaked flapping, finally found a speed setting that seems okay Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.187 retrieving revision 1.188 diff -u -d -r1.187 -r1.188 --- player.cpp 8 Oct 2004 23:16:06 -0000 1.187 +++ player.cpp 9 Oct 2004 18:01:01 -0000 1.188 @@ -168,6 +168,8 @@ enable_hover = false; butt_jump = false; + flapping_velocity = 0; + frame_main = 0; frame_ = 0; @@ -584,6 +586,7 @@ if (!flapping_timer.started()) { flapping_timer.start(TUX_FLAPPING_TIME); + flapping_velocity = physic.get_velocity_x(); } if (!flapping_timer.check()) { @@ -592,21 +595,15 @@ } jumping = true; flapping = true; - float iv = physic.get_velocity_x(); //flapping speed depends on initial velocity - //float fv = 1.2; //fixed velocity that is reached when flapping is done - float cv = 0; //current velocity - //if (iv < 0) {fv *= (-1);} //make fv negative or positive depending on direction of iv if (flapping_timer.get_gone() <= TUX_FLAPPING_TIME) { - //TODO: Values okay when running, but that's pure coincidence; they don't depend on iv anymore. - if (iv == 0) {cv = 0;} - //else {cv = (iv-((iv-fv)*(float)flapping_timer.get_gone()/TUX_FLAPPING_TIME));} - else {cv = (sqrt(1000-(float)flapping_timer.get_gone()))/10;} + float cv; + if (flapping_velocity == 0) {cv = 0;} + else {cv = flapping_velocity*(sqrt(TUX_FLAPPING_TIME-(float)flapping_timer.get_gone()))/sqrt(TUX_FLAPPING_TIME);} //Handle change of direction while flapping if (((dir == LEFT) && (cv > 0)) || (dir == RIGHT) && (cv < 0)) {cv *= (-1);} - //std::cout << cv << std::endl; physic.set_velocity_x(cv); - physic.set_velocity_y((float)flapping_timer.get_gone()/800); + physic.set_velocity_y((float)flapping_timer.get_gone()/850); } } Index: player.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.h,v retrieving revision 1.89 retrieving revision 1.90 diff -u -d -r1.89 -r1.90 --- player.h 7 Oct 2004 17:50:21 -0000 1.89 +++ player.h 9 Oct 2004 18:01:02 -0000 1.90 @@ -157,6 +157,8 @@ bool butt_jump; int frame_; int frame_main; + + float flapping_velocity; base_type previous_base; Timer invincible_timer; |
From: Ricardo C. <rm...@us...> - 2004-10-09 15:36:42
|
Update of /cvsroot/super-tux/supertux/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25957/data Modified Files: Makefile.am Log Message: Bugfix: images/shared/smalltux and images/shared/bigtux were not being installed on the system. Bug reported by unDEFER on the mailing list. Index: Makefile.am =================================================================== RCS file: /cvsroot/super-tux/supertux/data/Makefile.am,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- Makefile.am 15 Sep 2004 10:43:19 -0000 1.17 +++ Makefile.am 9 Oct 2004 15:36:31 -0000 1.18 @@ -23,6 +23,8 @@ $(wildcard images/leveleditor/*.png) \ $(wildcard images/map/*.png) \ $(wildcard images/shared/*.png) \ + $(wildcard images/shared/smalltux/*.png) \ + $(wildcard images/shared/bigtux/*.png) \ $(wildcard images/status/*.png) \ $(wildcard images/themes/*/*.png) \ $(wildcard images/worldmap/*.png) \ |
From: Ricardo C. <rm...@us...> - 2004-10-09 15:32:23
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25128/src Modified Files: level_subset.cpp title.cpp Log Message: Don't output level filenames on Contribs. Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.122 retrieving revision 1.123 diff -u -d -r1.122 -r1.123 --- title.cpp 6 Oct 2004 21:37:50 -0000 1.122 +++ title.cpp 9 Oct 2004 15:32:06 -0000 1.123 @@ -167,7 +167,7 @@ if(!reader) { std::cerr << "Error: Could not open level file. Ignoring...\n"; - return; + continue; } reader->read_string("name", level_title, true); Index: level_subset.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level_subset.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- level_subset.cpp 24 Sep 2004 15:10:10 -0000 1.11 +++ level_subset.cpp 9 Oct 2004 15:32:06 -0000 1.12 @@ -169,8 +169,6 @@ LevelSubset::get_level_filename(unsigned int num) { assert(num < levels.size()); - -std::cerr << "levels[" << num << "]: " << levels[num] << std::endl; return directory + levels[num]; } |
From: Ryan F. <sik...@us...> - 2004-10-09 08:19:40
|
Update of /cvsroot/super-tux/supertux/lib/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5668/lib/gui Modified Files: menu.cpp Log Message: - menu patch from Matt Mets Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/menu.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- menu.cpp 16 Sep 2004 15:04:16 -0000 1.14 +++ menu.cpp 9 Oct 2004 08:19:17 -0000 1.15 @@ -325,6 +325,15 @@ Menu::additem(MenuItemKind kind_, const std::string& text_, int toggle_, Menu* menu_, int id, int* int_p) { additem(MenuItem::create(kind_, text_.c_str(), toggle_, menu_, id, int_p)); + + /* If a new menu is being built, the active item shouldn't be set to something + that isnt selectable. Keep setting the active item to the most recently + added item until a selectable entry is found. + */ + if (item[active_item].kind == MN_HL + || item[active_item].kind == MN_LABEL + || item[active_item].kind == MN_DEACTIVE) + active_item = item.size() - 1; } /* Add an item to a menu */ @@ -355,20 +364,33 @@ hit_item = -1; if(item.size() != 0) { + int last_active_item = active_item; switch(menuaction) { case MENU_ACTION_UP: - if (active_item > 0) - --active_item; - else - active_item = int(item.size())-1; + do { + if (active_item > 0) + --active_item; + else + active_item = int(item.size())-1; + } while ((item[active_item].kind == MN_HL + || item[active_item].kind == MN_LABEL + || item[active_item].kind == MN_DEACTIVE) + && (active_item != last_active_item)); + break; case MENU_ACTION_DOWN: - if(active_item < int(item.size())-1) - ++active_item; - else - active_item = 0; + do { + if(active_item < int(item.size())-1 ) + ++active_item; + else + active_item = 0; + } while ((item[active_item].kind == MN_HL + || item[active_item].kind == MN_LABEL + || item[active_item].kind == MN_DEACTIVE) + && (active_item != last_active_item)); + break; case MENU_ACTION_LEFT: @@ -457,23 +479,6 @@ } } - if(active_item > 0 && active_item < (int)item.size()) - { - // FIXME: wtf?! having a hack to avoid horizontal lines... - // Elegant solution would be to check for horizontal lines, right - // when it was asked to move menu up and down - if(item[active_item].kind == MN_DEACTIVE || - item[active_item].kind == MN_LABEL || - item[active_item].kind == MN_HL) - { - // Skip the horzontal line item - if (menuaction != MENU_ACTION_UP && menuaction != MENU_ACTION_DOWN) - menuaction = MENU_ACTION_DOWN; - - if (item.size() > 1) - action(); - } - } menuaction = MENU_ACTION_NONE; @@ -888,14 +893,21 @@ y > pos_y - get_height()/2 && y < pos_y + get_height()/2) { - active_item = (y - (pos_y - get_height()/2)) / 24; - if(MouseCursor::current()) - MouseCursor::current()->set_state(MC_LINK); + int new_active_item = (y - (pos_y - get_height()/2)) / 24; + + /* only change the mouse focus to a selectable item */ + if ((item[new_active_item].kind != MN_HL) + && (item[new_active_item].kind != MN_LABEL) + && (item[new_active_item].kind != MN_DEACTIVE)) + active_item = new_active_item; + + if(MouseCursor::current()) + MouseCursor::current()->set_state(MC_LINK); } else { - if(MouseCursor::current()) - MouseCursor::current()->set_state(MC_NORMAL); + if(MouseCursor::current()) + MouseCursor::current()->set_state(MC_NORMAL); } } break; |