diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-17 20:34:59 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-17 20:34:59 -0500 |
commit | aac57db782718bf40a7adea15baf8d6b899ea925 (patch) | |
tree | c9f32563cdb9a06e6e24343946c5bb35dc254b76 /src/script_system.cpp | |
parent | b3720c4a401f345c49eadabdb852968e273e7077 (diff) | |
download | tanetane-aac57db782718bf40a7adea15baf8d6b899ea925.tar.gz tanetane-aac57db782718bf40a7adea15baf8d6b899ea925.tar.bz2 tanetane-aac57db782718bf40a7adea15baf8d6b899ea925.zip |
Made some sprites persist between map changes
The player party characters are now initialised at the start of the game and are no longer re-created after every map change. The script system takes care of moving the player into the correct position on the new map. Deleted sprite IDs are now reused the next time a sprite is created, instead of throwing out everything between maps.
Diffstat (limited to 'src/script_system.cpp')
-rw-r--r-- | src/script_system.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/script_system.cpp b/src/script_system.cpp index 8674f97..090bf46 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp | |||
@@ -54,6 +54,7 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
54 | 54 | ||
55 | engine_.new_usertype<CharacterSystem>( | 55 | engine_.new_usertype<CharacterSystem>( |
56 | "character", | 56 | "character", |
57 | "transplantParty", &CharacterSystem::transplantParty, | ||
57 | "startRunning", &CharacterSystem::startRunning, | 58 | "startRunning", &CharacterSystem::startRunning, |
58 | "halt", &CharacterSystem::halt); | 59 | "halt", &CharacterSystem::halt); |
59 | 60 | ||
@@ -165,8 +166,14 @@ ScriptSystem::ScriptSystem(Game& game) : game_(game) { | |||
165 | 166 | ||
166 | engine_.set_function( | 167 | engine_.set_function( |
167 | "loadMap", | 168 | "loadMap", |
168 | [&] (std::string filename, std::string warpPoint, Direction dir) { | 169 | [&] (std::string filename) { |
169 | game_.loadMap(filename, warpPoint, dir); | 170 | game_.loadMap(filename); |
171 | }); | ||
172 | |||
173 | engine_.set_function( | ||
174 | "getWarpPoint", | ||
175 | [&] (std::string warp) { | ||
176 | return game_.getMap().getWarpPoint(warp); | ||
170 | }); | 177 | }); |
171 | 178 | ||
172 | engine_.script_file("../res/scripts/common.lua"); | 179 | engine_.script_file("../res/scripts/common.lua"); |