From: Matthias Braun Date: Thu, 5 May 2005 16:14:56 +0000 (+0000) Subject: bonusblock is a sprite and not a tile in the new design. Renamend messagebox.png... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4a54087f52d6a8a2e5b4c498e772685bb0885991;p=supertux.git bonusblock is a sprite and not a tile in the new design. Renamend messagebox.png to infoblock.png SVN-Revision: 2408 --- diff --git a/data/images/supertux.strf b/data/images/supertux.strf index 8ca06fa38..308af99d4 100644 --- a/data/images/supertux.strf +++ b/data/images/supertux.strf @@ -1443,6 +1443,13 @@ (images "tilesets/brick1.png")) ) + (sprite (name "infoblock") + (action + (name "default") + (images "tilesets/infoblock.png") + ) + ) + (sprite (name "rock") (action (name "normal") diff --git a/data/images/tilesets/infoblock.png b/data/images/tilesets/infoblock.png new file mode 100644 index 000000000..051554d28 Binary files /dev/null and b/data/images/tilesets/infoblock.png differ diff --git a/data/images/tilesets/messagebox.png b/data/images/tilesets/messagebox.png deleted file mode 100644 index 051554d28..000000000 Binary files a/data/images/tilesets/messagebox.png and /dev/null differ diff --git a/data/images/tilesets/supertux.stgt b/data/images/tilesets/supertux.stgt index e2f8d4f0a..3e26edd61 100644 --- a/data/images/tilesets/supertux.stgt +++ b/data/images/tilesets/supertux.stgt @@ -4778,11 +4778,4 @@ "rainsplash-vertical-3.png") (anim-fps 15) ) - (tile - (id 1321) - (images - "messagebox.png") - ) - (solid #t) - ) ) diff --git a/src/object/infoblock.cpp b/src/object/infoblock.cpp index a032462e2..5430e26e4 100644 --- a/src/object/infoblock.cpp +++ b/src/object/infoblock.cpp @@ -28,7 +28,7 @@ #include "lisp/lisp.h" InfoBlock::InfoBlock(const lisp::Lisp& lisp) - : Block(sprite_manager->create("bonusblock")) + : Block(sprite_manager->create("infoblock")) { Vector pos; lisp.get("x", pos.x); diff --git a/src/scripting/script_interpreter.h b/src/scripting/script_interpreter.h index 0ebe95238..54618c40b 100644 --- a/src/scripting/script_interpreter.h +++ b/src/scripting/script_interpreter.h @@ -1,16 +1,22 @@ #ifndef __SCRIPT_INTERPRETER_H__ #define __SCRIPT_INTERPRETER_H__ +#include +#include + class ScriptInterpreter { public: ScriptInterpreter(); ~ScriptInterpreter(); - void load_script(const std::istream& in); + void load_script(std::istream& in, const std::string& sourcename = ""); void run_script(); void resume_script(); - bool script_suspended() const; + bool script_suspended(); + +private: + HSQUIRRELVM v; }; #endif diff --git a/src/scripting/semantic.cache b/src/scripting/semantic.cache index 02ff11e27..105556030 100644 --- a/src/scripting/semantic.cache +++ b/src/scripting/semantic.cache @@ -71,5 +71,33 @@ :major-mode 'c++-mode :tokens '(("__DISPLAY_H__" variable nil nil ((const . t)) nil nil [23 55]) ("Scripting" type "namespace" (("Display" type "class" (("public" label ((reparse-symbol . classsubparts)) [85 92]) ("Display" function ("Display" type "class") nil ((constructor . t) (prototype . t)) nil ((reparse-symbol . classsubparts)) [119 129]) ("Display" function "void" nil ((destructor . t) (prototype . t)) nil ((reparse-symbol . classsubparts)) [134 145]) ("set_effect" function ("void") (("effect" variable ("std::string" type "class") nil ((const . t)) nil nil [174 200])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [158 201])) nil nil nil ((reparse-symbol . namespacesubparts)) [69 204])) nil nil nil nil [46 207])) ) + (semanticdb-table "script_interpreter.cpp" + :file "script_interpreter.cpp" + :pointmax 2199 + :major-mode 'c++-mode + :tokens '(("config.h" include t nil nil [1 20]) ("script_interpreter.h" include nil nil nil [22 53]) ("stdarg.h" include t nil nil [55 74]) ("stdexcept" include t nil nil [75 95]) ("sstream" include t nil nil [96 114]) ("sqstdio.h" include t nil nil [115 135]) ("sqstdaux.h" include t nil nil [136 157]) ("sqstdblob.h" include t nil nil [158 180]) ("sqstdsystem.h" include t nil nil [181 205]) ("sqstdmath.h" include t nil nil [206 228]) ("sqstdstring.h" include t nil nil [229 253]) ("wrapper.h" include nil nil nil [255 275]) ("wrapper_util.h" include nil nil nil [276 301]) ("printfunc" function ("void") (("" variable ("HSQUIRRELVM" type "class") nil nil nil nil [325 337]) ("str" variable "char" nil ((const . t) (pointer . 1)) nil nil [338 354]) ("..." ((reparse-symbol . arg-sub-list)) [355 359])) ((typemodifiers "static")) nil nil [303 452]) ("ScriptInterpreter" function ("ScriptInterpreter" type "class") nil ((parent . "ScriptInterpreter") (constructor . t)) nil nil [454 1375]) ("ScriptInterpreter" function "void" nil ((parent . "ScriptInterpreter") (destructor . t)) nil nil [1377 1420]) ("squirrel_read_char" function ("SQInteger" type "class") (("file" variable ("SQUserPointer" type "class") nil nil nil nil [1458 1477])) ((typemodifiers "static")) nil nil [1422 1595]) ("load_script" function ("void") (("in" variable ("std::istream" type "class") nil nil nil nil [1634 1651]) ("sourcename" variable ("std::string" type "class") nil ((const . t)) nil nil [1652 1682])) ((parent . "ScriptInterpreter")) nil nil [1598 1814]) ("run_script" function ("void") nil ((parent . "ScriptInterpreter")) nil nil [1816 1986]) ("resume_script" function ("void") nil ((parent . "ScriptInterpreter")) nil nil [1988 2124]) ("script_suspended" function ("bool" type "class") nil ((parent . "ScriptInterpreter")) nil nil [2126 2198])) + :unmatched-syntax 'nil + ) + (semanticdb-table "wrapper_util.h" + :file "wrapper_util.h" + :pointmax 772 + :major-mode 'c++-mode + :tokens '(("__WRAPPERUTIL_HPP__" variable nil nil ((const . t)) nil nil [29 59]) ("squirrel.h" include t nil nil [58 79]) ("exception" include t nil nil [80 100]) ("string" include t nil nil [101 118]) ("WrappedFunction" type "struct" (("name" variable "char" nil ((const . t) (pointer . 1)) nil nil [149 166]) ("f" variable ("SQFUNCTION" type "class") nil nil nil nil [171 184])) nil nil nil nil [120 187]) ("WrappedClass" type "struct" (("name" variable "char" nil ((const . t) (pointer . 1)) nil nil [214 231]) ("functions" variable ("WrappedFunction" type "class") nil ((pointer . 1)) nil nil [236 263])) nil nil nil nil [188 266]) ("SquirrelException" type "class" (("public" label ((reparse-symbol . classsubparts)) [314 321]) ("SquirrelException" function ("SquirrelException" type "class") (("v" variable ("HSQUIRRELVM" type "class") nil nil nil nil [338 352]) ("message" variable ("std::string" type "class") nil ((const . t)) nil nil [353 380])) ((constructor . t) (prototype . t)) nil ((reparse-symbol . classsubparts)) [324 389]) ("Exception" function "void" nil ((typemodifiers "virtual") (destructor . t) (prototype . t)) nil ((reparse-symbol . classsubparts)) [392 425]) ("what" function ("char") nil ((const . t) (pointer . 1) (prototype . t)) nil ((reparse-symbol . classsubparts)) [429 462]) ("private" label ((reparse-symbol . classsubparts)) [463 471]) ("message" variable ("std::string" type "class") nil nil nil nil [474 494])) (("std::exception")) nil nil nil [268 497]) ("register_functions" function ("void") (("v" variable ("HSQUIRRELVM" type "class") nil nil nil nil [523 537]) ("functions" variable ("WrappedFunction" type "class") nil ((pointer . 1)) nil nil [538 565])) ((prototype . t)) nil nil [499 566]) ("register_classes" function ("void") (("v" variable ("HSQUIRRELVM" type "class") nil nil nil nil [589 603]) ("classes" variable ("WrappedClass" type "class") nil ((pointer . 1)) nil nil [604 626])) ((prototype . t)) nil nil [567 627]) ("expose_object" function ("void") (("v" variable ("HSQUIRRELVM" type "class") nil nil nil nil [648 662]) ("object" variable "void" nil ((pointer . 1)) nil nil [663 676]) ("type" variable "char" nil ((const . t) (pointer . 1)) nil nil [677 694]) ("name" variable "char" nil ((const . t) (pointer . 1)) nil nil [703 720])) ((prototype . t)) nil nil [629 721])) + :unmatched-syntax 'nil + ) + (semanticdb-table "wrapper_util.cpp" + :file "wrapper_util.cpp" + :pointmax 4581 + :major-mode 'c++-mode + :tokens '(("config.h" include t nil nil [1 20]) ("stdexcept" include t nil nil [22 42]) ("sstream" include t nil nil [43 61]) ("wrapper_util.h" include nil nil nil [62 87]) ("register_function" function ("void") (("v" variable ("HSQUIRRELVM" type "class") nil nil nil nil [119 133]) ("func" variable ("SQFUNCTION" type "class") nil nil nil nil [134 150]) ("name" variable "char" nil ((const . t) (pointer . 1)) nil nil [151 168])) ((typemodifiers "static")) nil nil [89 285]) ("register_class" function ("void") (("v" variable ("HSQUIRRELVM" type "class") nil nil nil nil [314 328]) ("wclass" variable ("WrappedClass" type "class") nil ((pointer . 1)) nil nil [329 350])) ((typemodifiers "static")) nil nil [287 582]) ("register_functions" function ("void") (("v" variable ("HSQUIRRELVM" type "class") nil nil nil nil [608 622]) ("functions" variable ("WrappedFunction" type "class") nil ((pointer . 1)) nil nil [623 650])) nil nil nil [584 824]) ("register_classes" function ("void") (("v" variable ("HSQUIRRELVM" type "class") nil nil nil nil [848 862]) ("classes" variable ("WrappedClass" type "class") nil ((pointer . 1)) nil nil [863 885])) nil nil nil [826 1044]) ("print_squirrel_stack" function ("void") (("v" variable ("HSQUIRRELVM" type "class") nil nil nil nil [1072 1086])) nil nil nil [1046 2978]) ("expose_object" function ("void") (("v" variable ("HSQUIRRELVM" type "class") nil nil nil nil [2999 3013]) ("object" variable "void" nil ((pointer . 1)) nil nil [3014 3027]) ("type" variable "char" nil ((const . t) (pointer . 1)) nil nil [3028 3045]) ("name" variable "char" nil ((const . t) (pointer . 1)) nil nil [3054 3071])) nil nil nil [2980 4070]) ("SquirrelError" function ("SquirrelError" type "class") (("v" variable ("HSQUIRRELVM" type "class") nil nil nil nil [4181 4195]) ("message" variable ("std::string" type "class") nil ((const . t)) nil nil [4196 4223])) ((parent . "SquirrelError") (constructor . t)) nil nil [4152 4457]) ("SquirrelError" function "void" nil ((parent . "SquirrelError") (destructor . t)) nil nil [4459 4501]) ("what" function ("char") nil ((const . t) (parent . "SquirrelError") (pointer . 1)) nil nil [4503 4580])) + :unmatched-syntax 'nil + ) + (semanticdb-table "script_interpreter.h" + :file "script_interpreter.h" + :pointmax 392 + :major-mode 'c++-mode + :tokens '(("__SCRIPT_INTERPRETER_H__" variable nil nil ((const . t)) nil nil [34 69]) ("squirrel.h" include t nil nil [68 89]) ("iostream" include t nil nil [90 109]) ("ScriptInterpreter" type "class" (("public" label ((reparse-symbol . classsubparts)) [137 144]) ("ScriptInterpreter" function ("ScriptInterpreter" type "class") nil ((constructor . t) (prototype . t)) nil ((reparse-symbol . classsubparts)) [149 169]) ("ScriptInterpreter" function "void" nil ((destructor . t) (prototype . t)) nil ((reparse-symbol . classsubparts)) [174 195]) ("load_script" function ("void") (("in" variable ("std::istream" type "class") nil nil nil nil [218 235]) ("sourcename" variable ("std::string" type "class") "\"\"" ((const . t)) nil nil [236 270])) ((prototype . t)) nil ((reparse-symbol . classsubparts)) [201 272]) ("run_script" function ("void") nil ((prototype . t)) nil ((reparse-symbol . classsubparts)) [277 295]) ("resume_script" function ("void") nil ((prototype . t)) nil ((reparse-symbol . classsubparts)) [300 321]) ("script_suspended" function ("bool" type "class") nil ((prototype . t)) nil ((reparse-symbol . classsubparts)) [326 350]) ("private" label ((reparse-symbol . classsubparts)) [352 360]) ("v" variable ("HSQUIRRELVM" type "class") nil nil nil nil [365 379])) nil nil nil nil [111 382])) + :unmatched-syntax 'nil + ) ) ) diff --git a/src/scripting/wrapper_util.cpp b/src/scripting/wrapper_util.cpp index a16953ad7..f52ecbaef 100644 --- a/src/scripting/wrapper_util.cpp +++ b/src/scripting/wrapper_util.cpp @@ -39,7 +39,7 @@ void register_classes(HSQUIRRELVM v, WrappedClass* classes) sq_pop(v, 1); } -static void print_stack(HSQUIRRELVM v) +void print_squirrel_stack(HSQUIRRELVM v) { printf("--------------------------------------------------------------\n"); int count = sq_gettop(v); @@ -104,16 +104,6 @@ static void print_stack(HSQUIRRELVM v) printf("--------------------------------------------------------------\n"); } -#define check(x) \ - if((x) < 0) { \ - std::stringstream msg; \ - sq_getlasterror(v); \ - const char* error; \ - sq_getstring(v, -1, &error); \ - msg << "Error: " << error; \ - throw std::runtime_error(msg.str()); \ - } - void expose_object(HSQUIRRELVM v, void* object, const char* type, const char* name) { @@ -124,29 +114,48 @@ void expose_object(HSQUIRRELVM v, void* object, const char* type, // resolve class name sq_pushroottable(v); sq_pushstring(v, type, -1); - print_stack(v); if(sq_get(v, -2) < 0) { std::ostringstream msg; msg << "Couldn't resolve squirrel type '" << type << "'."; throw std::runtime_error(msg.str()); } sq_remove(v, -2); // remove roottable - print_stack(v); // create an instance and set pointer to c++ object - print_stack(v); - check(sq_createinstance(v, -1)); - printf("after creatinstance\n"); - print_stack(v); - check(sq_setinstanceup(v, -1, object)); - printf("after setinstanceup\n"); - print_stack(v); - - sq_remove(v, -2); // remove class + if(sq_createinstance(v, -1) < 0 || sq_setinstanceup(v, -1, object)) { + std::ostringstream msg; + msg << "Couldn't setup squirrel instance for object '" + << name << "' of type '" << type << "'."; + throw SquirrelError(v, msg.str()); + } + + sq_remove(v, -2); // remove class from stack // part2 of registration of the instance in the root table - print_stack(v); - check(sq_createslot(v, -3)); - sq_pop(v, 1); + if(sq_createslot(v, -3) < 0) + throw SquirrelError(v, "Couldn't register object in squirrel root table"); + sq_pop(v, 2); +} + +//---------------------------------------------------------------------------- + +SquirrelError::SquirrelError(HSQUIRRELVM v, const std::string& message) throw() +{ + std::ostringstream msg; + msg << "SQuirrel error: " << message << " ("; + const char* lasterr; + sq_getlasterror(v); + sq_getstring(v, -1, &lasterr); + sq_pop(v, 1); + msg << lasterr << ")"; + this->message = msg.str(); } +SquirrelError::~SquirrelError() throw() +{} + +const char* +SquirrelError::what() const throw() +{ + return message.c_str(); +} diff --git a/src/scripting/wrapper_util.h b/src/scripting/wrapper_util.h index 0eb0737e9..e8f457a26 100644 --- a/src/scripting/wrapper_util.h +++ b/src/scripting/wrapper_util.h @@ -2,6 +2,8 @@ #define __WRAPPERUTIL_HPP__ #include +#include +#include struct WrappedFunction { const char* name; @@ -12,10 +14,22 @@ struct WrappedClass { WrappedFunction* functions; }; +class SquirrelError : public std::exception +{ +public: + SquirrelError(HSQUIRRELVM v, const std::string& message) throw(); + virtual ~SquirrelError() throw(); + + const char* what() const throw(); +private: + std::string message; +}; + void register_functions(HSQUIRRELVM v, WrappedFunction* functions); void register_classes(HSQUIRRELVM v, WrappedClass* classes); void expose_object(HSQUIRRELVM v, void* object, const char* type, const char* name); +void print_squirrel_stack(HSQUIRRELVM v); #endif diff --git a/src/sector.cpp b/src/sector.cpp index b7884fdee..1d14695a6 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -600,7 +600,8 @@ Sector::collision_tilemap(MovingObject* object, int depth) continue; if(!(tile->getAttributes() & Tile::SOLID)) continue; - if((tile->getAttributes() & Tile::UNISOLID) && object->movement.y < 0) + if(tile->getAttributes() & Tile::UNISOLID + && (object->movement.y < 0 || dest.p2.y > y*32)) continue; if(tile->getAttributes() & Tile::SLOPE) { // slope tile diff --git a/src/squirrel/Jamfile b/src/squirrel/Jamfile index 7b8fb537a..2e7038e63 100644 --- a/src/squirrel/Jamfile +++ b/src/squirrel/Jamfile @@ -2,7 +2,7 @@ SubDir TOP src squirrel ; Library squirrel : [ Wildcard squirrel : *.cpp *.h ] - [ Wildcard sqstdlib : *.cpp *.h ] + [ Wildcard sqstdlib : *.cpp *.c *.h ] : noinstall ; IncludeDir squirrel : include ; diff --git a/src/squirrel/sqstdlib/sqstdrex.c b/src/squirrel/sqstdlib/sqstdrex.c index aef9f0f53..d7e943662 100644 --- a/src/squirrel/sqstdlib/sqstdrex.c +++ b/src/squirrel/sqstdlib/sqstdrex.c @@ -392,7 +392,7 @@ static const SQChar *sqstd_rex_matchnode(SQRex* exp,SQRexNode *node,const SQChar case OP_OR: { const SQChar *asd = str; SQRexNode *temp=&exp->_nodes[node->left]; - while(asd = sqstd_rex_matchnode(exp,temp,asd)) { + while( (asd = sqstd_rex_matchnode(exp,temp,asd)) ) { if(temp->next != -1) temp = &exp->_nodes[temp->next]; else @@ -400,7 +400,7 @@ static const SQChar *sqstd_rex_matchnode(SQRex* exp,SQRexNode *node,const SQChar } asd = str; temp = &exp->_nodes[node->right]; - while(asd = sqstd_rex_matchnode(exp,temp,asd)) { + while( (asd = sqstd_rex_matchnode(exp,temp,asd)) ) { if(temp->next != -1) temp = &exp->_nodes[temp->next]; else @@ -435,10 +435,10 @@ static const SQChar *sqstd_rex_matchnode(SQRex* exp,SQRexNode *node,const SQChar return cur; } case OP_WB: - if(str == exp->_bol && !isspace(*str) + if((str == exp->_bol && !isspace(*str)) || (str == exp->_eol && !isspace(*(str-1))) - || (!isspace(*str) && isspace(*(str+1))) - || (isspace(*str) && !isspace(*(str+1))) ) { + || ((!isspace(*str) && isspace(*(str+1)))) + || ((isspace(*str) && !isspace(*(str+1)))) ) { return (node->left == 'b')?str:NULL; } return (node->left == 'b')?NULL:str; diff --git a/src/tile_manager.cpp b/src/tile_manager.cpp index 37cf79a9d..0c8024508 100644 --- a/src/tile_manager.cpp +++ b/src/tile_manager.cpp @@ -81,7 +81,7 @@ void TileManager::load_tileset(std::string filename) } else if(iter.item() == "properties") { // deprecated } else { - std::cerr << "Unknown symbol '" << iter.item() << "'.\n"; + std::cerr << "Unknown symbol '" << iter.item() << "' tile defintion file.\n"; } } }