From: Ingo Ruhnke Date: Sun, 18 Apr 2004 20:36:01 +0000 (+0000) Subject: - added new bigtux X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=91a02cdd61d19706001fe0321e8ff426fa7fa464;p=supertux.git - added new bigtux SVN-Revision: 561 --- diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 1f1131ad6..2dec06bd5 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -63,6 +63,8 @@ GameSession::restart_level() fps_timer.init(true); frame_timer.init(true); + delete world; + if (st_gl_mode == ST_GL_LOAD_LEVEL_FILE) { world = new World(subset); diff --git a/src/player.cpp b/src/player.cpp index d9d476ea5..d45be289c 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -17,6 +17,7 @@ #include "defines.h" #include "scene.h" #include "tile.h" +#include "sprite.h" #include "screen.h" Surface* tux_life; @@ -27,10 +28,10 @@ Surface* smalltux_jump_right; Surface* smalltux_stand_left; Surface* smalltux_stand_right; -Surface* bigtux_right[3]; -Surface* bigtux_left[3]; -Surface* bigtux_right_jump; -Surface* bigtux_left_jump; +Sprite* bigtux_right; +Sprite* bigtux_left; +Sprite* bigtux_right_jump; +Sprite* bigtux_left_jump; Surface* ducktux_right; Surface* ducktux_left; Surface* skidtux_right; @@ -597,45 +598,27 @@ Player::draw() { if (!skidding_timer.started()) { - if (!jumping || physic.get_velocity_y() > 0) + if (physic.get_velocity_y() == 0) { if (dir == RIGHT) - { - bigtux_right[frame_]->draw( - base.x- scroll_x - 8, base.y); - } + bigtux_right->draw(base.x- scroll_x - 8, base.y); else - { - bigtux_left[frame_]->draw( - base.x- scroll_x - 8, base.y); - } + bigtux_left->draw(base.x- scroll_x - 8, base.y); } else { if (dir == RIGHT) - { - bigtux_right_jump->draw( - base.x- scroll_x - 8, base.y); - } + bigtux_right_jump->draw(base.x- scroll_x - 8, base.y); else - { - bigtux_left_jump->draw( - base.x- scroll_x - 8, base.y); - } + bigtux_left_jump->draw(base.x- scroll_x - 8, base.y); } } else { if (dir == RIGHT) - { - skidtux_right->draw( - base.x- scroll_x - 8, base.y); - } + skidtux_right->draw(base.x- scroll_x - 8, base.y); else - { - skidtux_left->draw( - base.x- scroll_x - 8, base.y); - } + skidtux_left->draw(base.x- scroll_x - 8, base.y); } } else diff --git a/src/player.h b/src/player.h index 97e6df17d..c13442774 100644 --- a/src/player.h +++ b/src/player.h @@ -60,6 +60,8 @@ struct player_input_type void player_input_init(player_input_type* pplayer_input); +class Sprite; + extern Surface* tux_life; extern std::vector tux_right; extern std::vector tux_left; @@ -67,10 +69,10 @@ extern Surface* smalltux_jump_left; extern Surface* smalltux_jump_right; extern Surface* smalltux_stand_left; extern Surface* smalltux_stand_right; -extern Surface* bigtux_right[3]; -extern Surface* bigtux_left[3]; -extern Surface* bigtux_right_jump; -extern Surface* bigtux_left_jump; +extern Sprite* bigtux_right; +extern Sprite* bigtux_left; +extern Sprite* bigtux_right_jump; +extern Sprite* bigtux_left_jump; extern Surface* ducktux_right; extern Surface* ducktux_left; extern Surface* skidtux_right; diff --git a/src/resources.cpp b/src/resources.cpp index 9abc40176..397b74b18 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -75,27 +75,11 @@ void loadshared() cape_left[1] = new Surface(datadir + "/images/shared/cape-left-1.png", USE_ALPHA); - bigtux_right[0] = new Surface(datadir + "/images/shared/bigtux-right-0.png", - USE_ALPHA); - - bigtux_right[1] = new Surface(datadir + "/images/shared/bigtux-right-1.png", - USE_ALPHA); - - bigtux_right[2] = new Surface(datadir + "/images/shared/bigtux-right-2.png", - USE_ALPHA); - - bigtux_right_jump = new Surface(datadir + "/images/shared/bigtux-right-jump.png", USE_ALPHA); - - bigtux_left[0] = new Surface(datadir + "/images/shared/bigtux-left-0.png", - USE_ALPHA); - - bigtux_left[1] = new Surface(datadir + "/images/shared/bigtux-left-1.png", - USE_ALPHA); - - bigtux_left[2] = new Surface(datadir + "/images/shared/bigtux-left-2.png", - USE_ALPHA); + bigtux_right = sprite_manager->load("largetux-walk-right"); + bigtux_left = sprite_manager->load("largetux-walk-left"); - bigtux_left_jump = new Surface(datadir + "/images/shared/bigtux-left-jump.png", USE_ALPHA); + bigtux_left_jump = sprite_manager->load("largetux-jump-left"); + bigtux_right_jump = sprite_manager->load("largetux-jump-right"); bigcape_right[0] = new Surface(datadir + "/images/shared/bigcape-right-0.png", USE_ALPHA); @@ -302,8 +286,6 @@ void unloadshared(void) { delete tux_right[i]; delete tux_left[i]; - delete bigtux_right[i]; - delete bigtux_left[i]; } delete bigtux_right_jump; diff --git a/src/sound.h b/src/sound.h index a7663e220..eab67aaf8 100644 --- a/src/sound.h +++ b/src/sound.h @@ -71,8 +71,10 @@ extern char* soundfilenames[NUM_SOUNDS]; #include /* variables for stocking the sound and music */ -extern Mix_Chunk * sounds[NUM_SOUNDS]; -extern Mix_Music * level_song, * level_song_fast, * herring_song; +extern Mix_Chunk* sounds[NUM_SOUNDS]; +extern Mix_Music* level_song; +extern Mix_Music* level_song_fast; +extern Mix_Music* herring_song; /* functions handling the sound and music */ int open_audio(int frequency, Uint16 format, int channels, int chunksize);