;
for p in $(LEVELPATHS) {
- InstallData [ Wildcard $(p) : info *.stl *.stwm ] : $(p) ;
+ InstallData [ Wildcard $(p) : info *.stl *.stwm *.txt ] : $(p) ;
- local translatable_lisp = [ Wildcard $(p) : info *.stl *.stwm ] ;
+ local translatable_lisp = [ Wildcard $(p) : info *.stl *.stwm *.txt ] ;
SEARCH on $(translatable_lisp) = $(SEARCH_SOURCE) ;
MakePot $(SUBDIR)/$(p)/messages.pot : $(translatable_lisp) ;
XGETTEXT_FLAGS on $(SUBDIR)/$(p)/messages.pot += --language=Lisp ;
(background "oiltux.jpg")
(text "-- SuperTux -
- Milestone 1
+ Milestone 1
-Maintainer
Ver-nos-emos em breve na Milestone2!")
- )
\ No newline at end of file
+ )
+++ /dev/null
--Congratulations!
-
- You have successfully finished
- Bonus Island I
-
-
- featuring levels contributed by
- Jason W. Thompson
- Torfi Gunnarsson
- Abednego
- Matr1x
-
-
- If you didn't clear all levels yet,
- find your way back home and take
- another path. There is still more
- challenge waiting for you!
-
- And there is a secret level to be
- found as well...
-
- A big "Thank you" goes out to
- everyone who contributed to this
- release. We hope you enjoyed it!
-
+++ /dev/null
-; Ending text
-(supertux-text
- (background "extro.jpg")
- (music "theme.mod")
- (show-after "CREDITS")
-
- (text "-Entering Nolok's Throne Room!
-
- Tux ran into Nolok's throne room,
- frantically searching for his beloved.
- Alas, he found neither Penny nor Nolok
- there, but instead, another note.
-
- \"Well done, Tux, well done. If you are
- reading this, you have removed my
- control over this icy fortress. But as
- you can see, your beloved Penny is not
- here. What you did not realize is that
- this is just one of my many fortresses,
- spread far across the lands!
-
- \"Tux, your ambition is most honorable,
- but futile nonetheless. With every
- fortress you conquer of mine, I will
- escape to another, and take Penny with
- me. Do not be silly... it is best that
- you give up now.\"
-
- Tux was sadly leaving the room, when he
- felt something beneath his foot... an
- envelope, addressed to him! Inside was
- a roughly sketched map with fortresses
- drawn in various lands. On the corner
- of the map was Penny's signature, a
- drawing of the ice flower.
-
- Tux ran out of the fortress, map in
- hand. No, he decided, he would not give
- up. Penny was counting on him.")
-
-; Portuguese (European) by Ricardo Cruz
- (text-pt_PT "-Entrando na Sala do Trono de Nolok!
-
- O Tux entra a correr na sala do trono de Nolok,
- procurando freneticamente a sua amada.
- Todavia, nem Penny, nem Nolok lá
- estavam; em vez deles, outra carta.
-
- \"Muito bem, Tux, muito bem. Se estiveres a
- ler isto é porque acabaste de remover
- todo o meu poder sobre esta região gelada. Mas
- como vês, a tua bela Penny não está
- aqui. O que não te apercebeste é que
- esta é apenas uma das várias fortalezas
- que tenho espalhadas pelo reino!
-
- \"Tux, a tua intenção é honrosa...
- mas fútil. Por cada fortaleza
- que me conquistes, Escaparei
- para outra, e levarei a Penny comigo.
- Não sejas tonto... o melhor é mesmo
- desistires agora.\"
-
- Tux abandona a sala tristemente, quando
- sente algo debaixo do seu pé... um
- envelope, endereçado a ele! Dentro estava
- um esboço de um mapa com várias fortalezas
- localizadas em vários pontos. No canto
- do mapa estava a assinatura da Penny, o
- desenho de uma flor de gelo.
-
- O Tux corre para fora da fortaleza, com o
- mapa na mão. Não, ele decide, não vou
- desistir. A Penny está a contar com ele.")
-
-; Italian (European) by Federico Asara
- (text "-Entrando nella sala del trono di Nolok!
-
- Tux entro' correndo nella sala del trono di Nolok
- cercando disperatamente la sua amata.
- Ma lì non trovo' ne' lei ne' Nolok,
- trovando invece un'altra nota.
-
- \"Ben fatto, Tux, ben fatto. Se starai
- leggendo questa nota, avrai rimosso il
- mio controllo da questa fortezza ghiacciata.
- Ma come puoi vedere, la tua cara Penny
- non e' qui. Non sei arrivato a pensare
- che questa e' una delle mie tante fortezze,
- sparse per tutte le terre!
-
- \"Tux, la tua ambizione e' onorabile, ma
- anche futile. Per ogni mia fortezza
- che conquisterai, io scappero' in un'altra,
- e portero' Penny con me. Dai, non fare
- lo stupido... e' meglio se ti arrendi
- gia' da ora.\"
-
- Tux stava tristemente uscendo dalla sala,
- quando egli senti' qualcosa sotto il suo
- piede... una busta, indirizzata a lui!
- Dentro c'era un abbozzo di mappa con
- fortezze in varie terre. Nell'angolo della
- mappa c'era la firma di Penny, un disegno
- del suo fiore ghiacciato.
-
- Tux usci' correndo dalla fortezza, portando
- con se la mappa. No, ormai ha deciso, lui
- non si arrendera'. Penny si fida di lui!")
- )
+++ /dev/null
-; Introduction text
-(supertux-text
- (background "arctis.jpg")
-
- (text "-Penny gets captured!
-
- Tux and Penny were out having a nice
- picnic on the ice fields of Antarctica.
- Suddenly, a creature jumped from
- behind an ice bush, there was a flash,
- and Tux fell asleep!
-
- When Tux wakes up, he finds that Penny
- is missing. Where she lay before now
- lies a letter. \"Tux, my arch enemy!\"
- says the letter. \"I have captured
- your beautiful Penny and have taken her
- to my fortress. The path to my fortress
- is littered with my minions. Give up on
- the thought of trying to reclaim her,
- you haven't a chance! -Nolok\"
-
- Tux looks and see Nolok's fortress in
- the distance. Determined to save his
- beloved Penny, he begins his journey.")
-
-; Portuguese (European) by Ricardo Cruz
- (text-pt_PT "-A Penny foi capturada!
-
- O Tux e a Penny foram fazer um piquenique
- nos campos de gelo da Antártida.
- De repente, uma criatura surge de
- trás de um arbusto gelado, dá-se um clarão,
- e o Tux perde os sentidos!
-
- Ao acordar, o Tux verifica que a sua
- Penny desapareceu. No seu lugar
- está uma carta. \"Tux, meu arqui-inimigo!\"
- diz a carta. \"Eu capturei a tua
- preciosa Penny e levei-a para
- a minha fortaleza. O caminho para esta
- está atolhado com os meus guerreiros. Desiste
- sequer de pensares em resgatá-la,
- porque não tens hipótese! -Nolok\"
-
- O Tux olha e vê a fortaleza de Nolok
- ao longe. Determinado em salvar a sua
- amada Penny, ele inicia a sua viagem.")
-
-; Italian (European) by Federico Asara
- (text-it_IT "-Penny viene catturata!
-
- Tux e Penny stavano facendo un bel picnic
- nelle distese ghiacciate dell'Antarctico.
- All'improvviso, una creatura salto fuori
- da un cespuglio ghiacciato, ci fu un lampo
- di luce, e Tux svenne!
-
- Quando Tux si risveglia, nota che Penny
- e' scomparsa. Al suo posto giace una
- lettera. \"Tux, mio arci-nemico!\" - c'e'
- scritto nella lettera. \"Ho catturato
- la tua cara Penny e l'ho portata nella mia
- fortezza. La strada e' piena di miei
- servitori. Percio' arrenditi e non pensare
- neanche di riuscire a salvarla, non
- hai alcuna possibilita'! -Nolok\"
-
- Tux vede la fortezza di Nolok in
- lontananza. Determinato a salvare la sua
- amata Penny, comincia il suo viaggio.")
-
-; German by Marek Moeckel
- (text-de_DE "-Penny ist verschwunden!
-
- Tux und Penny saßen gemütlich beim Picknick
- in den eisigen Ebenen der Antarktis.
- Plötzlich sprang eine dunkle Kreatur hinter
- einem Felsen hervor. Tux sah einen grellen
- Blitz, dann wurde er ohnmächtig.
-
- Als er aufwachte, bemerkte er dass Penny
- verschwunden war. Wo sie eben noch saß, lag
- nun ein Zettel, auf dem stand: \"Tux, mein
- Erzfeind! Ich habe deine Freundin Penny
- entführt und halte sie in meiner Festung
- gefangen. Der Weg dorthin ist übersäht von
- finsteren Kreaturen, die auf mein Kommando
- hören! Versuche gar nicht erst, Penny zu
- retten, denn du hast keine Chance! -Nolok\"
-
- Tux blickte von dem Brief auf und sah Noloks
- Festung in der Ferne. Fest entschlossen
- seine geliebte Penny zu retten, machte
- er sich auf die Reise.")
-)
-
--- /dev/null
+(supertux-text
+ (background "actis.jpg")
+ (text (_ "-Congratulations!
+
+#You have successfully finished
+#Bonus Island I
+
+ featuring levels contributed by
+ Jason W. Thompson
+ Torfi Gunnarsson
+ Abednego
+ Matr1x
+
+
+#If you didn't clear all levels yet,
+#find your way back home and take
+#another path. There is still more
+#challenge waiting for you!
+
+#And there is a secret level to be
+#found as well...
+
+#A big "Thank you" goes out to
+#everyone who contributed to this
+#release. We hope you enjoyed it!))
+)
+
(x 30)
(y 39))
(level (name "/bonus-level4.stl")
- (extro-filelevel "extro-bonus.txt")
+ (extro-filelevel "extro.txt")
(x 32)
(y 46))
(level (name "bonus-level5.stl")
msgstr ""
"Project-Id-Version: world 1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2004-12-02 02:10+0100\n"
+"POT-Creation-Date: 2004-12-05 17:38+0100\n"
"PO-Revision-Date: 2004-12-02 02:25+0100\n"
"Last-Translator: <matze@braunis.de>\n"
"Language-Team: German <de@li.org>\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+#: data/levels/world1/intro.txt:5
+msgid ""
+"-Penny gets captured!\n"
+"\n"
+"#Tux and Penny were out having a nice\n"
+"#picnic on the ice fields of Antarctica.\n"
+"#Suddenly, a creature jumped from\n"
+"#behind an ice bush, there was a flash,\n"
+"#and Tux fell asleep!\n"
+"\n"
+"#When Tux wakes up, he finds that Penny\n"
+"#is missing. Where she lay before now\n"
+"#lies a letter. \"Tux, my arch enemy!\"\n"
+"#says the letter. \"I have captured\n"
+"#your beautiful Penny and have taken her\n"
+"#to my fortress. The path to my fortress\n"
+"#is littered with my minions. Give up on\n"
+"#the thought of trying to reclaim her,\n"
+"#you haven't a chance! -Nolok\"\n"
+"\n"
+"#Tux looks and see Nolok's fortress in\n"
+"#the distance. Determined to save his\n"
+"#beloved Penny, he begins his journey."
+msgstr ""
+"-Penny ist verschwunden!\n"
+"\n"
+"#Tux und Penny sassen gemütlich beim Picknick\n"
+"#in den eisigen Ebenen der Antarktis.\n"
+"#Plötzlich sprang eine dunkle Kreatur hinter\n"
+"#einem Felsen hervor. Tux sah einen grellen\n"
+"#Blitz, dann wurde er ohnmächtig.\n"
+"\n"
+"#Als er aufwachte bemerkte er, dass Penny\n"
+"#verschwunden war. Wo sie eben noch gesessen\n"
+"#hatte lag jetzt ein Zettel:\n"
+"\n"
+"#\"Tux, mein Erzfeind!\n"
+"#Ich habe deine Freundinn Penny entführt und\n"
+"#halte sie in meiner Festung gefangen. Den Weg\n"
+"#dorthin bewachen meine finsteren Kreaturen!\n"
+"#Versuche gar nicht erst sie zu retten, du\n"
+"#hast keine Chance! -Nolok\"\n"
+"\n"
+"#Tux blickte auf und sah Noloks Festung in\n"
+"#der Ferne. Fest entschlossen seine gelibte\n"
+"#Penny zu retten machte er sich auf den Weg.\n"
+
+#: data/levels/world1/worldmap.stwm:4
+msgid "Icyisland"
+msgstr ""
+
#: data/levels/world1/level1.stl:5
msgid "Welcome to Antarctica"
msgstr "Willkommen in Antarktika"
#: data/levels/world1/level2.stl:5
msgid "The Journey Begins"
msgstr "Die Reise Beginnt"
+
+#: data/levels/world1/level3.stl:5
+msgid "Via Nostalgica"
+msgstr ""
+
+#: data/levels/world1/extro.txt:7
+#, fuzzy
+msgid ""
+"-Entering Nolok's Throne Room!\n"
+"\n"
+"#Tux ran into Nolok's throne room,\n"
+"#frantically searching for his beloved.\n"
+"#Alas, he found neither Penny nor Nolok\n"
+"#there, but instead, another note.\n"
+"\n"
+"#\"Well done, Tux, well done. If you are\n"
+"#reading this, you have removed my\n"
+"#control over this icy fortress. But as\n"
+"#you can see, your beloved Penny is not\n"
+"#here. What you did not realize is that\n"
+"#this is just one of my many fortresses,\n"
+"#spread far across the lands!\n"
+"\n"
+"#\"Tux, your ambition is most honorable,\n"
+"#but futile nonetheless. With every\n"
+"#fortress you conquer of mine, I will\n"
+"#escape to another, and take Penny with\n"
+"#me. Do not be silly... it is best that\n"
+"#you give up now.\"\n"
+"\n"
+"#Tux was sadly leaving the room, when he\n"
+"#felt something beneath his foot... an\n"
+"#envelope, addressed to him! Inside was\n"
+"#a roughly sketched map with fortresses\n"
+"#drawn in various lands. On the corner\n"
+"#of the map was Penny's signature, a\n"
+"#drawing of the ice flower.\n"
+"\n"
+"#Tux ran out of the fortress, map in\n"
+"#hand. No, he decided, he would not give\n"
+"#up. Penny was counting on him."
+msgstr ""
+"-In Noloks Thronsaal\n"
+"#Tux betrat Noloks Thronsaal und\n"
+"#suchte verzweifelt nach seiner Geliebten,\n"
+"#leider konnte er weder Penny noch Nolok\n"
+"#dort entdecken, stattdessen fand er eine\n"
+"#weitere Nachricht.\n"
+"\n"
+"#\"Gut gemaacht mein leiber Tux, sehr gut.\n"
+"#Wenn du dies hier liest, hast du diese\n"
+"#eisige Festung von mir befreit. Aber wie\n"
+"#du siehst ist deine geliebte Penny nicht\n"
+"#hier. Hast du nicht gemerkt, dass dies\n"
+"#nur eine meiner vielen Festungen ist,\n"
+"#die über die ganze Welt verteilt sind!\n"
+"\n"
+"#\"Tux, dein Bestreben ist ehrenwert, und\n"
+"#dennoch vergeblich. Mit jeder meiner\n"
+"#Festungen die du eroberst, werde ich zu\n"
+"#einer weiteren fliehen. Sei nicht dumm,\n"
+"#es wäre das beste jetzt aufzugeben.\n"
+"\n"
+"#Tux verliess traurig den Sall, als etwas\n"
+"#unter seinem Fuss raschelte...\n"
+"#Ein Briefumschlag mit seinem Namen!\n"
+"#In dem Umschlag war eine grobe Karte,\n"
+"#die Festungen in verschiedenen Ländern\n"
+"#zeigte. Auf der Rückseite der Karte war\n"
+"#Pennys Zeichen, das Bild einer Eisblume.\n"
+"\n"
+"#Tux nahm die Karte in die Hand und rannte\n"
+"#aus der Festung. Nein, er würde nicht\n"
+"#einfach aufgeben. Penny verliess sich auf\n"
+"#ihn.\n"
--- /dev/null
+; Ending text
+(supertux-text
+ (background "extro.jpg")
+ (music "theme.mod")
+ (show-after "CREDITS")
+
+ (text (_ "-Entering Nolok's Throne Room!
+
+#Tux ran into Nolok's throne room,
+#frantically searching for his beloved.
+#Alas, he found neither Penny nor Nolok
+#there, but instead, another note.
+
+#\"Well done, Tux, well done. If you are
+#reading this, you have removed my
+#control over this icy fortress. But as
+#you can see, your beloved Penny is not
+#here. What you did not realize is that
+#this is just one of my many fortresses,
+#spread far across the lands!
+
+#\"Tux, your ambition is most honorable,
+#but futile nonetheless. With every
+#fortress you conquer of mine, I will
+#escape to another, and take Penny with
+#me. Do not be silly... it is best that
+#you give up now.\"
+
+#Tux was sadly leaving the room, when he
+#felt something beneath his foot... an
+#envelope, addressed to him! Inside was
+#a roughly sketched map with fortresses
+#drawn in various lands. On the corner
+#of the map was Penny's signature, a
+#drawing of the ice flower.
+
+#Tux ran out of the fortress, map in
+#hand. No, he decided, he would not give
+#up. Penny was counting on him."))
+)
+
--- /dev/null
+; Introduction text
+(supertux-text
+ (background "arctis.jpg")
+
+ (text (_ "-Penny gets captured!
+
+#Tux and Penny were out having a nice
+#picnic on the ice fields of Antarctica.
+#Suddenly, a creature jumped from
+#behind an ice bush, there was a flash,
+#and Tux fell asleep!
+
+#When Tux wakes up, he finds that Penny
+#is missing. Where she lay before now
+#lies a letter. \"Tux, my arch enemy!\"
+#says the letter. \"I have captured
+#your beautiful Penny and have taken her
+#to my fortress. The path to my fortress
+#is littered with my minions. Give up on
+#the thought of trying to reclaim her,
+#you haven't a chance! -Nolok\"
+
+#Tux looks and see Nolok's fortress in
+#the distance. Determined to save his
+#beloved Penny, he begins his journey."))
+)
+
;; Generated with Flexlay Editor
(supertux-worldmap
(properties
- (name "Icyisland")
+ (name (_ "Icyisland"))
(name-pt_PT "Ilha Gelada")
(name-de "Eisige Insel")
(name-es "Isla de hielo")
+ (intro-filename "intro.txt")
(music "salcon.mod")
(start_pos_x 4)
(start_pos_y 5))
int done = 0;
float scroll = 0;
float speed = scroll_speed / 50;
+ float left_border = 50;
DrawingContext context;
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
}
Font* font = 0;
+ bool center = true;
switch(names[i][0])
{
case ' ': font = small_font; break;
case '\t': font = normal_font; break;
case '-': font = heading_font; break;
case '*': font = reference_font; break;
- default: font = reference_font; break;
+ case '#': font = normal_font; center = false; break;
+ default:
+ break;
}
-
- context.draw_text(font,
- names[i].substr(1, names[i].size()-1),
- Vector(screen->w/2, screen->h + y - scroll), CENTER_ALLIGN, LAYER_FOREGROUND1);
+
+ if(font) {
+ if(center) {
+ context.draw_text(font,
+ names[i].substr(1, names[i].size()-1),
+ Vector(screen->w/2, screen->h + y - scroll),
+ CENTER_ALLIGN, LAYER_FOREGROUND1);
+ } else {
+ context.draw_text(font,
+ names[i].substr(1, names[i].size()-1),
+ Vector(left_border, screen->h + y - scroll),
+ LEFT_ALLIGN, LAYER_FOREGROUND1);
+ }
+ }
+
y += font->get_height() + ITEMS_SPACE;
}
{
SoundManager::get()->play_sound(IDToSound(SND_SQUISH), get_pos(),
player.get_pos());
+ physic.enable_gravity(true);
physic.set_velocity_x(0);
physic.set_velocity_y(0);
set_state(STATE_SQUISHED);
return CONTINUE;
}
+
+void
+Jumpy::active_action(float elapsed_time)
+{
+ BadGuy::active_action(elapsed_time);
+
+ 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");
+}
HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit);
void write(lisp::Writer& writer);
+ void active_action(float);
private:
HitResponse hit(const CollisionHit& hit);
#include "collision_grid.h"
#include "special/collision.h"
#include "sector.h"
+#include "collision_grid_iterator.h"
static const float DELTA = .001;
CollisionGrid::CollisionGrid(float newwidth, float newheight)
- : width(newwidth), height(newheight), cell_width(128), cell_height(128)
+ : width(newwidth), height(newheight), cell_width(128), cell_height(128),
+ iterator_timestamp(0)
{
cells_x = size_t(width / cell_width) + 1;
cells_y = size_t(height / cell_height) + 1;
void
CollisionGrid::check_collisions()
{
- for(Objects::iterator i = objects.begin(); i != objects.end(); ++i) {
- ObjectWrapper* wrapper = *i;
+ CollisionGridIterator iter(*this, Sector::current()->get_active_region());
+ while(ObjectWrapper* wrapper = iter.next_wrapper()) {
MovingObject* object = wrapper->object;
if(!object->is_valid())
continue;
void
CollisionGrid::collide_object(ObjectWrapper* wrapper)
{
- static int timestamp = 0;
- timestamp++;
+ iterator_timestamp++;
const Rectangle& bbox = wrapper->object->bbox;
for(float y = bbox.p1.y; y < bbox.p2.y; y += cell_height) {
entry = entry->next) {
ObjectWrapper* wrapper2 = entry->object_wrapper;
// only check each object once (even if it is in multiple cells)
- if(wrapper2->timestamp == timestamp)
+ if(wrapper2->timestamp == iterator_timestamp)
continue;
// don't collide with objects we already collided with
if(wrapper2->id <= wrapper->id)
continue;
- wrapper->timestamp = timestamp;
+ wrapper->timestamp = iterator_timestamp;
collide_object_object(wrapper, wrapper2);
}
}
void check_collisions();
private:
+ friend class CollisionGridIterator;
+
struct ObjectWrapper
{
MovingObject* object;
float height;
float cell_width;
float cell_height;
+ int iterator_timestamp;
};
extern CollisionGrid* bla;
stream << slot;
std::string slotfile = st_save_dir + "/slot" + stream.str() + ".stsg";
- if (access(slotfile.c_str(), F_OK) != 0)
- {
- shrink_fade(Vector(screen->w/2,screen->h/2), 600);
- draw_intro();
- }
-
fadeout(256);
DrawingContext context;
context.draw_text(white_text, "Loading...",
#include "resources.h"
#include "statistics.h"
#include "collision_grid.h"
+#include "collision_grid_iterator.h"
#include "special/collision.h"
#include "math/rectangle.h"
#include "math/aatriangle.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"
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 best_reset_point;
}
+Rectangle
+Sector::get_active_region()
+{
+ return Rectangle(
+ camera->get_translation() - Vector(1600, 1200),
+ camera->get_translation() + Vector(1600, 1200));
+}
+
void
Sector::action(float elapsed_time)
{
player->check_bounds(camera);
-
+
+#if 0
+ CollisionGridIterator iter(*grid, get_active_region());
+ while(MovingObject* object = iter.next()) {
+ if(!object->is_valid())
+ continue;
+
+ object->action(elapsed_time);
+ }
+#else
/* update objects */
for(GameObjects::iterator i = gameobjects.begin();
i != gameobjects.end(); ++i) {
object->action(elapsed_time);
}
-
+#endif
+
/* Handle all possible collisions. */
collision_handler();
update_game_objects();
{
context.push_transform();
context.set_translation(camera->get_translation());
-
+
+#if 0
+ CollisionGridIterator iter(*grid, get_active_region());
+ while(MovingObject* object = iter.next()) {
+ if(!object->is_valid())
+ continue;
+
+ object->draw(context);
+ }
+#else
for(GameObjects::iterator i = gameobjects.begin();
i != gameobjects.end(); ++i) {
GameObject* object = *i;
object->draw(context);
}
+#endif
context.pop_transform();
}
typedef std::vector<GameObject*> GameObjects;
GameObjects gameobjects;
+ Rectangle get_active_region();
+
private:
void fix_old_tiles();
Menu* worldmap_menu = 0;
+static const float TUXSPEED = 200;
+
namespace WorldMapNS {
Direction reverse_dir(Direction direction)
}
else
{
- // Let tux walk a few pixels (20 pixel/sec)
- offset += 20.0f * delta;
+ // Let tux walk
+ offset += TUXSPEED * delta;
if (offset > 32)
{ // We reached the next tile, so we check what to do now
name = "<no title>";
music = "salcon.mod";
+ intro_displayed = false;
total_stats.reset();
}
const lisp::Lisp* props = iter.lisp();
props->get("name", name);
props->get("music", music);
+ props->get("intro-filename", intro_filename);
props->get("start_pos_x", start_x);
props->get("start_pos_y", start_y);
} else if(iter.item() == "special-tiles") {
}
/* The porpose of the next checking is that if the player lost
the level (in case there is one), don't show anything */
- if(level_finished)
- {
- if (!level->extro_filename.empty())
- {
+ if(level_finished) {
+ if (!level->extro_filename.empty()) {
// Display a text file
- display_text_file(level->extro_filename, SCROLL_SPEED_MESSAGE,
- white_big_text , white_text, white_small_text, blue_text );
- }
+ std::string filename = levels_path + level->extro_filename;
+ display_text_file(filename, SCROLL_SPEED_MESSAGE,
+ white_big_text , white_text, white_small_text, blue_text );
+ }
if (!level->next_worldmap.empty())
{
song = SoundManager::get()->load_music(datadir + "/music/" + music);
SoundManager::get()->play_music(song);
- FrameRate frame_rate(10);
- frame_rate.set_frame_limit(false);
-
- frame_rate.start();
+ if(!intro_displayed && intro_filename != "") {
+ std::string filename = levels_path + intro_filename;
+ display_text_file(filename, SCROLL_SPEED_MESSAGE,
+ white_big_text, white_text, white_small_text, blue_text);
+ intro_displayed = true;
+ }
+ Uint32 lastticks = SDL_GetTicks();
DrawingContext context;
- while(!quit)
- {
- float delta = frame_rate.get();
-
- delta *= 1.3f;
-
- if (delta > 10.0f)
- delta = .3f;
-
- frame_rate.update();
-
- Vector tux_pos = tux->get_pos();
- if (1)
- {
- offset.x = -tux_pos.x + screen->w/2;
- offset.y = -tux_pos.y + screen->h/2;
-
- if (offset.x > 0) offset.x = 0;
- if (offset.y > 0) offset.y = 0;
+ while(!quit) {
+ Uint32 ticks = SDL_GetTicks();
+ float elapsed_time = float(ticks - lastticks) / 1000;
+ global_time += elapsed_time;
+ lastticks = ticks;
+
+ // 40 fps minimum
+ if(elapsed_time > .025)
+ elapsed_time = .025;
+
+ Vector tux_pos = tux->get_pos();
+
+ offset.x = -tux_pos.x + screen->w/2;
+ offset.y = -tux_pos.y + screen->h/2;
- if (offset.x < screen->w - width*32) offset.x = screen->w - width*32;
- if (offset.y < screen->h - height*32) offset.y = screen->h - height*32;
- }
+ if (offset.x > 0) offset.x = 0;
+ if (offset.y > 0) offset.y = 0;
- draw(context, offset);
- get_input();
- update(delta);
+ if (offset.x < screen->w - width*32) offset.x = screen->w - width*32;
+ if (offset.y < screen->h - height*32) offset.y = screen->h - height*32;
+
+ draw(context, offset);
+ get_input();
+ update(elapsed_time);
- if(Menu::current())
- {
- Menu::current()->draw(context);
- mouse_cursor->draw(context);
- }
-
- context.do_drawing();
-
- SDL_Delay(20);
+ if(Menu::current()) {
+ Menu::current()->draw(context);
+ mouse_cursor->draw(context);
}
+
+ context.do_drawing();
+ }
}
void
writer.write_string("title",
std::string(name + " - " + nb_solved_levels_str+"/"+total_levels_str));
writer.write_string("map", map_filename);
+ writer.write_bool("intro-displayed", intro_displayed);
writer.write_int("lives", player_status.lives);
writer.write_int("distros", player_status.lives);
writer.write_int("max-score-multiplier", player_status.max_score_multiplier);
savegame->get("map", map_filename);
load_map();
+ savegame->get("intro-displayed", intro_displayed);
savegame->get("lives", player_status.lives);
savegame->get("distros", player_status.distros);
savegame->get("max-score-multiplier", player_status.max_score_multiplier);
}
} // namespace WorldMapNS
-
-/* Local Variables: */
-/* mode:c++ */
-/* End: */
-
Vector offset;
std::string savegame_file;
+
+ std::string intro_filename;
+ bool intro_displayed;
void get_level_title(Level& level);