// 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 <memory>
#include <stdexcept>
#include <iostream>
#include <fstream>
+#include <sstream>
#include <stdexcept>
#include "sector.h"
#include "object/camera.h"
#include "object/background.h"
#include "object/particlesystem.h"
+#include "object/particlesystem_absolute.h"
#include "object/tilemap.h"
#include "lisp/parser.h"
#include "lisp/lisp.h"
#include "collision_grid_iterator.h"
#include "object_factory.h"
#include "collision.h"
+#include "spawn_point.h"
#include "math/rect.h"
#include "math/aatriangle.h"
#include "object/coin.h"
#include "object/block.h"
#include "object/invisible_block.h"
#include "object/bullet.h"
+#include "object/text_object.h"
#include "badguy/jumpy.h"
#include "badguy/spike.h"
#include "trigger/sequence_trigger.h"
#include "player_status.h"
+#include "scripting/script_interpreter.h"
+#include "scripting/sound.h"
+#include "scripting/scripted_object.h"
+#include "scripting/text.h"
//#define USE_GRID
RainParticleSystem* partsys = new RainParticleSystem();
partsys->parse(reader);
return partsys;
+ } else if(name == "particles-ghost") {
+ GhostParticleSystem* partsys = new GhostParticleSystem();
+ partsys->parse(reader);
+ return partsys;
} else if(name == "particles-clouds") {
CloudParticleSystem* partsys = new CloudParticleSystem();
partsys->parse(reader);
iter.value()->get(song_title);
load_music();
} else if(token == "spawnpoint") {
- const lisp::Lisp* spawnpoint_lisp = iter.lisp();
-
- SpawnPoint* sp = new SpawnPoint;
- spawnpoint_lisp->get("name", sp->name);
- spawnpoint_lisp->get("x", sp->pos.x);
- spawnpoint_lisp->get("y", sp->pos.y);
+ SpawnPoint* sp = new SpawnPoint(iter.lisp());
spawnpoints.push_back(sp);
+ } else if(token == "init-script") {
+ iter.value()->get(init_script);
} else {
GameObject* object = parse_object(token, *(iter.lisp()));
if(object) {
} else {
activate(sp->pos);
}
+
+ // Run init script
+ if(init_script != "") {
+ ScriptInterpreter::add_script_object(this,
+ std::string("Sector(") + name + ") - init", init_script);
+ }
}
void
}
void
-Sector::action(float elapsed_time)
+Sector::update(float elapsed_time)
{
player->check_bounds(camera);
if(!object->is_valid())
continue;
- object->action(elapsed_time);
+ object->update(elapsed_time);
}
#else
/* update objects */
if(!object->is_valid())
continue;
- object->action(elapsed_time);
+ object->update(elapsed_time);
}
#endif
const Tile* tile = solids->get_tile(x, y);
if(!tile)
continue;
+ // skip non-solid tiles
if(!(tile->getAttributes() & Tile::SOLID))
continue;
- if((tile->getAttributes() & Tile::UNISOLID) && object->movement.y < 0)
- continue;
+ // only handle unisolid when the player is falling down and when he was
+ // above the tile before
+ if(tile->getAttributes() & Tile::UNISOLID) {
+ if(object->movement.y < 0 || object->get_bbox().p2.y > y*32)
+ continue;
+ }
if(tile->getAttributes() & Tile::SLOPE) { // slope tile
AATriangle triangle;
for(GameObjects::iterator i = gameobjects.begin();
i != gameobjects.end(); ++i) {
BadGuy* badguy = dynamic_cast<BadGuy*> (*i);
- if(badguy)
+ if (badguy && badguy->countMe)
total_badguys++;
}