projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ice yeti animation updates
[supertux.git]
/
src
/
tile.cpp
diff --git
a/src/tile.cpp
b/src/tile.cpp
index
118055e
..
68e271e
100644
(file)
--- a/
src/tile.cpp
+++ b/
src/tile.cpp
@@
-36,6
+36,12
@@
Tile::Tile()
{
}
{
}
+Tile::Tile(unsigned int id_, Uint32 attributes_, const ImageSpec& imagespec)
+ : id(id_), editor_image(0), attributes(attributes_), data(0), anim_fps(1)
+{
+ imagespecs.push_back(imagespec);
+}
+
Tile::~Tile()
{
for(std::vector<Surface*>::iterator i = images.begin(); i != images.end();
Tile::~Tile()
{
for(std::vector<Surface*>::iterator i = images.begin(); i != images.end();
@@
-52,7
+58,7
@@
Tile::parse(const lisp::Lisp& reader)
throw std::runtime_error("Missing tile-id.");
}
throw std::runtime_error("Missing tile-id.");
}
- bool value;
+ bool value
= false
;
if(reader.get("solid", value) && value)
attributes |= SOLID;
if(reader.get("unisolid", value) && value)
if(reader.get("solid", value) && value)
attributes |= SOLID;
if(reader.get("unisolid", value) && value)
@@
-111,7
+117,7
@@
Tile::parse_images(const lisp::Lisp& images_lisp)
const lisp::Lisp* ptr = cur->get_cdr();
std::string file;
const lisp::Lisp* ptr = cur->get_cdr();
std::string file;
- float x
, y, w, h
;
+ float x
= 0, y = 0, w = 0, h = 0
;
ptr->get_car()->get(file); ptr = ptr->get_cdr();
ptr->get_car()->get(x); ptr = ptr->get_cdr();
ptr->get_car()->get(y); ptr = ptr->get_cdr();
ptr->get_car()->get(file); ptr = ptr->get_cdr();
ptr->get_car()->get(x); ptr = ptr->get_cdr();
ptr->get_car()->get(y); ptr = ptr->get_cdr();
@@
-137,18
+143,18
@@
Tile::load_images(const std::string& tilesetpath)
Surface* surface;
std::string file = tilesetpath + spec.file;
if(spec.rect.get_width() <= 0) {
Surface* surface;
std::string file = tilesetpath + spec.file;
if(spec.rect.get_width() <= 0) {
- surface = new Surface(file
, true
);
+ surface = new Surface(file);
} else {
surface = new Surface(file,
(int) spec.rect.p1.x,
(int) spec.rect.p1.y,
(int) spec.rect.get_width(),
} else {
surface = new Surface(file,
(int) spec.rect.p1.x,
(int) spec.rect.p1.y,
(int) spec.rect.get_width(),
- (int) spec.rect.get_height()
, true
);
+ (int) spec.rect.get_height());
}
images.push_back(surface);
}
if(editor_imagefile != "") {
}
images.push_back(surface);
}
if(editor_imagefile != "") {
- editor_image = new Surface(tilesetpath + editor_imagefile
, true
);
+ editor_image = new Surface(tilesetpath + editor_imagefile);
}
}
}
}
@@
-167,7
+173,7
@@
void
Tile::draw(DrawingContext& context, const Vector& pos, int layer) const
{
if(images.size() > 1) {
Tile::draw(DrawingContext& context, const Vector& pos, int layer) const
{
if(images.size() > 1) {
- size_t frame = size_t(g
lobal
_time * anim_fps) % images.size();
+ size_t frame = size_t(g
ame
_time * anim_fps) % images.size();
context.draw_surface(images[frame], pos, layer);
} else if (images.size() == 1) {
context.draw_surface(images[0], pos, layer);
context.draw_surface(images[frame], pos, layer);
} else if (images.size() == 1) {
context.draw_surface(images[0], pos, layer);