[Super-tux-commit] supertux/src player.cpp,1.159,1.160 resources.cpp,1.51,1.52
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-09-08 11:23:46
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2328/src Modified Files: player.cpp resources.cpp Log Message: Made use of small tux. Support for null body parts. Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.159 retrieving revision 1.160 diff -u -d -r1.159 -r1.160 --- player.cpp 4 Sep 2004 21:16:05 -0000 1.159 +++ player.cpp 8 Sep 2004 11:23:29 -0000 1.160 @@ -88,29 +88,41 @@ 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 @@ 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); } Index: resources.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- resources.cpp 26 Aug 2004 23:05:03 -0000 1.51 +++ resources.cpp 8 Sep 2004 11:23:29 -0000 1.52 @@ -133,10 +133,10 @@ } 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"); |