super-tux-commit Mailing List for Super Tux (Page 9)
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-12-30 14:39:22
|
Update of /cvsroot/super-tux/supertux/src/badguy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30006/src/badguy Modified Files: nolok_01.cpp Added Files: mrtree.cpp mrtree.h Log Message: added settras MrTree Index: nolok_01.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/nolok_01.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- nolok_01.cpp 30 Dec 2004 11:29:52 -0000 1.10 +++ nolok_01.cpp 30 Dec 2004 14:39:08 -0000 1.11 @@ -32,12 +32,12 @@ void Nolok_01::write(lisp::Writer& writer) { - writer.start_list("nolok01"); + writer.start_list("nolok_01"); writer.write_float("x", start_position.x); writer.write_float("y", start_position.y); - writer.end_list("nolok01"); + writer.end_list("nolok_01"); } void --- NEW FILE: mrtree.cpp --- #include <config.h> #include "mrtree.h" static const float WALKSPEED = 50; MrTree::MrTree(const lisp::Lisp& reader) : mystate(STATE_BIG) { reader.get("x", start_position.x); reader.get("y", start_position.y); bbox.set_size(84.8, 95.8); sprite = sprite_manager->create("mrtree"); } void MrTree::write(lisp::Writer& writer) { writer.start_list("mrtree"); writer.write_float("x", start_position.x); writer.write_float("y", start_position.y); writer.end_list("mrtree"); } void MrTree::activate() { physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED); if(mystate == STATE_BIG) sprite->set_action(dir == LEFT ? "left" : "right"); else sprite->set_action(dir == LEFT ? "small-left" : "small-right"); } bool MrTree::collision_squished(Player& player) { if(mystate == STATE_BIG) { mystate = STATE_NORMAL; activate(); SoundManager::get()->play_sound(IDToSound(SND_SQUISH), get_pos(), player.get_pos()); player.bounce(*this); } else { sprite->set_action(dir == LEFT ? "squished-left" : "squished-right"); kill_squished(player); } return true; } HitResponse MrTree::collision_solid(GameObject& , const CollisionHit& hit) { if(fabsf(hit.normal.y) > .5) { physic.set_velocity_y(0); } else { dir = dir == LEFT ? RIGHT : LEFT; activate(); } return CONTINUE; } HitResponse MrTree::collision_badguy(BadGuy& , const CollisionHit& hit) { if(fabsf(hit.normal.x) > .8) { // left or right hit dir = dir == LEFT ? RIGHT : LEFT; activate(); } return CONTINUE; } IMPLEMENT_FACTORY(MrTree, "mrtree") --- NEW FILE: mrtree.h --- #ifndef __MRTREE_H__ #define __MRTREE_H__ #include "badguy.h" class MrTree : public BadGuy { public: MrTree(const lisp::Lisp& reader); void activate(); void write(lisp::Writer& writer); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit); protected: enum MyState { STATE_BIG, STATE_NORMAL }; MyState mystate; bool collision_squished(Player& player); }; #endif |
From: Matze B. <mat...@us...> - 2004-12-30 14:39:16
|
Update of /cvsroot/super-tux/supertux/data/images/shared In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30006/data/images/shared Added Files: mrtree-small-left-0.png mrtree-small-left-1.png mrtree-small-left-2.png mrtree-squished-left.png mrtree-walk-left-0.png mrtree-walk-left-1.png mrtree-walk-left-2.png Log Message: added settras MrTree --- NEW FILE: mrtree-small-left-0.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mrtree-small-left-1.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mrtree-small-left-2.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mrtree-walk-left-0.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mrtree-walk-left-2.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mrtree-walk-left-1.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mrtree-squished-left.png --- (This appears to be a binary file; contents omitted.) |
From: Matze B. <mat...@us...> - 2004-12-30 14:39:16
|
Update of /cvsroot/super-tux/supertux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30006 Modified Files: AUTHORS Log Message: added settras MrTree Index: AUTHORS =================================================================== RCS file: /cvsroot/super-tux/supertux/AUTHORS,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- AUTHORS 10 Dec 2004 20:29:12 -0000 1.9 +++ AUTHORS 30 Dec 2004 14:39:06 -0000 1.10 @@ -62,6 +62,8 @@ Benjamin P. Jung bp...@gm... + Settra + Level Design ------------ |
From: Matze B. <mat...@us...> - 2004-12-30 14:39:16
|
Update of /cvsroot/super-tux/supertux/data/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30006/data/images Modified Files: supertux.strf Log Message: added settras MrTree Index: supertux.strf =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/supertux.strf,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- supertux.strf 29 Dec 2004 23:35:46 -0000 1.30 +++ supertux.strf 30 Dec 2004 14:39:07 -0000 1.31 @@ -1326,6 +1326,45 @@ (images "tilesets/bonus2-d.png")) ) + (sprite (name "mrtree") + (action + (y-offset -3) + (fps 5) + (name "left") + (images "shared/mrtree-walk-left-0.png" + "shared/mrtree-walk-left-1.png" + "shared/mrtree-walk-left-2.png") + ) + (action + (y-offset -3) + (fps 5) + (name "right") + (mirror-action "left") + ) + (action + (y-offset -3) + (name "small-left") + (images "shared/mrtree-small-left-0.png" + "shared/mrtree-small-left-1.png" + "shared/mrtree-small-left-2.png") + ) + (action + (y-offset -3) + (name "small-right") + (mirror-action "small-left") + ) + (action + (y-offset -6) + (name "squished-left") + (images "shared/mrtree-squished-left.png") + ) + (action + (y-offset -6) + (name "squished-right") + (mirror-action "squished-left") + ) + ) + ; Stomp (sprite (name "stomp") (action |
From: Marek M. <wa...@us...> - 2004-12-30 11:30:02
|
Update of /cvsroot/super-tux/supertux/src/trigger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25557/src/trigger Modified Files: secretarea_trigger.cpp Log Message: badguys can now have multiple hitpoints (default is 1) gave Nolok 3 hitpoints Index: secretarea_trigger.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/trigger/secretarea_trigger.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- secretarea_trigger.cpp 1 Dec 2004 23:26:31 -0000 1.7 +++ secretarea_trigger.cpp 30 Dec 2004 11:29:52 -0000 1.8 @@ -71,3 +71,5 @@ } } } + +//IMPLEMENT_FACTORY(SecretAreaTrigger, "secretarea_trigger") |
From: Marek M. <wa...@us...> - 2004-12-30 11:30:02
|
Update of /cvsroot/super-tux/supertux/data/levels/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25557/data/levels/test Modified Files: noloktest.stl Log Message: badguys can now have multiple hitpoints (default is 1) gave Nolok 3 hitpoints Index: noloktest.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/noloktest.stl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- noloktest.stl 20 Dec 2004 00:16:29 -0000 1.7 +++ noloktest.stl 30 Dec 2004 11:29:52 -0000 1.8 @@ -51,6 +51,7 @@ (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)) + (jumpy (x 500) (y 400)) (tilemap (layer "background") (solid #f) |
From: Marek M. <wa...@us...> - 2004-12-30 11:30:01
|
Update of /cvsroot/super-tux/supertux/src/badguy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25557/src/badguy Modified Files: badguy.cpp badguy.h nolok_01.cpp Log Message: badguys can now have multiple hitpoints (default is 1) gave Nolok 3 hitpoints Index: badguy.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/badguy.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- badguy.h 20 Dec 2004 21:24:25 -0000 1.5 +++ badguy.h 30 Dec 2004 11:29:52 -0000 1.6 @@ -91,6 +91,8 @@ Vector start_position; Direction dir; + + int hitpoints; private: void try_activate(); Index: nolok_01.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/nolok_01.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- nolok_01.cpp 20 Dec 2004 21:24:27 -0000 1.9 +++ nolok_01.cpp 30 Dec 2004 11:29:52 -0000 1.10 @@ -7,10 +7,11 @@ #define WALK_TIME 2.5 #define SHOOT_TIME 0.4 #define JUMP_TIME 0.5 +#define INITIAL_HITPOINTS 3 static const float WALKSPEED = 90; -//TODO: Create sprite, give multiple hitpoints, limit max number of snowballs +//TODO: Create sprite, limit max number of snowballs // Stop actions when pause button is hit (probably a general problem of timers) Nolok_01::Nolok_01(const lisp::Lisp& reader) { @@ -42,6 +43,7 @@ void Nolok_01::activate() { + hitpoints = INITIAL_HITPOINTS; physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED); sprite->set_action(dir == LEFT ? "left" : "right"); action = WALKING; @@ -86,10 +88,15 @@ bool Nolok_01::collision_squished(Player& player) { - sprite->set_action("dead"); - kill_squished(player); - Sector::current()->add_object(new Door((int)get_pos().x+32, 512, "sector1", "main2")); - return true; + bool result = false; + player.bounce(*this); + if (hitpoints <= 0) { + sprite->set_action("dead"); + kill_squished(player); + Sector::current()->add_object(new Door((int)get_pos().x+32, 512, "sector1", "main2")); + result = true; + } + return result; } HitResponse @@ -106,4 +113,4 @@ return CONTINUE; } -IMPLEMENT_FACTORY(Nolok_01, "nolok01") +IMPLEMENT_FACTORY(Nolok_01, "nolok_01") Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/badguy.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- badguy.cpp 5 Dec 2004 16:57:14 -0000 1.9 +++ badguy.cpp 30 Dec 2004 11:29:52 -0000 1.10 @@ -10,6 +10,7 @@ BadGuy::BadGuy() : sprite(0), dir(LEFT), state(STATE_INIT) { + hitpoints = 1; } BadGuy::~BadGuy() @@ -131,8 +132,17 @@ return ABORT_MOVE; } if(hit.normal.y > .9) { + //TODO: fix inaccuracy (tux sometimes dies even if badguy was hit) + // give badguys some invincible time (prevent them from being hit multiple times) + // use hitpoints also when hit by fireball or invincible tux + hitpoints--; + std::cout << "Hitpoints: " << hitpoints << std::endl; if(collision_squished(player)) return ABORT_MOVE; + else if (hitpoints <= 0) { + player.kill(Player::SHRINK); + return FORCE_MOVE; + } } player.kill(Player::SHRINK); return FORCE_MOVE; |
From: Matze B. <mat...@us...> - 2004-12-29 23:36:04
|
Update of /cvsroot/super-tux/supertux/data/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28368 Modified Files: supertux.strf Log Message: oopsy accidently removed invisibleblock in my last commit Index: supertux.strf =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/supertux.strf,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- supertux.strf 19 Dec 2004 13:34:09 -0000 1.29 +++ supertux.strf 29 Dec 2004 23:35:46 -0000 1.30 @@ -1320,6 +1320,12 @@ (images "tilesets/block11.png")) ) + (sprite (name "invisibleblock") + (action + (name "empty") + (images "tilesets/bonus2-d.png")) + ) + ; Stomp (sprite (name "stomp") (action |
From: Marek M. <wa...@us...> - 2004-12-28 11:05:54
|
Update of /cvsroot/super-tux/supertux/data/images/shared In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16516/data/images/shared Added Files: powerstomp.png Log Message: added an attempt to design a "buttstomp-amplifier" powerup feel free to redesign/modify/delete :-) --- NEW FILE: powerstomp.png --- (This appears to be a binary file; contents omitted.) |
From: Matze B. <mat...@us...> - 2004-12-20 21:36:06
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31819/src Modified Files: leveleditor.cpp object_factory.cpp object_factory.h Log Message: create lisp code on the fly (still no enemies showing up in editor, no idea why...) also incorporated another patch from Ondra which brings back the jumpy animations Index: object_factory.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object_factory.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- object_factory.h 20 Dec 2004 21:24:25 -0000 1.1 +++ object_factory.h 20 Dec 2004 21:35:36 -0000 1.2 @@ -35,12 +35,6 @@ * Remember to delete the objects later */ virtual GameObject* create_object(const lisp::Lisp& reader) = 0; - - // hack for now will be removed later - virtual GameObject* create_object(const Vector& ) - { - return 0; - } }; typedef std::map<std::string, Factory*> Factories; Index: object_factory.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object_factory.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- object_factory.cpp 20 Dec 2004 21:24:25 -0000 1.1 +++ object_factory.cpp 20 Dec 2004 21:35:36 -0000 1.2 @@ -21,6 +21,8 @@ #include <sstream> #include <stdexcept> +#include "lisp/lisp.h" +#include "lisp/parser.h" #include "object_factory.h" Factories* object_factories = 0; @@ -37,3 +39,14 @@ return i->second->create_object(reader); } +GameObject* create_object(const std::string& name, const Vector& pos) +{ + std::stringstream lisptext; + lisptext << "(" << name + << " (x " << pos.x << ")" + << " (y " << pos.y << "))"; + + lisp::Parser parser; + std::auto_ptr<lisp::Lisp> lisp (parser.parse(lisptext)); + return create_object(name, *lisp); +} Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.175 retrieving revision 1.176 diff -u -d -r1.175 -r1.176 --- leveleditor.cpp 20 Dec 2004 21:24:22 -0000 1.175 +++ leveleditor.cpp 20 Dec 2004 21:35:36 -0000 1.176 @@ -861,7 +861,7 @@ for(Factories::iterator i = object_factories->begin(); i != object_factories->end(); ++i) { if(id == newtile - gameobjs_first_id) { - object = i->second->create_object(Vector(x, y)); + object = create_object(i->first, Vector(x, y)); break; } id++; |
From: Matze B. <mat...@us...> - 2004-12-20 21:36:06
|
Update of /cvsroot/super-tux/supertux/src/badguy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31819/src/badguy Modified Files: jumpy.cpp Log Message: create lisp code on the fly (still no enemies showing up in editor, no idea why...) also incorporated another patch from Ondra which brings back the jumpy animations Index: jumpy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/jumpy.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- jumpy.cpp 20 Dec 2004 21:24:27 -0000 1.8 +++ jumpy.cpp 20 Dec 2004 21:35:37 -0000 1.9 @@ -3,6 +3,8 @@ #include "jumpy.h" static const float JUMPSPEED=600; +static const float JUMPY_MID_TOLERANCE=8; +static const float JUMPY_LOW_TOLERANCE=2; Jumpy::Jumpy(const lisp::Lisp& reader) { @@ -56,7 +58,13 @@ dir = Sector::current()->player->get_pos().x > get_pos().x ? RIGHT : LEFT; //FIXME: add middle and up here - sprite->set_action(dir == LEFT ? "left-down" : "right-down"); + + if ( get_pos().y >= (start_position.y - JUMPY_MID_TOLERANCE) ) + sprite->set_action(dir == LEFT ? "left-middle" : "right-middle"); + else if ( get_pos().y >= (start_position.y - JUMPY_LOW_TOLERANCE) ) + sprite->set_action(dir == LEFT ? "left-down" : "right-down"); + else + sprite->set_action(dir == LEFT ? "left-up" : "right-up"); } IMPLEMENT_FACTORY(Jumpy, "jumpy") |
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28891/src Modified Files: leveleditor.cpp misc.h resources.cpp sector.cpp Added Files: object_factory.cpp object_factory.h Removed Files: gameobjs_bridge.cpp gameobjs_bridge.h Log Message: implemented a new object factory mechanism which is now really independent of the objects --- NEW FILE: object_factory.h --- // $Id: object_factory.h,v 1.1 2004/12/20 21:24:25 matzebraun Exp $ // // SuperTux - A Jump'n Run // Copyright (C) 2004 Ricardo Cruz <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. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef OBJECT_FACTORY_H #define OBJECT_FACTORY_H #include <string> #include <map> #include "lisp/lisp.h" #include "special/game_object.h" #include "math/vector.h" using namespace SuperTux; class Factory { public: /** Creates a new gameobject from a lisp node. * Remember to delete the objects later */ virtual GameObject* create_object(const lisp::Lisp& reader) = 0; // hack for now will be removed later virtual GameObject* create_object(const Vector& ) { return 0; } }; typedef std::map<std::string, Factory*> Factories; extern Factories* object_factories; GameObject* create_object(const std::string& name, const lisp::Lisp& reader); GameObject* create_object(const std::string& name, const Vector& pos); /** comment from Matze: * Yes I know macros are evil, but in this specific case they save * A LOT of typing and evil code duplication. * I'll happily acceppt alternatives if someone can present me one that does * not involve typing 4 or more lines for each object class */ #define IMPLEMENT_FACTORY(CLASS, NAME) \ class INTERN_##CLASS##Factory : public Factory \ { \ public: \ INTERN_##CLASS##Factory() \ { \ if(object_factories == 0) \ object_factories = new Factories; \ \ object_factories->insert(std::make_pair(NAME, this)); \ } \ \ virtual GameObject* create_object(const lisp::Lisp& reader) \ { \ return new CLASS(reader); \ } \ }; \ static INTERN_##CLASS##Factory factory_##CLASS; #endif --- NEW FILE: object_factory.cpp --- // $Id: object_factory.cpp,v 1.1 2004/12/20 21:24:25 matzebraun Exp $ // // SuperTux - A Jump'n Run // Copyright (C) 2004 Ricardo Cruz <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. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <config.h> #include <sstream> #include <stdexcept> #include "object_factory.h" Factories* object_factories = 0; GameObject* create_object(const std::string& name, const lisp::Lisp& reader) { Factories::iterator i = object_factories->find(name); if(i == object_factories->end()) { std::stringstream msg; msg << "No factory for object '" << name << "' found."; throw std::runtime_error(msg.str()); } return i->second->create_object(reader); } Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- sector.cpp 19 Dec 2004 16:57:27 -0000 1.61 +++ sector.cpp 20 Dec 2004 21:24:25 -0000 1.62 @@ -44,30 +44,17 @@ #include "statistics.h" #include "collision_grid.h" #include "collision_grid_iterator.h" +#include "object_factory.h" #include "special/collision.h" #include "math/rectangle.h" #include "math/aatriangle.h" #include "object/coin.h" #include "object/block.h" #include "object/invisible_block.h" -#include "object/platform.h" #include "object/bullet.h" -#include "object/rock.h" #include "badguy/jumpy.h" -#include "badguy/snowball.h" -#include "badguy/bouncing_snowball.h" -#include "badguy/flame.h" -#include "badguy/flyingsnowball.h" -#include "badguy/mriceblock.h" -#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" -#include "trigger/secretarea_trigger.h" -#include "gameobjs_bridge.h" Sector* Sector::_current = 0; @@ -105,14 +92,10 @@ GameObject* Sector::parse_object(const std::string& name, const lisp::Lisp& reader) { - if(name == "background") { - return new Background(reader); - } else if(name == "camera") { + if(name == "camera") { Camera* camera = new Camera(this); camera->parse(reader); return camera; - } else if(name == "tilemap") { - return new TileMap(reader); } else if(name == "particles-snow") { SnowParticleSystem* partsys = new SnowParticleSystem(); partsys->parse(reader); @@ -121,14 +104,16 @@ CloudParticleSystem* partsys = new CloudParticleSystem(); partsys->parse(reader); return partsys; - } else if(name == "secretarea") { - return new SecretAreaTrigger(reader); - } else if(name == "sequencetrigger") { - return new SequenceTrigger(reader); - } else if(is_object(name)) { - return create_object(object_name_to_type(name), reader); - } else - std::cerr << "Unknown object type '" << name << "'.\n"; + } else if(name == "money") { // for compatibility with old maps + return new Jumpy(reader); + } + + try { + return create_object(name, reader); + } catch(std::exception& e) { + std::cerr << e.what() << "\n"; + } + return 0; } --- gameobjs_bridge.cpp DELETED --- Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.174 retrieving revision 1.175 diff -u -d -r1.174 -r1.175 --- leveleditor.cpp 19 Dec 2004 16:57:27 -0000 1.174 +++ leveleditor.cpp 20 Dec 2004 21:24:22 -0000 1.175 @@ -34,11 +34,11 @@ #include "tile_manager.h" #include "sector.h" #include "gameloop.h" +#include "object_factory.h" #include "object/gameobjs.h" #include "object/camera.h" #include "object/tilemap.h" #include "object/background.h" -#include "gameobjs_bridge.h" LevelEditor::LevelEditor() { @@ -119,13 +119,14 @@ } gameobjs_first_id = id; - for(id = 0; id < TOTAL_GAMEOBJECTS; id++) - { + for(Factories::iterator i = object_factories->begin(); + i != object_factories->end(); ++i) { + // Surface *img = badguy.get_image(); // FIXME: get image from object. Using the rubber in the meanwhile. - tiles_board->add_button(Button(img_rubber_bt, object_type_to_string(id), - SDLKey(SDLK_1+id)), id+gameobjs_first_id); - } + tiles_board->add_button(Button(img_rubber_bt, i->first, + SDLKey(SDLK_1+id)), id++); + } tiles_layer = new ButtonGroup(Vector(12, screen->h-64), Vector(80,20), Vector(1,3)); tiles_layer->add_button(Button(img_foreground_bt, _("Edtit foreground tiles"), @@ -844,7 +845,8 @@ level_changed = true; if(zoom != 1) - { // no need to do this for normal view (no zoom) + { + // no need to do this for normal view (no zoom) x = (int)(x * (zoom*32) / 32); y = (int)(y * (zoom*32) / 32); } @@ -854,9 +856,20 @@ // remove an active tile or object that might be there change(x, y, 0, LAYER_TILES); - create_object((GameObjectsType)(newtile-gameobjs_first_id),Vector(x,y)); - - sector->update_game_objects(); + int id = 0; + GameObject* object = 0; + for(Factories::iterator i = object_factories->begin(); i != + object_factories->end(); ++i) { + if(id == newtile - gameobjs_first_id) { + object = i->second->create_object(Vector(x, y)); + break; + } + id++; + } + if(object) { + sector->add_object(object); + sector->update_game_objects(); + } } else if(cur_layer == LAYER_FOREGROUNDTILES) { foregrounds->change(x/32, y/32, newtile); } else if(cur_layer == LAYER_TILES) { --- gameobjs_bridge.h DELETED --- Index: misc.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/misc.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- misc.h 28 Nov 2004 14:56:49 -0000 1.5 +++ misc.h 20 Dec 2004 21:24:25 -0000 1.6 @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // 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_MISC_H #define SUPERTUX_MISC_H @@ -51,4 +50,3 @@ void st_menu_free(); #endif //SUPERTUX_MISC_H - Index: resources.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.cpp,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- resources.cpp 19 Dec 2004 13:34:11 -0000 1.62 +++ resources.cpp 20 Dec 2004 21:24:25 -0000 1.63 @@ -154,7 +154,6 @@ true); /* Sound effects: */ - for (i = 0; i < NUM_SOUNDS; i++) SoundManager::get()->add_sound(SoundManager::get ()->load_sound(datadir + soundfilenames[i]),i); |
From: Matze B. <mat...@us...> - 2004-12-20 21:25:16
|
Update of /cvsroot/super-tux/supertux/data/levels/world1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28891/data/levels/world1 Modified Files: level3.stl Log Message: implemented a new object factory mechanism which is now really independent of the objects Index: level3.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/world1/level3.stl,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- level3.stl 2 Dec 2004 01:41:56 -0000 1.21 +++ level3.stl 20 Dec 2004 21:24:19 -0000 1.22 @@ -121,7 +121,6 @@ (snowball (x 10932) (y 408)) (snowball (x 9969) (y 410)) ) - ) - +) ;; EOF ;; |
From: Matze B. <mat...@us...> - 2004-12-20 21:25:05
|
Update of /cvsroot/super-tux/supertux/lib/lisp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28891/lib/lisp Modified Files: parser.cpp Log Message: implemented a new object factory mechanism which is now really independent of the objects Index: parser.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/lisp/parser.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- parser.cpp 2 Dec 2004 01:41:57 -0000 1.3 +++ parser.cpp 20 Dec 2004 21:24:21 -0000 1.4 @@ -119,8 +119,6 @@ result = new Lisp(Lisp::TYPE_STRING); if(dictionary) { std::string translation = dictionary->translate(lexer->getString()); - std::cout << "Translated '" << lexer->getString() << "' -> '" - << translation << "'\n"; result->v.string = new char[translation.size()+1]; memcpy(result->v.string, translation.c_str(), translation.size()+1); } else { |
From: Matze B. <mat...@us...> - 2004-12-20 21:24:46
|
Update of /cvsroot/super-tux/supertux/src/badguy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28891/src/badguy Modified Files: badguy.h bomb.cpp bouncing_snowball.cpp dispenser.cpp flame.cpp flyingsnowball.cpp jumpy.cpp mrbomb.cpp mriceblock.cpp nolok_01.cpp snowball.cpp spike.cpp spiky.cpp Log Message: implemented a new object factory mechanism which is now really independent of the objects Index: bouncing_snowball.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/bouncing_snowball.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- bouncing_snowball.cpp 2 Dec 2004 00:25:27 -0000 1.8 +++ bouncing_snowball.cpp 20 Dec 2004 21:24:26 -0000 1.9 @@ -81,3 +81,5 @@ return CONTINUE; } +IMPLEMENT_FACTORY(BouncingSnowball, "bouncingsnowball") + Index: mriceblock.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/mriceblock.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- mriceblock.cpp 2 Dec 2004 00:25:27 -0000 1.7 +++ mriceblock.cpp 20 Dec 2004 21:24:27 -0000 1.8 @@ -165,3 +165,4 @@ return true; } +IMPLEMENT_FACTORY(MrIceBlock, "mriceblock") Index: jumpy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/jumpy.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- jumpy.cpp 5 Dec 2004 16:57:14 -0000 1.7 +++ jumpy.cpp 20 Dec 2004 21:24:27 -0000 1.8 @@ -58,3 +58,5 @@ //FIXME: add middle and up here sprite->set_action(dir == LEFT ? "left-down" : "right-down"); } + +IMPLEMENT_FACTORY(Jumpy, "jumpy") Index: spike.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/spike.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- spike.cpp 28 Nov 2004 14:56:51 -0000 1.2 +++ spike.cpp 20 Dec 2004 21:24:27 -0000 1.3 @@ -62,3 +62,5 @@ Spike::active_action(float ) { } + +IMPLEMENT_FACTORY(Spike, "spike") Index: spiky.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/spiky.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- spiky.cpp 2 Dec 2004 00:25:27 -0000 1.6 +++ spiky.cpp 20 Dec 2004 21:24:27 -0000 1.7 @@ -56,3 +56,4 @@ return CONTINUE; } +IMPLEMENT_FACTORY(Spiky, "spiky") Index: bomb.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/bomb.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- bomb.cpp 1 Dec 2004 15:58:38 -0000 1.6 +++ bomb.cpp 20 Dec 2004 21:24:26 -0000 1.7 @@ -74,3 +74,4 @@ Bomb::kill_fall() { } + Index: mrbomb.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/mrbomb.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- mrbomb.cpp 2 Dec 2004 00:25:27 -0000 1.10 +++ mrbomb.cpp 20 Dec 2004 21:24:27 -0000 1.11 @@ -77,3 +77,5 @@ return CONTINUE; } + +IMPLEMENT_FACTORY(MrBomb, "mrbomb") Index: flyingsnowball.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/flyingsnowball.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- flyingsnowball.cpp 5 Dec 2004 17:04:57 -0000 1.1 +++ flyingsnowball.cpp 20 Dec 2004 21:24:27 -0000 1.2 @@ -80,3 +80,4 @@ sprite->set_action(dir == LEFT ? "left" : "right"); } +IMPLEMENT_FACTORY(FlyingSnowBall, "flyingsnowball") Index: snowball.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/snowball.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- snowball.cpp 2 Dec 2004 00:25:27 -0000 1.8 +++ snowball.cpp 20 Dec 2004 21:24:27 -0000 1.9 @@ -76,3 +76,4 @@ return CONTINUE; } +IMPLEMENT_FACTORY(SnowBall, "snowball") Index: badguy.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/badguy.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- badguy.h 28 Nov 2004 14:56:50 -0000 1.4 +++ badguy.h 20 Dec 2004 21:24:25 -0000 1.5 @@ -11,6 +11,7 @@ #include "serializable.h" #include "resources.h" #include "sector.h" +#include "object_factory.h" #include "lisp/parser.h" #include "lisp/lisp.h" #include "lisp/writer.h" Index: dispenser.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/dispenser.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- dispenser.cpp 2 Dec 2004 00:25:27 -0000 1.10 +++ dispenser.cpp 20 Dec 2004 21:24:27 -0000 1.11 @@ -92,3 +92,4 @@ } } +IMPLEMENT_FACTORY(Dispenser, "dispenser") Index: nolok_01.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/nolok_01.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- nolok_01.cpp 2 Dec 2004 00:25:27 -0000 1.8 +++ nolok_01.cpp 20 Dec 2004 21:24:27 -0000 1.9 @@ -106,3 +106,4 @@ return CONTINUE; } +IMPLEMENT_FACTORY(Nolok_01, "nolok01") Index: flame.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/flame.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- flame.cpp 28 Nov 2004 14:56:51 -0000 1.2 +++ flame.cpp 20 Dec 2004 21:24:27 -0000 1.3 @@ -42,3 +42,5 @@ { } +IMPLEMENT_FACTORY(Flame, "flame") + |
Update of /cvsroot/super-tux/supertux/src/object In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28891/src/object Modified Files: background.cpp block.cpp camera.cpp coin.cpp coin.h invisible_block.cpp platform.cpp rock.cpp tilemap.cpp Log Message: implemented a new object factory mechanism which is now really independent of the objects Index: platform.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/platform.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- platform.cpp 28 Nov 2004 14:56:51 -0000 1.3 +++ platform.cpp 20 Dec 2004 21:24:28 -0000 1.4 @@ -7,6 +7,7 @@ #include "special/sprite_manager.h" #include "lisp/lisp.h" #include "lisp/writer.h" +#include "object_factory.h" Platform::Platform(const lisp::Lisp& reader) { @@ -74,3 +75,5 @@ { sprite->draw(context, get_pos(), LAYER_OBJECTS); } + +IMPLEMENT_FACTORY(Platform, "flying_platform"); Index: coin.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/coin.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- coin.cpp 29 Nov 2004 14:54:05 -0000 1.4 +++ coin.cpp 20 Dec 2004 21:24:27 -0000 1.5 @@ -9,6 +9,7 @@ #include "scene.h" #include "gameobjs.h" #include "statistics.h" +#include "object_factory.h" Coin::Coin(const Vector& pos) { @@ -17,6 +18,14 @@ sprite = sprite_manager->create("coin"); } +Coin::Coin(const lisp::Lisp& reader) +{ + reader.get("x", bbox.p1.x); + reader.get("y", bbox.p1.y); + bbox.set_size(32, 32); + sprite = sprite_manager->create("coin"); +} + Coin::~Coin() { delete sprite; @@ -53,3 +62,4 @@ return ABORT_MOVE; } +IMPLEMENT_FACTORY(Coin, "coin"); Index: background.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/background.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- background.cpp 28 Nov 2004 14:56:51 -0000 1.2 +++ background.cpp 20 Dec 2004 21:24:27 -0000 1.3 @@ -25,6 +25,7 @@ #include "video/drawing_context.h" #include "lisp/lisp.h" #include "lisp/writer.h" +#include "object_factory.h" Background::Background() : type(INVALID), layer(LAYER_BACKGROUND0), image(0) @@ -128,3 +129,4 @@ } } +IMPLEMENT_FACTORY(Background, "background"); Index: coin.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/coin.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- coin.h 19 Dec 2004 13:34:12 -0000 1.3 +++ coin.h 20 Dec 2004 21:24:27 -0000 1.4 @@ -2,6 +2,7 @@ #define __COIN_H__ #include "special/moving_object.h" +#include "lisp/lisp.h" namespace SuperTux { class Sprite; @@ -13,6 +14,7 @@ { public: Coin(const Vector& pos); + Coin(const lisp::Lisp& reader); ~Coin(); HitResponse collision(GameObject& other, const CollisionHit& hit); Index: invisible_block.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/invisible_block.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- invisible_block.cpp 23 Nov 2004 16:47:26 -0000 1.2 +++ invisible_block.cpp 20 Dec 2004 21:24:27 -0000 1.3 @@ -5,6 +5,7 @@ #include "special/sprite.h" #include "special/sprite_manager.h" #include "video/drawing_context.h" +#include "object_factory.h" InvisibleBlock::InvisibleBlock(const Vector& pos) : Block(pos, sprite_manager->create("invisibleblock")), visible(false) @@ -32,3 +33,4 @@ visible = true; } +//IMPLEMENT_FACTORY(InvisibleBlock, "invisible_block"); Index: camera.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/camera.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- camera.cpp 1 Dec 2004 15:58:38 -0000 1.3 +++ camera.cpp 20 Dec 2004 21:24:27 -0000 1.4 @@ -32,6 +32,7 @@ #include "gameloop.h" #include "app/globals.h" #include "sector.h" +#include "object_factory.h" using namespace SuperTux; @@ -289,3 +290,4 @@ keep_in_bounds(); } + Index: block.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/block.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- block.cpp 29 Nov 2004 00:12:25 -0000 1.7 +++ block.cpp 20 Dec 2004 21:24:27 -0000 1.8 @@ -15,6 +15,7 @@ #include "star.h" #include "badguy/badguy.h" #include "coin.h" +#include "object_factory.h" static const float BOUNCY_BRICK_MAX_OFFSET=8; static const float BOUNCY_BRICK_SPEED=90; @@ -164,6 +165,8 @@ sprite->set_action("empty"); } +//IMPLEMENT_FACTORY(BonusBlock, "bonusblock") + //--------------------------------------------------------------------------- Brick::Brick(const Vector& pos, int data) @@ -222,3 +225,4 @@ } } +//IMPLEMENT_FACTORY(Brick, "brick") Index: tilemap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/tilemap.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- tilemap.cpp 19 Dec 2004 16:53:23 -0000 1.3 +++ tilemap.cpp 20 Dec 2004 21:24:28 -0000 1.4 @@ -33,6 +33,7 @@ #include "app/globals.h" #include "lisp/lisp.h" #include "lisp/writer.h" +#include "object_factory.h" TileMap::TileMap() : solid(false), speed(1), width(0), height(0), layer(LAYER_TILES), @@ -277,3 +278,5 @@ { change(int(pos.x)/32, int(pos.y)/32, newtile); } + +IMPLEMENT_FACTORY(TileMap, "tilemap"); Index: rock.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/rock.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- rock.cpp 19 Dec 2004 13:34:12 -0000 1.1 +++ rock.cpp 20 Dec 2004 21:24:28 -0000 1.2 @@ -6,6 +6,7 @@ #include "lisp/writer.h" #include "video/drawing_context.h" #include "resources.h" +#include "object_factory.h" Rock::Rock(const lisp::Lisp& reader) { @@ -73,3 +74,5 @@ grabbed = true; } +IMPLEMENT_FACTORY(Rock, "rock") + |
From: Matze B. <mat...@us...> - 2004-12-20 21:24:40
|
Update of /cvsroot/super-tux/supertux/src/trigger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28891/src/trigger Modified Files: door.cpp sequence_trigger.cpp Log Message: implemented a new object factory mechanism which is now really independent of the objects Index: door.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/trigger/door.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- door.cpp 28 Nov 2004 14:56:52 -0000 1.6 +++ door.cpp 20 Dec 2004 21:24:28 -0000 1.7 @@ -21,6 +21,7 @@ #include "door.h" #include "gameloop.h" #include "resources.h" +#include "object_factory.h" #include "special/sprite.h" #include "special/sprite_manager.h" #include "video/drawing_context.h" @@ -96,3 +97,4 @@ } } +IMPLEMENT_FACTORY(Door, "door"); Index: sequence_trigger.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/trigger/sequence_trigger.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- sequence_trigger.cpp 28 Nov 2004 14:56:52 -0000 1.4 +++ sequence_trigger.cpp 20 Dec 2004 21:24:28 -0000 1.5 @@ -4,6 +4,7 @@ #include "gameloop.h" #include "lisp/lisp.h" #include "lisp/writer.h" +#include "object_factory.h" SequenceTrigger::SequenceTrigger(const lisp::Lisp& reader) { @@ -49,3 +50,5 @@ GameSession::current()->start_sequence(sequence_name); } } + +IMPLEMENT_FACTORY(SequenceTrigger, "sequencetrigger") |
From: Marek M. <wa...@us...> - 2004-12-20 18:50:06
|
Update of /cvsroot/super-tux/supertux/data/music In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23868/data/music Modified Files: bossattack-fast.mod bossattack.mod Log Message: finished(?) boss music Index: bossattack-fast.mod =================================================================== RCS file: /cvsroot/super-tux/supertux/data/music/bossattack-fast.mod,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 Binary files /tmp/cvswxMX4k and /tmp/cvsxleocO differ Index: bossattack.mod =================================================================== RCS file: /cvsroot/super-tux/supertux/data/music/bossattack.mod,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 Binary files /tmp/cvsslT8NC and /tmp/cvsgieN85 differ |
From: Marek M. <wa...@us...> - 2004-12-20 00:23:36
|
Update of /cvsroot/super-tux/supertux/data/music In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30030/data/music Modified Files: bossattack-fast.mod bossattack.mod Log Message: small music fix Index: bossattack-fast.mod =================================================================== RCS file: /cvsroot/super-tux/supertux/data/music/bossattack-fast.mod,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsPxec3S and /tmp/cvsdvViRZ differ Index: bossattack.mod =================================================================== RCS file: /cvsroot/super-tux/supertux/data/music/bossattack.mod,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvscVjleq and /tmp/cvsYXv2wx differ |
From: Marek M. <wa...@us...> - 2004-12-20 00:16:39
|
Update of /cvsroot/super-tux/supertux/data/music In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28313/data/music Added Files: bossattack-fast.mod bossattack.mod Log Message: added work-in-progress boss battle music --- NEW FILE: bossattack-fast.mod --- (This appears to be a binary file; contents omitted.) --- NEW FILE: bossattack.mod --- (This appears to be a binary file; contents omitted.) |
From: Marek M. <wa...@us...> - 2004-12-20 00:16:38
|
Update of /cvsroot/super-tux/supertux/data/levels/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28313/data/levels/test Modified Files: noloktest.stl Log Message: added work-in-progress boss battle music Index: noloktest.stl =================================================================== RCS file: /cvsroot/super-tux/supertux/data/levels/test/noloktest.stl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- noloktest.stl 28 Nov 2004 14:56:47 -0000 1.6 +++ noloktest.stl 20 Dec 2004 00:16:29 -0000 1.7 @@ -10,7 +10,7 @@ (gravity 10) (background (image "forest1.jpg") (speed 0.5)) - (music "Mortimers_chipdisko.mod") + (music "bossattack.mod") (spawnpoint (name "main") (x 100) (y 100)) (nolok_01 (x 650) (y 512)) (tilemap |
From: Ricardo C. <rm...@us...> - 2004-12-19 16:57:39
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29819/src Modified Files: leveleditor.h sector.cpp leveleditor.cpp Added Files: gameobjs_bridge.cpp gameobjs_bridge.h Log Message: Added a common set of bridge funcs for Leveleditor and Sector to create game objects. Stuff ain't working properly in the level editor, because we miss the following common calls for all game objects: - activate, get image and get postion. Index: sector.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/sector.cpp,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- sector.cpp 19 Dec 2004 13:34:11 -0000 1.60 +++ sector.cpp 19 Dec 2004 16:57:27 -0000 1.61 @@ -67,6 +67,7 @@ #include "trigger/door.h" #include "trigger/sequence_trigger.h" #include "trigger/secretarea_trigger.h" +#include "gameobjs_bridge.h" Sector* Sector::_current = 0; @@ -120,41 +121,14 @@ CloudParticleSystem* partsys = new CloudParticleSystem(); partsys->parse(reader); return partsys; - } else if(name == "door") { - return new Door(reader); } else if(name == "secretarea") { return new SecretAreaTrigger(reader); } else if(name == "sequencetrigger") { return new SequenceTrigger(reader); - } else if(name == "platform") { - return new Platform(reader); - } else if(name == "jumpy" || name == "money") { - return new Jumpy(reader); - } else if(name == "snowball") { - return new SnowBall(reader); - } else if(name == "bouncingsnowball") { - return new BouncingSnowball(reader); - } else if(name == "flame") { - return new Flame(reader); - } else if(name == "flyingsnowball") { - return new FlyingSnowBall(reader); - } else if(name == "mriceblock") { - return new MrIceBlock(reader); - } else if(name == "mrbomb") { - return new MrBomb(reader); - } else if(name == "dispenser") { - 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); - } else if(name == "rock") { - return new Rock(reader); - } - - std::cerr << "Unknown object type '" << name << "'.\n"; + } else if(is_object(name)) { + return create_object(object_name_to_type(name), reader); + } else + std::cerr << "Unknown object type '" << name << "'.\n"; return 0; } --- NEW FILE: gameobjs_bridge.cpp --- /*************************************************************************** gameobjs_bridge.cpp - description ------------------- begin : Dec, 19 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 "gameobjs_bridge.h" #include "object/coin.h" #include "object/block.h" #include "object/invisible_block.h" #include "object/platform.h" #include "object/bullet.h" #include "object/rock.h" #include "badguy/jumpy.h" #include "badguy/snowball.h" #include "badguy/bouncing_snowball.h" #include "badguy/flame.h" #include "badguy/flyingsnowball.h" #include "badguy/mriceblock.h" #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" #include "trigger/secretarea_trigger.h" std::string object_type_to_string(int kind) { switch(kind) { // Game Objects case COIN_OBJECT: return "coin"; case INVISIBLE_BLOCK_OBJECT: return "invisible-block"; case PLATFORM_OBJECT: return "platform"; case ROCK_OBJECT: return "rock"; // Bad Guys case JUMPY_BADGUY: return "jumpy"; case SNOWBALL_BADGUY: return "snowball"; case BOUNCING_SNOWBALL_BADGUY: return "bouncingsnowball"; case FLAME_BADGUY: return "flame"; case FLYING_SNOWBALL_BADGUY: return "flyingsnowball"; case MRICEBLOCK_BADGUY: return "mriceblock"; case MRBOMB_BADGUY: return "mrbomb"; case DISPENSER_BADGUY: return "dispenser"; case SPIKE_BADGUY: return "spike"; case SPIKY_BADGUY: return "spiky"; case NOLOK_01_BADGUY: return "nolok_01"; // Triggers case DOOR_TRIGGER: return "door"; default: std::cerr << "Warning: object not recognized.\n"; return ""; // should not happen } return ""; // avoids warnings } GameObjectsType object_name_to_type(const std::string& name) { // Game Objects if(name == "coin") return COIN_OBJECT; else if(name == "invisible-block") return INVISIBLE_BLOCK_OBJECT; else if(name == "platform") return PLATFORM_OBJECT; else if(name == "rock") return ROCK_OBJECT; // Bad Guys else if(name == "jumpy") return JUMPY_BADGUY; else if(name == "snowball") return SNOWBALL_BADGUY; else if(name == "bouncingsnowball") return BOUNCING_SNOWBALL_BADGUY; else if(name == "flame") return FLAME_BADGUY; else if(name == "flyingsnowball") return FLYING_SNOWBALL_BADGUY; else if(name == "mriceblock") return MRICEBLOCK_BADGUY; else if(name == "mrbomb") return MRBOMB_BADGUY; else if(name == "dispenser") return DISPENSER_BADGUY; else if(name == "spike") return SPIKE_BADGUY; else if(name == "spiky") return SPIKY_BADGUY; else if(name == "nolok_01") return NOLOK_01_BADGUY; // Triggers else if(name == "door") return DOOR_TRIGGER; // Object not recognized return NOT_RECOGNIZED_GAMEOBJECT; } bool is_object(const std::string& name) { if(object_name_to_type(name) == NOT_RECOGNIZED_GAMEOBJECT) return false; return true; } GameObject* create_object(GameObjectsType kind, const lisp::Lisp& reader) { switch(kind) { // Game Objects case COIN_OBJECT: case INVISIBLE_BLOCK_OBJECT: std::cerr << "Error: This object doesn't yet supported a Lisp argument.\n"; return NULL; // return new Coin(reader); // return new InvisibleBlock(reader); case PLATFORM_OBJECT: return new Platform(reader); case ROCK_OBJECT: return new Rock(reader); // Bad Guys case JUMPY_BADGUY: return new Jumpy(reader); case SNOWBALL_BADGUY: return new SnowBall(reader); case BOUNCING_SNOWBALL_BADGUY: return new BouncingSnowball(reader); case FLAME_BADGUY: return new Flame(reader); case FLYING_SNOWBALL_BADGUY: return new FlyingSnowBall(reader); case MRICEBLOCK_BADGUY: return new MrIceBlock(reader); case MRBOMB_BADGUY: return new MrBomb(reader); case DISPENSER_BADGUY: return new Dispenser(reader); case SPIKE_BADGUY: return new Spike(reader); case SPIKY_BADGUY: return new Spiky(reader); case NOLOK_01_BADGUY: return new Nolok_01(reader); // Triggers case DOOR_TRIGGER: return new Door(reader); default: std::cerr << "Warning: object not recognized.\n"; return NULL; // object not recognized } return NULL; // avoids warnings } GameObject* create_object(GameObjectsType kind, const Vector& pos) { switch(kind) { // Game Objects case COIN_OBJECT: return new Coin(pos); case INVISIBLE_BLOCK_OBJECT: return new InvisibleBlock(pos); case PLATFORM_OBJECT: case ROCK_OBJECT: case JUMPY_BADGUY: case FLAME_BADGUY: case DISPENSER_BADGUY: case SPIKY_BADGUY: std::cerr << "Error: This object doesn't yet support a position argument.\n"; return NULL; // return new Platform(pos); // return new Rock(pos); // Bad Guys // return new Jumpy(pos.x,pos.y,LEFT); // return new Flame(pos.x,pos.y,LEFT); // return new Dispenser(pos.x,pos.y,LEFT); // return new Spiky(pos.x,pos.y,LEFT); case SNOWBALL_BADGUY: return new SnowBall(pos.x,pos.y,LEFT); case BOUNCING_SNOWBALL_BADGUY: return new BouncingSnowball(pos.x,pos.y,LEFT); case FLYING_SNOWBALL_BADGUY: return new FlyingSnowBall(pos.x,pos.y); case MRICEBLOCK_BADGUY: return new MrIceBlock(pos.x,pos.y,LEFT); case MRBOMB_BADGUY: return new MrBomb(pos.x,pos.y,LEFT); case SPIKE_BADGUY: return new Spike(pos,Spike::WEST); case NOLOK_01_BADGUY: return new Nolok_01(pos.x,pos.y); // Triggers case DOOR_TRIGGER: return new Door((int)pos.x,(int)pos.y,"",""); default: std::cerr << "Warning: object not recognized.\n"; return NULL; // object not recognized } return NULL; // avoids warnings } --- NEW FILE: gameobjs_bridge.h --- /*************************************************************************** gameobjs_bridge.h - description ------------------- begin : Dec, 19 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 GAMEOBJS_BRIDGE_H #define GAMEOBJS_BRIDGE_H #include <string> //#include "lisp/parser.h" #include "lisp/lisp.h" //#include "lisp/writer.h" //#include "lisp/list_iterator.h" //class GameObject; #include "object/gameobjs.h" /** This is just a set of functions aim to provide a common way to create new game objects. Game objects that ain't really interactive don't fit in here. */ enum GameObjectsType { // Game Objects COIN_OBJECT, INVISIBLE_BLOCK_OBJECT, PLATFORM_OBJECT, ROCK_OBJECT, // Bad Guys JUMPY_BADGUY, SNOWBALL_BADGUY, BOUNCING_SNOWBALL_BADGUY, FLAME_BADGUY, FLYING_SNOWBALL_BADGUY, MRICEBLOCK_BADGUY, MRBOMB_BADGUY, DISPENSER_BADGUY, SPIKE_BADGUY, SPIKY_BADGUY, NOLOK_01_BADGUY, // Triggers DOOR_TRIGGER, TOTAL_GAMEOBJECTS, NOT_RECOGNIZED_GAMEOBJECT }; /* Objects identifiers. */ std::string object_type_to_string(int kind); GameObjectsType object_name_to_type(const std::string& name); bool is_object(const std::string& name); /* Calls to return a pointer to a created GameObjects. Don't forget to delete them! */ GameObject* create_object(GameObjectsType kind, const lisp::Lisp& reader); GameObject* create_object(GameObjectsType kind, const Vector& pos); #endif /*GAMEOBJS_BRIDGE_H*/ Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.173 retrieving revision 1.174 diff -u -d -r1.173 -r1.174 --- leveleditor.cpp 28 Nov 2004 14:56:49 -0000 1.173 +++ leveleditor.cpp 19 Dec 2004 16:57:27 -0000 1.174 @@ -38,6 +38,7 @@ #include "object/camera.h" #include "object/tilemap.h" #include "object/background.h" +#include "gameobjs_bridge.h" LevelEditor::LevelEditor() { @@ -102,7 +103,8 @@ Vector(32,32), Vector(4,8)); tiles_board->add_button(Button(img_rubber_bt, _("Eraser"), SDLKey(SDLK_DELETE)), 0); - for(unsigned int id = 1; id < tile_manager->get_max_tileid(); id++) + unsigned int id; + for(id = 1; id < tile_manager->get_max_tileid(); id++) { const Tile* tile = tile_manager->get(id); if(!tile) @@ -115,27 +117,15 @@ Button button = Button(surface, "", SDLKey(0)); tiles_board->add_button(button, id); } + gameobjs_first_id = id; - #if 0 - for(int i = 0; i < NUM_BadGuyKinds; i++) + for(id = 0; id < TOTAL_GAMEOBJECTS; id++) { - // filter bomb, since it is only for internal use, not for levels - if(i == BAD_BOMB) - continue; - - BadGuyKind kind = BadGuyKind(i); - BadGuy badguy(kind, 0,0); - badguy.activate(LEFT); - - Surface *img = badguy.get_image(); - tiles_board->add_button(Button(img, "", SDLKey(SDLK_1+i)), -(i+1)); +// Surface *img = badguy.get_image(); +// FIXME: get image from object. Using the rubber in the meanwhile. + tiles_board->add_button(Button(img_rubber_bt, object_type_to_string(id), + SDLKey(SDLK_1+id)), id+gameobjs_first_id); } - #endif - - #if 0 - tiles_board->add_button(Button(img_trampoline[0].get_frame(0), _("Trampoline"), SDLKey(0)), OBJ_TRAMPOLINE); - tiles_board->add_button(Button(img_flying_platform->get_frame(0), _("Flying Platform"), SDLKey(0)), OBJ_FLYING_PLATFORM); - #endif tiles_layer = new ButtonGroup(Vector(12, screen->h-64), Vector(80,20), Vector(1,3)); tiles_layer->add_button(Button(img_foreground_bt, _("Edtit foreground tiles"), @@ -608,11 +598,12 @@ if(selection[0][0] == 0 && selection.size() == 1) context.draw_surface(img_rubber_bt, Vector(event.button.x - 8, event.button.y - 8), LAYER_GUI-2); - else if(selection[0][0] < 0) + else if(selection[0][0] >= gameobjs_first_id || selection[0][0] < 0) { +// FIXME: this should draw an object image near cursor +#if 0 int id = selection[0][0]; -#if 0 if(id == OBJ_TRAMPOLINE) context.draw_surface(img_trampoline[0].get_frame(0), Vector(event.button.x - 8, event.button.y - 8), LAYER_GUI-2); @@ -620,14 +611,12 @@ context.draw_surface(img_flying_platform->get_frame(0), Vector(event.button.x - 8, event.button.y - 8), LAYER_GUI-2); else -#endif if(id == OBJ_DOOR) /*context.draw_surface(door->get_frame(0), Vector(event.button.x - 8, event.button.y - 8), LAYER_GUI-2);*/ ; else { -#if 0 BadGuyKind kind = BadGuyKind((-id)-1); BadGuy badguy(kind, 0,0); badguy.activate(LEFT); @@ -635,8 +624,8 @@ context.draw_surface(img, Vector(event.button.x - 8, event.button.y - 8), LAYER_GUI-2); -#endif } +#endif } else { @@ -791,12 +780,6 @@ /* Point foregrounds, backgrounds, solids to its layer */ for(Sector::GameObjects::iterator i = sector->gameobjects.begin(); i != sector->gameobjects.end(); i++) { -#if 0 - BadGuy* badguy = dynamic_cast<BadGuy*> (*i); - if(badguy) - badguy->activate(LEFT); -#endif - TileMap* tilemap = dynamic_cast<TileMap*> (*i); if(tilemap) { @@ -866,22 +849,12 @@ y = (int)(y * (zoom*32) / 32); } - if(newtile < 0) // add object + if(newtile >= gameobjs_first_id) // add object { // remove an active tile or object that might be there change(x, y, 0, LAYER_TILES); -#if 0 - if(newtile == OBJ_TRAMPOLINE) - sector->add_object(new Trampoline(x, y)); - else if(newtile == OBJ_FLYING_PLATFORM) - sector->add_object(new FlyingPlatform(x, y)); - else - if(newtile == OBJ_DOOR) - sector->add_object(new Door(x, y)); - else - sector->add_bad_guy(x, y, BadGuyKind((-newtile)-1), true); -#endif + create_object((GameObjectsType)(newtile-gameobjs_first_id),Vector(x,y)); sector->update_game_objects(); } else if(cur_layer == LAYER_FOREGROUNDTILES) { @@ -891,13 +864,12 @@ // we /32 in order to round numbers for(Sector::GameObjects::iterator i = sector->gameobjects.begin(); i < sector->gameobjects.end(); i++) { +// FIXME: if there is a game objs in here, remove it! #if 0 BadGuy* badguy = dynamic_cast<BadGuy*> (*i); if(badguy) if((int)badguy->base.x/32 == x/32 && (int)badguy->base.y/32 == y/32) sector->gameobjects.erase(i); -#endif -#if 0 Trampoline* trampoline = dynamic_cast<Trampoline*> (*i); if(trampoline) { @@ -908,8 +880,6 @@ if(flying_platform) if((int)flying_platform->base.x/32 == x/32 && (int)flying_platform->base.y/32 == y/32) sector->gameobjects.erase(i); -#endif -#if 0 Door* door = dynamic_cast<Door*> (*i); if(door) if((int)door->get_area().x/32 == x/32 && (int)door->get_area().y/32 == y/32) Index: leveleditor.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- leveleditor.h 26 Nov 2004 14:45:40 -0000 1.24 +++ leveleditor.h 19 Dec 2004 16:57:27 -0000 1.25 @@ -137,7 +137,7 @@ Surface *img_previous_level_bt, *img_next_level_bt, *img_previous_sector_bt, *img_next_sector_bt; ButtonGroup *tiles_board, *tiles_layer, *level_options; - int cur_layer; + int gameobjs_first_id, cur_layer; std::vector <std::vector <int> > selection; Vector selection_ini, selection_end; |
From: Ricardo C. <rm...@us...> - 2004-12-19 16:53:33
|
Update of /cvsroot/super-tux/supertux/src/object In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28962/src/object Modified Files: tilemap.cpp Log Message: Fixed crash on level editor by making a pos test. Index: tilemap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/tilemap.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tilemap.cpp 28 Nov 2004 14:56:52 -0000 1.2 +++ tilemap.cpp 19 Dec 2004 16:53:23 -0000 1.3 @@ -144,7 +144,9 @@ /** if we don't round here, we'll have a 1 pixel gap on screen sometimes. * I have no idea why */ float start_x = roundf(context.get_translation().x); + if(start_x < 0) start_x = 0; float start_y = roundf(context.get_translation().y); + if(start_y < 0) start_y = 0; float end_x = std::min(start_x + screen->w, float(width * 32)); float end_y = std::min(start_y + screen->h, float(height * 32)); start_x -= int(start_x) % 32; |
From: Matze B. <mat...@us...> - 2004-12-19 13:34:49
|
Update of /cvsroot/super-tux/supertux/data/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22644/data/images Modified Files: supertux.strf Log Message: -german translation updates -some cleanups -a first version of grab&carry around code. It doesn't work too good yet but it was lying around too long on my HD... Index: supertux.strf =================================================================== RCS file: /cvsroot/super-tux/supertux/data/images/supertux.strf,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- supertux.strf 25 Nov 2004 14:38:00 -0000 1.28 +++ supertux.strf 19 Dec 2004 13:34:09 -0000 1.29 @@ -1314,12 +1314,12 @@ (images "tilesets/brick1.png")) ) - (sprite (name "invisibleblock") + (sprite (name "rock") (action - (name "empty") - (images "tilesets/bonus2-d.png")) + (name "default") + (images "tilesets/block11.png")) ) - + ; Stomp (sprite (name "stomp") (action |
From: Matze B. <mat...@us...> - 2004-12-19 13:34:27
|
Update of /cvsroot/super-tux/supertux/src/object In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22644/src/object Modified Files: coin.h player.cpp player.h Added Files: portable.h rock.cpp rock.h Log Message: -german translation updates -some cleanups -a first version of grab&carry around code. It doesn't work too good yet but it was lying around too long on my HD... Index: player.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/player.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- player.h 26 Nov 2004 14:45:41 -0000 1.1 +++ player.h 19 Dec 2004 13:34:12 -0000 1.2 @@ -19,6 +19,7 @@ #ifndef SUPERTUX_PLAYER_H #define SUPERTUX_PLAYER_H +#include <vector> #include "SDL.h" #include "timer.h" @@ -31,6 +32,7 @@ using namespace SuperTux; class BadGuy; +class Portable; /* Times: */ @@ -40,18 +42,10 @@ #define TUX_FLAPPING_TIME 1 /* How long Tux can flap his wings to gain additional jump height */ #define TIME_WARNING 20 /* When to alert player they're low on time! */ -/* Scores: */ - -#define SCORE_BRICK 5 -#define SCORE_DISTRO 20 - /* Sizes: */ - #define SMALL 0 #define BIG 1 -#include <vector> - struct PlayerKeymap { public: @@ -88,9 +82,6 @@ extern Surface* tux_life; -extern Sprite* smalltux_gameover; -extern Sprite* smalltux_star; -extern Sprite* bigtux_star; #define GROWING_TIME 1.0 #define GROWING_FRAMES 7 @@ -137,7 +128,6 @@ int got_power; int size; bool duck; - bool holding_something; bool dead; DyingType dying; @@ -183,7 +173,6 @@ int key_event(SDLKey key, int state); void level_begin(); void handle_input(); - void grabdistros(); PlayerStatus& get_status(); @@ -196,11 +185,10 @@ { return invincible_timer.started(); } + void kill(HurtMode mode); void player_remove_powerups(); void check_bounds(Camera* camera); - bool on_ground(); - bool under_solid(); void grow(bool animate = false); void move(const Vector& vector); @@ -210,15 +198,19 @@ { return dead; } private: + bool on_ground(); + void init(); void handle_horizontal_input(); void handle_vertical_input(); void remove_powerups(); + + Portable* grabbed_object; + + Sprite* smalltux_gameover; + Sprite* smalltux_star; + Sprite* bigtux_star; }; #endif /*SUPERTUX_PLAYER_H*/ - -/* Local Variables: */ -/* mode:c++ */ -/* End: */ Index: coin.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/coin.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- coin.h 24 Nov 2004 23:10:07 -0000 1.2 +++ coin.h 19 Dec 2004 13:34:12 -0000 1.3 @@ -15,9 +15,9 @@ Coin(const Vector& pos); ~Coin(); - virtual HitResponse collision(GameObject& other, const CollisionHit& hit); - virtual void action(float elapsed_time); - virtual void draw(DrawingContext& context); + HitResponse collision(GameObject& other, const CollisionHit& hit); + void action(float elapsed_time); + void draw(DrawingContext& context); void collect(); Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/object/player.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- player.cpp 27 Nov 2004 14:14:30 -0000 1.2 +++ player.cpp 19 Dec 2004 13:34:12 -0000 1.3 @@ -25,6 +25,7 @@ #include "app/globals.h" #include "app/gettext.h" +#include "special/sprite_manager.h" #include "player.h" #include "defines.h" #include "scene.h" @@ -38,6 +39,7 @@ #include "object/tilemap.h" #include "object/camera.h" #include "object/gameobjs.h" +#include "object/portable.h" #include "trigger/trigger_base.h" static const int TILES_FOR_BUTTJUMP = 3; @@ -59,10 +61,6 @@ Surface* tux_life = 0; -Sprite* smalltux_gameover = 0; -Sprite* smalltux_star = 0; -Sprite* bigtux_star = 0; - TuxBodyParts* small_tux = 0; TuxBodyParts* big_tux = 0; TuxBodyParts* fire_tux = 0; @@ -123,19 +121,24 @@ } Player::Player() + : grabbed_object(0) { + smalltux_gameover = sprite_manager->create("smalltux-gameover"); + smalltux_star = sprite_manager->create("smalltux-star"); + bigtux_star = sprite_manager->create("bigtux-star"); init(); } Player::~Player() { + delete smalltux_gameover; + delete smalltux_star; + delete bigtux_star; } void Player::init() { - holding_something = false; - bbox.set_size(31.8, 31.8); size = SMALL; @@ -166,6 +169,7 @@ flaps_nb = 0; on_ground_flag = false; + grabbed_object = 0; player_input_init(&input); @@ -249,44 +253,32 @@ return; } - if (input.fire == UP) - holding_something = false; + if(input.fire == UP) + grabbed_object = 0; + if(dying == DYING_NOT) handle_input(); movement = physic.get_movement(elapsed_time); + on_ground_flag = false; #if 0 - // special exception for cases where we're stuck under tiles after - // being ducked. In this case we drift out - if(!duck && on_ground() && old_base.x == base.x && old_base.y == base.y - && collision_object_map(base)) - { - base.x += elapsed_time * WALK_SPEED * (dir ? 1: -1); - previous_base = old_base = base; - } - - /* Reset score multiplier (for multi-hits): */ - if (!invincible_timer.started()) - { - if(player_status.score_multiplier > player_status.max_score_multiplier) - { - player_status.max_score_multiplier = player_status.score_multiplier; - - // show a message - char str[124]; - sprintf(str, _("New max combo: %d"), player_status.max_score_multiplier-1); - Sector::current()->add_floating_text(base, str); - } - player_status.score_multiplier = 1; - } - } - - } + // special exception for cases where we're stuck under tiles after + // being ducked. In this case we drift out + if(!duck && on_ground() && old_base.x == base.x && old_base.y == base.y + && collision_object_map(base)) { + base.x += elapsed_time * WALK_SPEED * (dir ? 1: -1); + previous_base = old_base = base; + } #endif - on_ground_flag = false; + if(grabbed_object != 0) { + Vector pos = get_pos() + + Vector(dir == LEFT ? -16 : 16, + bbox.get_height()*0.66666 - 32); + grabbed_object->grab(*this, pos); + } } bool @@ -342,40 +334,36 @@ } // changing directions? - if(on_ground() && ((vx < 0 && dirsign >0) || (vx>0 && dirsign<0))) - { - // let's skid! - if(fabs(vx)>SKID_XM && !skidding_timer.started()) - { - skidding_timer.start(SKID_TIME); - SoundManager::get()->play_sound(IDToSound(SND_SKID)); - // dust some partcles - Sector::current()->add_object( - new Particles( - Vector(bbox.p1.x + (dir == RIGHT ? bbox.get_width() : 0), - bbox.p2.y), - dir == RIGHT ? 270+20 : 90-40, dir == RIGHT ? 270+40 : 90-20, - Vector(280,-260), Vector(0,0.030), 3, Color(100,100,100), 3, .8, - LAYER_OBJECTS+1)); - - ax *= 2.5; - } - else - { - ax *= 2; - } + if(on_ground() && ((vx < 0 && dirsign >0) || (vx>0 && dirsign<0))) { + // let's skid! + if(fabs(vx)>SKID_XM && !skidding_timer.started()) { + skidding_timer.start(SKID_TIME); + SoundManager::get()->play_sound(IDToSound(SND_SKID)); + // dust some partcles + Sector::current()->add_object( + new Particles( + Vector(bbox.p1.x + (dir == RIGHT ? bbox.get_width() : 0), + bbox.p2.y), + dir == RIGHT ? 270+20 : 90-40, dir == RIGHT ? 270+40 : 90-20, + Vector(280,-260), Vector(0,0.030), 3, Color(100,100,100), 3, .8, + LAYER_OBJECTS+1)); + + ax *= 2.5; + } else { + ax *= 2; } + } // we get slower when not pressing any keys if(dirsign == 0) { - if(fabs(vx) < WALK_SPEED) { - vx = 0; - ax = 0; - } else if(vx < 0) { - ax = WALK_ACCELERATION_X * 1.5; - } else { - ax = WALK_ACCELERATION_X * -1.5; - } + if(fabs(vx) < WALK_SPEED) { + vx = 0; + ax = 0; + } else if(vx < 0) { + ax = WALK_ACCELERATION_X * 1.5; + } else { + ax = WALK_ACCELERATION_X * -1.5; + } } #if 0 @@ -558,14 +546,6 @@ } } - // Hover - //(disabled by default, use cheat code "hover" to toggle on/off) - //TODO: needs some tweaking, especially when used together with double jump and jumping off badguys - if (enable_hover && input.jump == DOWN && !jumping && !butt_jump && physic.get_velocity_y() <= 0) - { - physic.set_velocity_y(-100); - } - #if 0 /* In case the player has pressed Down while in a certain range of air, enable butt jump action */ @@ -712,11 +692,6 @@ } void -Player::grabdistros() -{ -} - -void Player::draw(DrawingContext& context) { TuxBodyParts* tux_body; @@ -799,7 +774,7 @@ } // Tux is holding something - if ((holding_something && physic.get_velocity_y() == 0) || + if ((grabbed_object != 0 && physic.get_velocity_y() == 0) || (shooting_timer.get_timeleft() > 0 && !shooting_timer.check())) { if (duck) @@ -872,6 +847,13 @@ HitResponse Player::collision(GameObject& other, const CollisionHit& hit) { + Portable* portable = dynamic_cast<Portable*> (&other); + if(portable && grabbed_object == 0 && input.fire == DOWN + && fabsf(hit.normal.x) > .9) { + grabbed_object = portable; + return CONTINUE; + } + if(other.get_flags() & FLAG_SOLID) { if(hit.normal.y < 0) { // landed on floor? if (physic.get_velocity_y() < 0) --- NEW FILE: portable.h --- #ifndef __PORTABLE_H__ #define __PORTABLE_H__ #include "special/moving_object.h" using namespace SuperTux; /** * An object that inherits from this object is considered "portable" and can * be carried around by the player. * The object has to additionally set the PORTABLE flag (this allows to * make the object only temporarily portable by resetting the flag) */ class Portable { public: /** * called each frame when the object has been grabbed. */ virtual void grab(MovingObject& object, const Vector& pos) = 0; }; #endif --- NEW FILE: rock.h --- #ifndef __ROCK_H__ #define __ROCK_H__ #include "special/moving_object.h" #include "math/physic.h" #include "lisp/lisp.h" #include "portable.h" #include "serializable.h" namespace SuperTux { class Sprite; } class Rock : public MovingObject, public Portable, public Serializable { public: Rock(const lisp::Lisp& reader); virtual ~Rock(); HitResponse collision(GameObject& other, const CollisionHit& hit); void action(float elapsed_time); void draw(DrawingContext& context); void write(lisp::Writer& writer); void grab(MovingObject& object, const Vector& pos); private: bool grabbed; Sprite* sprite; Physic physic; }; #endif --- NEW FILE: rock.cpp --- #include <config.h> #include "rock.h" #include "special/sprite.h" #include "special/sprite_manager.h" #include "lisp/writer.h" #include "video/drawing_context.h" #include "resources.h" Rock::Rock(const lisp::Lisp& reader) { reader.get("x", bbox.p1.x); reader.get("y", bbox.p1.y); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("rock"); grabbed = false; flags |= FLAG_SOLID; } Rock::~Rock() { delete sprite; } void Rock::write(lisp::Writer& writer) { writer.start_list("rock"); writer.write_float("x", bbox.p1.x); writer.write_float("y", bbox.p1.y); writer.end_list("rock"); } void Rock::draw(DrawingContext& context) { sprite->draw(context, get_pos(), LAYER_OBJECTS); } void Rock::action(float elapsed_time) { if(!grabbed) { flags |= FLAG_SOLID; flags &= ~FLAG_NO_COLLDET; movement = physic.get_movement(elapsed_time); } else { physic.set_velocity(0, 0); flags &= ~FLAG_SOLID; flags |= FLAG_NO_COLLDET; } grabbed = false; } HitResponse Rock::collision(GameObject& , const CollisionHit& ) { if(grabbed) return FORCE_MOVE; physic.set_velocity(0, 0); return CONTINUE; } void Rock::grab(MovingObject& , const Vector& pos) { movement = pos - get_pos(); grabbed = true; } |