00001 // SuperTux - End Sequence 00002 // Copyright (C) 2007 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de> 00003 // 00004 // This program is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 00017 #include "object/endsequence.hpp" 00018 00019 #include "object/player.hpp" 00020 #include "supertux/sector.hpp" 00021 00022 EndSequence::EndSequence() : 00023 isrunning(false), 00024 isdone(false), 00025 tux_may_walk(true), 00026 end_sequence_controller(0) 00027 { 00028 } 00029 00030 EndSequence::~EndSequence() 00031 { 00032 delete end_sequence_controller; 00033 } 00034 00035 void 00036 EndSequence::update(float elapsed_time) 00037 { 00038 if (!isrunning) return; 00039 running(elapsed_time); 00040 } 00041 00042 void 00043 EndSequence::draw(DrawingContext& /*context*/) 00044 { 00045 } 00046 00047 void 00048 EndSequence::start() 00049 { 00050 if (isrunning) return; 00051 isrunning = true; 00052 isdone = false; 00053 00054 Player& tux = *Sector::current()->player; 00055 end_sequence_controller = new CodeController(); 00056 tux.set_controller(end_sequence_controller); 00057 tux.set_speedlimit(230); //MAX_WALK_XM 00058 00059 starting(); 00060 } 00061 00062 void 00063 EndSequence::stop_tux() 00064 { 00065 tux_may_walk = false; 00066 } 00067 00068 void 00069 EndSequence::stop() 00070 { 00071 if (!isrunning) return; 00072 isrunning = false; 00073 isdone = true; 00074 stopping(); 00075 } 00076 00077 bool 00078 EndSequence::is_tux_stopped() 00079 { 00080 return !tux_may_walk; 00081 } 00082 00083 bool 00084 EndSequence::is_done() 00085 { 00086 return isdone; 00087 } 00088 00089 void 00090 EndSequence::starting() 00091 { 00092 } 00093 00094 void 00095 EndSequence::running(float /*elapsed_time*/) 00096 { 00097 end_sequence_controller->update(); 00098 } 00099 00100 void 00101 EndSequence::stopping() 00102 { 00103 } 00104 00105 /* EOF */