From: Matthias Braun Date: Tue, 28 Jun 2005 12:42:08 +0000 (+0000) Subject: fix miniswig using wrong stack numbers in functions with HSQUIRRELVM arguments X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=544ac07f16c5d3cdba089c08aade5d81160a83bd;p=supertux.git fix miniswig using wrong stack numbers in functions with HSQUIRRELVM arguments SVN-Revision: 2650 --- diff --git a/src/badguy/yeti.cpp b/src/badguy/yeti.cpp index fef1be337..50aa8887e 100644 --- a/src/badguy/yeti.cpp +++ b/src/badguy/yeti.cpp @@ -64,7 +64,7 @@ void Yeti::draw(DrawingContext& context) { // we blink when we are safe - if(safe_timer.started() && size_t(global_time*40)%2) + if(safe_timer.started() && size_t(game_time*40)%2) return; BadGuy::draw(context); diff --git a/src/game_session.cpp b/src/game_session.cpp index 869da5067..fbeac4ea7 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -528,7 +528,7 @@ GameSession::run() static const float elapsed_time = 1.0 / LOGICAL_FPS; // old code... float elapsed_time = float(ticks - lastticks) / 1000.; if(!game_pause) - global_time += elapsed_time; + game_time += elapsed_time; // regulate fps ticks = SDL_GetTicks(); diff --git a/src/object/level_time.cpp b/src/object/level_time.cpp index ee123aaf8..591df8023 100644 --- a/src/object/level_time.cpp +++ b/src/object/level_time.cpp @@ -56,7 +56,7 @@ LevelTime::draw(DrawingContext& context) context.draw_text(white_text, _("TIME's UP"), Vector(SCREEN_WIDTH/2, 0), CENTER_ALLIGN, LAYER_FOREGROUND1); } else if (time_left.get_timeleft() > TIME_WARNING - || int(global_time * 2.5) % 2) { + || int(game_time * 2.5) % 2) { snprintf(str, sizeof(str), " %d", int(time_left.get_timeleft())); context.draw_text(white_text, _("TIME"), Vector(SCREEN_WIDTH/2, 0), CENTER_ALLIGN, LAYER_FOREGROUND1); diff --git a/src/object/player.cpp b/src/object/player.cpp index b036e258a..b42c547b9 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -734,7 +734,7 @@ Player::draw(DrawingContext& context) get_pos(), layer); } } - else if (safe_timer.started() && size_t(global_time*40)%2) + else if (safe_timer.started() && size_t(game_time*40)%2) ; // don't draw Tux else tux_body->draw(context, get_pos(), layer); @@ -742,7 +742,7 @@ Player::draw(DrawingContext& context) // Draw blinking star overlay if (invincible_timer.started() && (invincible_timer.get_timeleft() > TUX_INVINCIBLE_TIME_WARNING - || size_t(global_time*20)%2) + || size_t(game_time*20)%2) && !dying) { if (!is_big() || duck) diff --git a/src/scripting/wrapper.hpp b/src/scripting/wrapper.hpp index 026db1836..322cfc8fa 100644 --- a/src/scripting/wrapper.hpp +++ b/src/scripting/wrapper.hpp @@ -1,6 +1,6 @@ /** * WARNING: This file is automatically generated from: - * 'src/scripting/wrapper.interface.h' + * 'src/scripting/wrapper.interface.hpp' * DO NOT CHANGE */ #ifndef __supertux_WRAPPER_H__ diff --git a/src/tile.cpp b/src/tile.cpp index 118055ebc..6c75fb1e3 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -167,7 +167,7 @@ void Tile::draw(DrawingContext& context, const Vector& pos, int layer) const { if(images.size() > 1) { - size_t frame = size_t(global_time * anim_fps) % images.size(); + size_t frame = size_t(game_time * anim_fps) % images.size(); context.draw_surface(images[frame], pos, layer); } else if (images.size() == 1) { context.draw_surface(images[0], pos, layer); diff --git a/src/timer.cpp b/src/timer.cpp index 40be50353..0ab3a7abb 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -22,7 +22,7 @@ #include #include "timer.hpp" -float global_time = 0; +float game_time = 0; Timer::Timer() : period(0), cycle_start(0), cyclic(false) @@ -38,7 +38,7 @@ Timer::start(float period, bool cyclic) { this->period = period; this->cyclic = cyclic; - cycle_start = global_time; + cycle_start = game_time; } bool @@ -47,9 +47,9 @@ Timer::check() if(period == 0) return false; - if(global_time - cycle_start >= period) { + if(game_time - cycle_start >= period) { if(cyclic) { - cycle_start = global_time - fmodf(global_time - cycle_start, period); + cycle_start = game_time - fmodf(game_time - cycle_start, period); } else { period = 0; } diff --git a/src/timer.hpp b/src/timer.hpp index 42e1b8fd8..46f00f4ac 100644 --- a/src/timer.hpp +++ b/src/timer.hpp @@ -20,7 +20,7 @@ #ifndef __SUPERTUX_TIMER_H__ #define __SUPERTUX_TIMER_H__ -extern float global_time; +extern float game_time; /** * new simpler timer designed to be used in the update functions of objects @@ -48,9 +48,9 @@ public: float get_period() const { return period; } float get_timeleft() const - { return period - (global_time - cycle_start); } + { return period - (game_time - cycle_start); } float get_timegone() const - { return global_time - cycle_start; } + { return game_time - cycle_start; } bool started() const { return period != 0 && get_timeleft() > 0; } diff --git a/src/title.cpp b/src/title.cpp index 231074129..537ff96e0 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -310,7 +310,7 @@ void title() // Calculate the movement-factor Uint32 ticks = SDL_GetTicks(); float elapsed_time = float(ticks - lastticks) / 1000.; - global_time += elapsed_time; + game_time += elapsed_time; lastticks = ticks; // 40fps is minimum if(elapsed_time > .04) diff --git a/src/worldmap.cpp b/src/worldmap.cpp index 87d1d626e..feb5b8826 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -1008,7 +1008,7 @@ WorldMap::display() while(!quit) { Uint32 ticks = SDL_GetTicks(); float elapsed_time = float(ticks - lastticks) / 1000; - global_time += elapsed_time; + game_time += elapsed_time; lastticks = ticks; // 40 fps minimum // TODO use same code as in GameSession here diff --git a/tools/miniswig/create_wrapper.cpp b/tools/miniswig/create_wrapper.cpp index 7eae391b4..7ac2e92d7 100644 --- a/tools/miniswig/create_wrapper.cpp +++ b/tools/miniswig/create_wrapper.cpp @@ -148,7 +148,7 @@ WrapperCreator::create_function_wrapper(Class* _class, Function* function) p != function->parameters.end(); ++p) { if(i == 0 && p->type.atomic_type == HSQUIRRELVMType::instance()) { out << ind << "HSQUIRRELVM arg0 = v;\n"; - arg_offset++; + arg_offset--; } else { char argname[64]; snprintf(argname, sizeof(argname), "arg%d", i);