* Sector::collision_attributes includes SHIFT_DELTA slop in nearby tiles (allows ice to function)
SVN-Revision: 5887
Addon::write(lisp::Writer& writer) const
{
writer.start_list("supertux-addoninfo");
- if (kind != "") writer.write_string("kind", kind);
- if (title != "") writer.write_string("title", title);
- if (author != "") writer.write_string("author", author);
- if (license != "") writer.write_string("license", license);
- if (http_url != "") writer.write_string("http-url", http_url);
- if (suggested_filename != "") writer.write_string("file", suggested_filename);
- if (stored_md5 != "") writer.write_string("md5", stored_md5);
+ if (kind != "") writer.write("kind", kind);
+ if (title != "") writer.write("title", title);
+ if (author != "") writer.write("author", author);
+ if (license != "") writer.write("license", license);
+ if (http_url != "") writer.write("http-url", http_url);
+ if (suggested_filename != "") writer.write("file", suggested_filename);
+ if (stored_md5 != "") writer.write("md5", stored_md5);
writer.end_list("supertux-addoninfo");
}
void
-AddonManager::read_config(const lisp::Lisp& lisp)
+AddonManager::read(const lisp::Lisp& lisp)
{
- lisp.get_vector("disabled-addons", ignored_addon_filenames);
+ lisp.get("disabled-addons", ignored_addon_filenames);
}
void
-AddonManager::write_config(lisp::Writer& writer)
+AddonManager::write(lisp::Writer& writer)
{
- writer.write_string_vector("disabled-addons", ignored_addon_filenames);
+ writer.write("disabled-addons", ignored_addon_filenames);
}
/**
* Write AddonManager configuration to Lisp
*/
- void write_config(lisp::Writer& writer);
+ void write(lisp::Writer& writer);
/**
* Read AddonManager configuration from Lisp
*/
- void read_config(const lisp::Lisp& lisp);
+ void read(const lisp::Lisp& lisp);
protected:
std::vector<Addon*> addons;
{
writer.start_list("angrystone");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("angrystone");
}
{
writer.start_list("bouncingsnowball");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("bouncingsnowball");
}
Dart::write(lisp::Writer& writer)
{
writer.start_list("dart");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("dart");
}
DartTrap::write(lisp::Writer& writer)
{
writer.start_list("darttrap");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
- writer.write_float("initial-delay", initial_delay);
- writer.write_float("fire-delay", fire_delay);
- writer.write_int("ammo", ammo);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
+ writer.write("initial-delay", initial_delay);
+ writer.write("fire-delay", fire_delay);
+ writer.write("ammo", ammo);
writer.end_list("darttrap");
}
set_colgroup_active(COLGROUP_MOVING_STATIC);
sound_manager->preload("sounds/squish.wav");
reader.get("cycle", cycle);
- reader.get_vector("badguy", badguys);
+ reader.get("badguy", badguys);
random = false; // default
reader.get("random", random);
type = "dropper"; //default
{
writer.start_list("dispenser");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
- writer.write_float("cycle", cycle);
- writer.write_bool("random", random);
- writer.write_string("type", type);
- writer.write_string_vector("badguy", badguys);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
+ writer.write("cycle", cycle);
+ writer.write("random", random);
+ writer.write("type", type);
+ writer.write("badguy", badguys);
writer.end_list("dispenser");
}
{
writer.start_list("fish");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("fish");
}
{
writer.start_list("flame");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
- writer.write_float("radius", radius);
- writer.write_float("speed", speed);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
+ writer.write("radius", radius);
+ writer.write("speed", speed);
writer.end_list("flame");
}
{
writer.start_list("flyingsnowball");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("flyingsnowball");
}
{
writer.start_list("jumpy");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("jumpy");
}
{
writer.start_list("kugelblitz");
- writer.write_float("x", start_position.x);
+ writer.write("x", start_position.x);
writer.end_list("kugelblitz");
}
Mole::write(lisp::Writer& writer)
{
writer.start_list("mole");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("mole");
}
MoleRock::write(lisp::Writer& writer)
{
writer.start_list("mole_rock");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("mole_rock");
}
{
writer.start_list("mrrocket");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("mrrocket");
}
{
writer.start_list("plant");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("plant");
}
SkullyHop::write(lisp::Writer& writer)
{
writer.start_list("skullyhop");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("skullyhop");
}
{
writer.start_list("spidermite");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("spidermite");
}
Stalactite::write(lisp::Writer& writer)
{
writer.start_list("stalactite");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("stalactite");
}
Toad::write(lisp::Writer& writer)
{
writer.start_list("toad");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("toad");
}
{
writer.start_list("totem");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("totem");
}
void
WalkingBadguy::write(lisp::Writer& writer)
{
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
}
void
{
writer.start_list("yeti");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("yeti");
}
YetiStalactite::write(lisp::Writer& writer)
{
writer.start_list("yeti_stalactite");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("yeti_stalactite");
}
{
writer.start_list("zeekling");
- writer.write_float("x", start_position.x);
- writer.write_float("y", start_position.y);
+ writer.write("x", start_position.x);
+ writer.write("y", start_position.y);
writer.end_list("zeekling");
}
JoystickKeyboardController::write(lisp::Writer& writer)
{
writer.start_list("keymap");
- writer.write_bool("jump-with-up", jump_with_up_kbd);
+ writer.write("jump-with-up", jump_with_up_kbd);
for(KeyMap::iterator i = keymap.begin(); i != keymap.end(); ++i) {
writer.start_list("map");
- writer.write_int("key", (int) i->first);
- writer.write_string("control", controlNames[i->second]);
+ writer.write("key", (int) i->first);
+ writer.write("control", controlNames[i->second]);
writer.end_list("map");
}
writer.end_list("keymap");
writer.start_list("joystick");
- writer.write_int("dead-zone", dead_zone);
- writer.write_bool("jump-with-up", jump_with_up_joy);
+ writer.write("dead-zone", dead_zone);
+ writer.write("jump-with-up", jump_with_up_joy);
for(ButtonMap::iterator i = joy_button_map.begin(); i != joy_button_map.end();
++i) {
writer.start_list("map");
- writer.write_int("button", i->first);
- writer.write_string("control", controlNames[i->second]);
+ writer.write("button", i->first);
+ writer.write("control", controlNames[i->second]);
writer.end_list("map");
}
for(HatMap::iterator i = joy_hat_map.begin(); i != joy_hat_map.end(); ++i) {
writer.start_list("map");
- writer.write_int("hat", i->first);
- writer.write_string("control", controlNames[i->second]);
+ writer.write("hat", i->first);
+ writer.write("control", controlNames[i->second]);
writer.end_list("map");
}
for(AxisMap::iterator i = joy_axis_map.begin(); i != joy_axis_map.end(); ++i) {
writer.start_list("map");
- writer.write_int("axis", i->first);
- writer.write_string("control", controlNames[i->second]);
+ writer.write("axis", i->first);
+ writer.write("control", controlNames[i->second]);
writer.end_list("map");
}
const lisp::Lisp* config_addons_lisp = config_lisp->get_lisp("addons");
if(config_addons_lisp) {
- AddonManager::get_instance().read_config(*config_addons_lisp);
+ AddonManager::get_instance().read(*config_addons_lisp);
}
}
writer.start_list("supertux-config");
- writer.write_bool("show_fps", show_fps);
- writer.write_bool("console", console_enabled);
- writer.write_string("locale", locale);
+ writer.write("show_fps", show_fps);
+ writer.write("console", console_enabled);
+ writer.write("locale", locale);
writer.start_list("video");
- writer.write_bool("fullscreen", use_fullscreen);
- writer.write_string("video", get_video_string(video));
- writer.write_bool("vsync", try_vsync);
+ writer.write("fullscreen", use_fullscreen);
+ writer.write("video", get_video_string(video));
+ writer.write("vsync", try_vsync);
- writer.write_int("fullscreen_width", fullscreen_width);
- writer.write_int("fullscreen_height", fullscreen_height);
+ writer.write("fullscreen_width", fullscreen_width);
+ writer.write("fullscreen_height", fullscreen_height);
- writer.write_int("window_width", window_width);
- writer.write_int("window_height", window_height);
+ writer.write("window_width", window_width);
+ writer.write("window_height", window_height);
- writer.write_int("aspect_width", aspect_width);
- writer.write_int("aspect_height", aspect_height);
+ writer.write("aspect_width", aspect_width);
+ writer.write("aspect_height", aspect_height);
writer.end_list("video");
writer.start_list("audio");
- writer.write_bool("sound_enabled", sound_enabled);
- writer.write_bool("music_enabled", music_enabled);
+ writer.write("sound_enabled", sound_enabled);
+ writer.write("music_enabled", music_enabled);
writer.end_list("audio");
if(main_controller) {
}
writer.start_list("addons");
- AddonManager::get_instance().write_config(writer);
+ AddonManager::get_instance().write(writer);
writer.end_list("addons");
writer.end_list("supertux-config");
writer->start_list("supertux-level");
int version = 2;
- writer->write_int("version", version);
+ writer->write("version", version);
- writer->write_string("name", name, true);
- writer->write_string("author", author);
+ writer->write("name", name, true);
+ writer->write("author", author);
if(on_menukey_script != "")
- writer->write_string("on-menukey-script", on_menukey_script);
+ writer->write("on-menukey-script", on_menukey_script);
for(Sectors::iterator i = sectors.begin(); i != sectors.end(); ++i) {
Sector* sector = *i;
}
template<class T>
- bool get_vector(const char* name, std::vector<T>& vec) const
+ bool get(const char* name, std::vector<T>& vec) const
{
vec.clear();
}
void
-Writer::write_int(const std::string& name, int value)
+Writer::write(const std::string& name, int value)
{
indent();
*out << '(' << name << ' ' << value << ")\n";
}
void
-Writer::write_float(const std::string& name, float value)
+Writer::write(const std::string& name, float value)
{
indent();
*out << '(' << name << ' ' << value << ")\n";
}
void
-Writer::write_string(const std::string& name, const std::string& value,
+Writer::write(const std::string& name, const std::string& value,
bool translatable)
{
indent();
}
void
-Writer::write_bool(const std::string& name, bool value)
+Writer::write(const std::string& name, bool value)
{
indent();
*out << '(' << name << ' ' << (value ? "#t" : "#f") << ")\n";
}
void
-Writer::write_int_vector(const std::string& name,
+Writer::write(const std::string& name,
const std::vector<int>& value)
{
indent();
}
void
-Writer::write_int_vector(const std::string& name,
+Writer::write(const std::string& name,
const std::vector<unsigned int>& value)
{
indent();
}
void
-Writer::write_float_vector(const std::string& name,
+Writer::write(const std::string& name,
const std::vector<float>& value)
{
indent();
}
void
-Writer::write_string_vector(const std::string& name,
+Writer::write(const std::string& name,
const std::vector<std::string>& value)
{
indent();
void start_list(const std::string& listname, bool string = false);
- void write_int(const std::string& name, int value);
- void write_float(const std::string& name, float value);
- void write_string(const std::string& name, const std::string& value,
+ void write(const std::string& name, int value);
+ void write(const std::string& name, float value);
+ void write(const std::string& name, const std::string& value,
bool translatable = false);
- void write_bool(const std::string& name, bool value);
- void write_int_vector(const std::string& name, const std::vector<int>& value);
- void write_int_vector(const std::string& name, const std::vector<unsigned int>& value);
- void write_float_vector(const std::string& name, const std::vector<float>& value);
- void write_string_vector(const std::string& name, const std::vector<std::string>& value);
+ void write(const std::string& name, const char* value,
+ bool translatable = false) { write(name, static_cast<const std::string&>(value), translatable); }
+ void write(const std::string& name, bool value);
+ void write(const std::string& name, const std::vector<int>& value);
+ void write(const std::string& name, const std::vector<unsigned int>& value);
+ void write(const std::string& name, const std::vector<float>& value);
+ void write(const std::string& name, const std::vector<std::string>& value);
// add more write-functions when needed...
void end_list(const std::string& listname);
writer.start_list("background");
if (image_top.get() != NULL)
- writer.write_string("image-top", imagefile_top);
+ writer.write("image-top", imagefile_top);
- writer.write_string("image", imagefile);
+ writer.write("image", imagefile);
if (image_bottom.get() != NULL)
- writer.write_string("image-bottom", imagefile_bottom);
+ writer.write("image-bottom", imagefile_bottom);
- writer.write_float("speed", speed);
- writer.write_float("speed-y", speed_y);
- writer.write_int("layer", layer);
+ writer.write("speed", speed);
+ writer.write("speed-y", speed_y);
+ writer.write("layer", layer);
writer.end_list("background");
}
writer.start_list("camera");
if(mode == NORMAL) {
- writer.write_string("mode", "normal");
+ writer.write("mode", "normal");
} else if(mode == AUTOSCROLL) {
- writer.write_string("mode", "autoscroll");
+ writer.write("mode", "autoscroll");
autoscroll_path->write(writer);
} else if(mode == MANUAL) {
- writer.write_string("mode", "manual");
+ writer.write("mode", "manual");
}
writer.end_list("camera");
Decal::write(lisp::Writer& writer)
{
writer.start_list("decal");
- writer.write_float("x", pos.x);
- writer.write_float("y", pos.y);
- writer.write_string("image", imagefile);
- writer.write_int("layer", layer);
+ writer.write("x", pos.x);
+ writer.write("y", pos.y);
+ writer.write("image", imagefile);
+ writer.write("layer", layer);
writer.end_list("decal");
}
Firefly::write(lisp::Writer& writer)
{
writer.start_list("firefly");
- writer.write_float("x", bbox.p1.x);
- writer.write_float("y", bbox.p1.y);
+ writer.write("x", bbox.p1.x);
+ writer.write("y", bbox.p1.y);
writer.end_list("firefly");
}
{
reader.get("layer", layer);
std::vector<float> bkgd_top_color, bkgd_bottom_color;
- if(!reader.get_vector("top_color", bkgd_top_color) ||
- !reader.get_vector("bottom_color", bkgd_bottom_color))
+ if(!reader.get("top_color", bkgd_top_color) ||
+ !reader.get("bottom_color", bkgd_bottom_color))
throw std::runtime_error("Must specify top_color and bottom_color in gradient");
gradient_top = Color(bkgd_top_color);
bkgd_bottom_color.push_back(gradient_bottom.red);
bkgd_bottom_color.push_back(gradient_bottom.green);
bkgd_bottom_color.push_back(gradient_bottom.blue);
- writer.write_float_vector("top_color", bkgd_top_color);
- writer.write_float_vector("bottom_color", bkgd_bottom_color);
+ writer.write("top_color", bkgd_top_color);
+ writer.write("bottom_color", bkgd_bottom_color);
- writer.write_int("layer", layer);
+ writer.write("layer", layer);
writer.end_list("gradient");
}
Ispy::write(lisp::Writer& writer)
{
writer.start_list("ispy");
- writer.write_float("x", bbox.p1.x);
- writer.write_float("y", bbox.p1.y);
- writer.write_string("script", script);
+ writer.write("x", bbox.p1.x);
+ writer.write("y", bbox.p1.y);
+ writer.write("script", script);
switch (dir)
{
case DOWN:
- writer.write_string("direction", "down"); break;
+ writer.write("direction", "down"); break;
case LEFT:
- writer.write_string("direction", "left"); break;
+ writer.write("direction", "left"); break;
case RIGHT:
- writer.write_string("direction", "right"); break;
+ writer.write("direction", "right"); break;
default: break;
}
writer.end_list("ispy");
{
//get color from lisp
std::vector<float> vColor;
- reader.get_vector("color", vColor);
+ reader.get("color", vColor);
lightcolor = Color(vColor);
lightsprite = sprite_manager->create("images/objects/lightmap_light/lightmap_light.sprite");
lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
set_group(COLGROUP_STATIC);
//get color from lisp
std::vector<float> vColor;
- lisp.get_vector("color", vColor );
+ lisp.get("color", vColor );
color = Color( vColor );
//all alpha to make the sprite still visible
SnowParticleSystem::write(lisp::Writer& writer)
{
writer.start_list("particles-snow");
- writer.write_int("z-pos", z_pos);
+ writer.write("z-pos", z_pos);
writer.end_list("particles-snow");
}
GhostParticleSystem::write(lisp::Writer& writer)
{
writer.start_list("particles-ghosts");
- writer.write_int("z-pos", z_pos);
+ writer.write("z-pos", z_pos);
writer.end_list("particles-ghosts");
}
CloudParticleSystem::write(lisp::Writer& writer)
{
writer.start_list("particles-clouds");
- writer.write_int("z-pos", z_pos);
+ writer.write("z-pos", z_pos);
writer.end_list("particles-clouds");
}
RainParticleSystem::write(lisp::Writer& writer)
{
writer.start_list("particles-rain");
- writer.write_int("z-pos", z_pos);
+ writer.write("z-pos", z_pos);
writer.end_list("particles-rain");
}
CometParticleSystem::write(lisp::Writer& writer)
{
writer.start_list("particles-comets");
- writer.write_int("z-pos", z_pos);
+ writer.write("z-pos", z_pos);
writer.end_list("particles-comets");
}
switch(mode) {
case ONE_SHOT:
- writer.write_string("mode", "oneshot");
+ writer.write("mode", "oneshot");
break;
case PING_PONG:
- writer.write_string("mode", "pingpong");
+ writer.write("mode", "pingpong");
break;
case CIRCULAR:
- writer.write_string("mode", "circular");
+ writer.write("mode", "circular");
break;
default:
log_warning << "Don't know how to write mode " << (int) mode << " ?!?" << std::endl;
const Node& node = nodes[i];
writer.start_list("node");
- writer.write_float("x", node.position.x);
- writer.write_float("y", node.position.y);
- writer.write_float("time", node.time);
+ writer.write("x", node.position.x);
+ writer.write("y", node.position.y);
+ writer.write("time", node.time);
writer.end_list("node");
}
{
writer.start_list("rock");
- writer.write_float("x", bbox.p1.x);
- writer.write_float("y", bbox.p1.y);
+ writer.write("x", bbox.p1.x);
+ writer.write("y", bbox.p1.y);
writer.end_list("rock");
}
lisp.get("angle", angle);
std::vector<float> vColor;
- if( lisp.get_vector( "color", vColor ) ){
+ if( lisp.get( "color", vColor ) ){
color = Color( vColor );
}
if(width < 0 || height < 0)
throw std::runtime_error("Invalid/No width/height specified in tilemap.");
- if(!reader.get_vector("tiles", tiles))
+ if(!reader.get("tiles", tiles))
throw std::runtime_error("No tiles in tilemap.");
if(int(tiles.size()) != width*height) {
{
writer.start_list("tilemap");
- writer.write_int("z-pos", z_pos);
+ writer.write("z-pos", z_pos);
- writer.write_bool("solid", solid);
- writer.write_float("speed", speed_x);
- writer.write_float("speed-y", speed_y);
- writer.write_int("width", width);
- writer.write_int("height", height);
- writer.write_int_vector("tiles", tiles);
+ writer.write("solid", solid);
+ writer.write("speed", speed_x);
+ writer.write("speed-y", speed_y);
+ writer.write("width", width);
+ writer.write("height", height);
+ writer.write("tiles", tiles);
writer.end_list("tilemap");
}
{
switch(bonus) {
case NO_BONUS:
- writer.write_string("bonus", "none");
+ writer.write("bonus", "none");
break;
case GROWUP_BONUS:
- writer.write_string("bonus", "growup");
+ writer.write("bonus", "growup");
break;
case FIRE_BONUS:
- writer.write_string("bonus", "fireflower");
+ writer.write("bonus", "fireflower");
break;
case ICE_BONUS:
- writer.write_string("bonus", "iceflower");
+ writer.write("bonus", "iceflower");
break;
default:
log_warning << "Unknown bonus type." << std::endl;
- writer.write_string("bonus", "none");
+ writer.write("bonus", "none");
}
- writer.write_int("fireflowers", max_fire_bullets);
- writer.write_int("iceflowers", max_ice_bullets);
+ writer.write("fireflowers", max_fire_bullets);
+ writer.write("iceflowers", max_ice_bullets);
- writer.write_int("coins", coins);
+ writer.write("coins", coins);
}
void
case OT_INTEGER: {
SQInteger val;
sq_getinteger(vm, -1, &val);
- writer.write_int(key, static_cast<int> (val));
+ writer.write(key, static_cast<int> (val));
break;
}
case OT_FLOAT: {
SQFloat val;
sq_getfloat(vm, -1, &val);
- writer.write_float(key, static_cast<float> (val));
+ writer.write(key, static_cast<float> (val));
break;
}
case OT_BOOL: {
SQBool val;
sq_getbool(vm, -1, &val);
- writer.write_bool(key, val == SQTrue);
+ writer.write(key, val == SQTrue);
break;
}
case OT_STRING: {
const SQChar* str;
sq_getstring(vm, -1, &str);
- writer.write_string(key, reinterpret_cast<const char*> (str));
+ writer.write(key, reinterpret_cast<const char*> (str));
break;
}
case OT_TABLE: {
iter.value()->get(init_script);
} else if(token == "ambient-light") {
std::vector<float> vColor;
- sector.get_vector( "ambient-light", vColor );
+ sector.get( "ambient-light", vColor );
if(vColor.size() < 3) {
log_warning << "(ambient-light) requires a color as argument" << std::endl;
} else {
reader.get("height", height);
std::vector<unsigned int> tiles;
- if(reader.get_vector("interactive-tm", tiles)
- || reader.get_vector("tilemap", tiles)) {
+ if(reader.get("interactive-tm", tiles)
+ || reader.get("tilemap", tiles)) {
TileMap* tilemap = new TileMap(level->get_tileset());
tilemap->set(width, height, tiles, LAYER_TILES, true);
add_object(tilemap);
}
- if(reader.get_vector("background-tm", tiles)) {
+ if(reader.get("background-tm", tiles)) {
TileMap* tilemap = new TileMap(level->get_tileset());
tilemap->set(width, height, tiles, LAYER_BACKGROUNDTILES, false);
if (height < 19) tilemap->resize(width, 19);
add_object(tilemap);
}
- if(reader.get_vector("foreground-tm", tiles)) {
+ if(reader.get("foreground-tm", tiles)) {
TileMap* tilemap = new TileMap(level->get_tileset());
tilemap->set(width, height, tiles, LAYER_FOREGROUNDTILES, false);
void
Sector::write(lisp::Writer& writer)
{
- writer.write_string("name", name);
- writer.write_float("gravity", gravity);
- writer.write_string("music", music);
+ writer.write("name", name);
+ writer.write("gravity", gravity);
+ writer.write("music", music);
// write spawnpoints
for(SpawnPoints::iterator i = spawnpoints.begin(); i != spawnpoints.end();
++i) {
SpawnPoint* spawn = *i;
writer.start_list("spawn-points");
- writer.write_string("name", spawn->name);
- writer.write_float("x", spawn->pos.x);
- writer.write_float("y", spawn->pos.y);
+ writer.write("name", spawn->name);
+ writer.write("x", spawn->pos.x);
+ writer.write("y", spawn->pos.y);
writer.end_list("spawn-points");
}
uint32_t
Sector::collision_tile_attributes(const Rect& dest) const
{
- float x1 = dest.p1.x;
- float y1 = dest.p1.y;
- float x2 = dest.p2.x;
- float y2 = dest.p2.y;
+ float x1 = dest.p1.x - SHIFT_DELTA;
+ float y1 = dest.p1.y - SHIFT_DELTA;
+ float x2 = dest.p2.x + SHIFT_DELTA;
+ float y2 = dest.p2.y + SHIFT_DELTA;
uint32_t result = 0;
for(std::list<TileMap*>::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
"If there are more than one action, they need names!");
}
std::vector<float> hitbox;
- if (lisp->get_vector("hitbox", hitbox)) {
+ if (lisp->get("hitbox", hitbox)) {
if (hitbox.size() != 4) throw std::runtime_error("hitbox must specify exactly 4 coordinates");
action->x_offset = hitbox[0];
action->y_offset = hitbox[1];
}
} else { // Load images
std::vector<std::string> images;
- if(!lisp->get_vector("images", images)) {
+ if(!lisp->get("images", images)) {
std::stringstream msg;
msg << "Sprite '" << name << "' contains no images in action '"
<< action->name << "'.";
void
Statistics::write(lisp::Writer& writer)
{
- writer.write_int("coins-collected", coins);
- writer.write_int("coins-collected-total", total_coins);
- writer.write_int("badguys-killed", badguys);
- writer.write_int("badguys-killed-total", total_badguys);
- writer.write_float("time-needed", time);
- writer.write_int("secrets-found", secrets);
- writer.write_int("secrets-found-total", total_secrets);
+ writer.write("coins-collected", coins);
+ writer.write("coins-collected-total", total_coins);
+ writer.write("badguys-killed", badguys);
+ writer.write("badguys-killed-total", total_badguys);
+ writer.write("time-needed", time);
+ writer.write("secrets-found", secrets);
+ writer.write("secrets-found-total", total_secrets);
}
*/
unsigned int width = 0;
unsigned int height = 0;
- iter.lisp()->get_vector("ids", ids);
- bool has_attributes = iter.lisp()->get_vector("attributes", attributes);
- bool has_datas = iter.lisp()->get_vector("datas", datas);
+ iter.lisp()->get("ids", ids);
+ bool has_attributes = iter.lisp()->get("attributes", attributes);
+ bool has_datas = iter.lisp()->get("datas", datas);
- if(!iter.lisp()->get_vector("image", images))
- iter.lisp()->get_vector( "images", images);
+ if(!iter.lisp()->get("image", images))
+ iter.lisp()->get( "images", images);
iter.lisp()->get("width", width);
iter.lisp()->get("height", height);
{
writer.start_list("climbable");
- writer.write_float("x", bbox.p1.x);
- writer.write_float("y", bbox.p1.y);
- writer.write_float("width", bbox.get_width());
- writer.write_float("height", bbox.get_height());
+ writer.write("x", bbox.p1.x);
+ writer.write("y", bbox.p1.y);
+ writer.write("width", bbox.get_width());
+ writer.write("height", bbox.get_height());
writer.end_list("climbable");
}
{
writer.start_list("door");
- writer.write_float("x", bbox.p1.x);
- writer.write_float("y", bbox.p1.y);
- writer.write_float("width", bbox.get_width());
- writer.write_float("height", bbox.get_height());
+ writer.write("x", bbox.p1.x);
+ writer.write("y", bbox.p1.y);
+ writer.write("width", bbox.get_width());
+ writer.write("height", bbox.get_height());
- writer.write_string("sector", target_sector);
- writer.write_string("spawnpoint", target_spawnpoint);
+ writer.write("sector", target_sector);
+ writer.write("spawnpoint", target_spawnpoint);
writer.end_list("door");
}
{
writer.start_list("scripttrigger");
- writer.write_float("x", bbox.p1.x);
- writer.write_float("y", bbox.p1.y);
- writer.write_float("width", bbox.get_width());
- writer.write_float("height", bbox.get_height());
- writer.write_string("script", script);
- writer.write_bool("button", triggerevent == EVENT_ACTIVATE);
+ writer.write("x", bbox.p1.x);
+ writer.write("y", bbox.p1.y);
+ writer.write("width", bbox.get_width());
+ writer.write("height", bbox.get_height());
+ writer.write("script", script);
+ writer.write("button", triggerevent == EVENT_ACTIVATE);
writer.end_list("scripttrigger");
}
{
writer.start_list("secretarea");
- writer.write_float("x", bbox.p1.x);
- writer.write_float("y", bbox.p1.y);
- writer.write_float("width", bbox.get_width());
- writer.write_float("height", bbox.get_height());
- writer.write_string("fade-tilemap", fade_tilemap);
+ writer.write("x", bbox.p1.x);
+ writer.write("y", bbox.p1.y);
+ writer.write("width", bbox.get_width());
+ writer.write("height", bbox.get_height());
+ writer.write("fade-tilemap", fade_tilemap);
writer.end_list("secretarea");
}
{
writer.start_list("sequencetrigger");
- writer.write_float("x", bbox.p1.x);
- writer.write_float("y", bbox.p1.y);
- writer.write_float("width", bbox.get_width());
- writer.write_float("height", bbox.get_height());
- writer.write_string("sequence", sequence_name);
+ writer.write("x", bbox.p1.x);
+ writer.write("y", bbox.p1.y);
+ writer.write("width", bbox.get_width());
+ writer.write("height", bbox.get_height());
+ writer.write("sequence", sequence_name);
writer.end_list("sequencetrigger");
}
Switch::write(lisp::Writer& writer)
{
writer.start_list("switch");
- writer.write_float("x", bbox.p1.x);
- writer.write_float("y", bbox.p1.y);
- writer.write_string("sprite", sprite_name);
- writer.write_string("script", script);
+ writer.write("x", bbox.p1.x);
+ writer.write("y", bbox.p1.y);
+ writer.write("sprite", sprite_name);
+ writer.write("script", script);
writer.end_list("switch");
}
msg << "Font:" << filename << ": missing shadows image";
throw std::runtime_error(msg.str());
}
- if( ! glyphs_val->get_vector("chars", chars) || chars.size() == 0) {
+ if( ! glyphs_val->get("chars", chars) || chars.size() == 0) {
std::ostringstream msg;
msg << "Font:" << filename << ": missing chars definition";
throw std::runtime_error(msg.str());
info->get("title", title);
info->get("description", description);
info->get("levelset", is_levelset);
- info->get_vector("levels", levels);
+ info->get("levels", levels);
info->get("hide-from-contribs", hide_from_contribs);
// Level info file doesn't define any levels, so read the
lisp::Writer writer(savegame_filename);
writer.start_list("supertux-savegame");
- writer.write_int("version", 1);
+ writer.write("version", 1);
using namespace WorldMapNS;
if(WorldMap::current() != NULL) {
title << WorldMap::current()->get_title();
title << " (" << WorldMap::current()->solved_level_count()
<< "/" << WorldMap::current()->level_count() << ")";
- writer.write_string("title", title.str());
+ writer.write("title", title.str());
}
writer.start_list("tux");
add_object(teleporter);
} else if(iter.item() == "ambient-light") {
std::vector<float> vColor;
- sector->get_vector( "ambient-light", vColor );
+ sector->get( "ambient-light", vColor );
if(vColor.size() < 3) {
log_warning << "(ambient-light) requires a color as argument" << std::endl;
} else {