From: Ricardo Cruz Date: Wed, 8 Sep 2004 11:23:29 +0000 (+0000) Subject: Made use of small tux. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=0afed01400e59d9cb2e081b3f4ae78f97acf91ad;p=supertux.git Made use of small tux. Support for null body parts. SVN-Revision: 1871 --- diff --git a/src/player.cpp b/src/player.cpp index a2e168e6f..b7633fe2b 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -88,29 +88,41 @@ void player_input_init(player_input_type* pplayer_input) void TuxBodyParts::set_action(std::string action) { - head->set_action(action); - body->set_action(action); - arms->set_action(action); - feet->set_action(action); + if(head != NULL) + head->set_action(action); + if(body != NULL) + body->set_action(action); + if(arms != NULL) + arms->set_action(action); + if(feet != NULL) + feet->set_action(action); } void TuxBodyParts::one_time_animation() { - head->start_animation(1); - body->start_animation(1); - arms->start_animation(1); - feet->start_animation(1); + if(head != NULL) + head->start_animation(1); + if(body != NULL) + body->start_animation(1); + if(arms != NULL) + arms->start_animation(1); + if(feet != NULL) + feet->start_animation(1); } void TuxBodyParts::draw(DrawingContext& context, const Vector& pos, int layer, Uint32 drawing_effect) { - head->draw(context, pos, layer, drawing_effect); - body->draw(context, pos, layer, drawing_effect); - arms->draw(context, pos, layer, drawing_effect); - feet->draw(context, pos, layer, drawing_effect); + if(head != NULL) + head->draw(context, pos, layer, drawing_effect); + if(body != NULL) + body->draw(context, pos, layer, drawing_effect); + if(arms != NULL) + arms->draw(context, pos, layer, drawing_effect); + if(feet != NULL) + feet->draw(context, pos, layer, drawing_effect); } Player::Player() @@ -759,8 +771,11 @@ Player::draw(DrawingContext& context) if(idle_timer.get_left() < 0) { - tux_body->head->set_action("idle"); - tux_body->head->start_animation(1); + if(size == BIG) + { + tux_body->head->set_action("idle"); + tux_body->head->start_animation(1); + } idle_timer.start(IDLE_TIME); } diff --git a/src/resources.cpp b/src/resources.cpp index 03c9aa2c8..3913a05c5 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -133,10 +133,10 @@ void loadshared() } small_tux = new TuxBodyParts(); - small_tux->head = sprite_manager->load("big-tux-head"); - small_tux->body = sprite_manager->load("big-tux-body"); - small_tux->arms = sprite_manager->load("big-tux-arms"); - small_tux->feet = sprite_manager->load("big-tux-feet"); + small_tux->head = NULL; + small_tux->body = sprite_manager->load("small-tux-body"); + small_tux->arms = sprite_manager->load("small-tux-arms"); + small_tux->feet = NULL; big_tux = new TuxBodyParts(); big_tux->head = sprite_manager->load("big-tux-head");