projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Woldmap images for earthtux
[supertux.git]
/
src
/
worldmap
/
level.cpp
diff --git
a/src/worldmap/level.cpp
b/src/worldmap/level.cpp
index
90383ba
..
85e987f
100644
(file)
--- a/
src/worldmap/level.cpp
+++ b/
src/worldmap/level.cpp
@@
-1,5
+1,5
@@
// SuperTux
// SuperTux
-// Copyright (C) 2004 Ingo Ruhnke <grumbel@gm
x.de
>
+// Copyright (C) 2004 Ingo Ruhnke <grumbel@gm
ail.com
>
// Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
//
// This program is free software: you can redistribute it and/or modify
// Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
//
// This program is free software: you can redistribute it and/or modify
@@
-23,30
+23,38
@@
#include "sprite/sprite_manager.hpp"
#include "util/file_system.hpp"
#include "util/log.hpp"
#include "sprite/sprite_manager.hpp"
#include "util/file_system.hpp"
#include "util/log.hpp"
+#include "util/reader.hpp"
#include "video/drawing_context.hpp"
#include "worldmap/level.hpp"
#include "video/drawing_context.hpp"
#include "worldmap/level.hpp"
-namespace
WorldMapNS
{
+namespace
worldmap
{
-LevelTile::LevelTile(const std::string& basedir, const lisp::Lisp* lisp) :
- solved(false),
- auto_play(false),
- basedir(basedir),
+LevelTile::LevelTile(const std::string& basedir_, const Reader& lisp) :
+ pos(),
+ title(),
+ solved(false),
+ perfect(false),
+ auto_play(false),
+ sprite(),
+ statistics(),
+ target_time(),
+ extro_script(),
+ basedir(basedir_),
picture_cached(false),
picture(0)
{
picture_cached(false),
picture(0)
{
- lisp
->
get("name", name);
- lisp
->
get("x", pos.x);
- lisp
->
get("y", pos.y);
- lisp
->
get("auto-play", auto_play);
+ lisp
.
get("name", name);
+ lisp
.
get("x", pos.x);
+ lisp
.
get("y", pos.y);
+ lisp
.
get("auto-play", auto_play);
std::string spritefile = "images/worldmap/common/leveldot.sprite";
std::string spritefile = "images/worldmap/common/leveldot.sprite";
- lisp
->
get("sprite", spritefile);
- sprite =
sprite_manager
->create(spritefile);
+ lisp
.
get("sprite", spritefile);
+ sprite =
SpriteManager::current()
->create(spritefile);
- lisp
->
get("extro-script", extro_script);
+ lisp
.
get("extro-script", extro_script);
- if (!PHYSFS_exists((basedir + name).c_str()))
+ if (!PHYSFS_exists((basedir
_
+ name).c_str()))
{
log_warning << "level file '" << name
<< "' does not exist and will not be added to the worldmap" << std::endl;
{
log_warning << "level file '" << name
<< "' does not exist and will not be added to the worldmap" << std::endl;
@@
-70,19
+78,37
@@
LevelTile::update(float )
{
}
{
}
-const Surface*
-LevelTile::
get_picture
()
+void
+LevelTile::
update_sprite_action
()
{
{
- if (picture_cached) return picture;
- picture_cached = true;
- std::string fname = FileSystem::strip_extension(basedir + name)+".jpg";
- if (!PHYSFS_exists(fname.c_str())) {
- return 0;
+ if (perfect)
+ {
+ sprite->set_action("perfect");
+ }
+ else if (solved)
+ {
+ sprite->set_action("perfect");
+ }
+ else
+ {
+ sprite->set_action("default");
}
}
- picture = new Surface(fname);
- return picture;
}
}
+void
+LevelTile::set_solved(bool v)
+{
+ solved = v;
+ update_sprite_action();
+}
+
+void
+LevelTile::set_perfect(bool v)
+{
+ perfect = v;
+ update_sprite_action();
}
}
+} // namespace worldmap
+
/* EOF */
/* EOF */