Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Tutorial.cpp

Go to the documentation of this file.
00001 /*
00002 CS Senior Project 2003
00003 Team : Leftfield
00004 Project : ModernWarfare
00005 Members :
00006 - Russ Christensen              <rchriste@cs.utah.edu>
00007 - Todd Smith                    <tcsmith@cs.utah.edu>
00008 - Usit Duongsaa                 <duongsaa@cs.utah.edu>
00009 Copyright 2003 Russ Christensen, Usit Duongsaa, and Todd Smith. All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00012 
00013 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
00014 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
00015 THIS SOFTWARE IS PROVIDED BY RUSS CHRISTENSEN, USIT DUONGSAA, AND TODD SMITH ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RUSS, USIT, TODD OR OTHER CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00016 */
00017 
00018 #include "Tutorial.h"
00019 #include "Sound.h"
00020 
00021 Tutorial::Tutorial() : m_ticksRemainingBeforeCurrentTutorialItemStops(0), m_intro(NOT_PLAYED), m_overhead(NOT_PLAYED), 
00022 m_battleMode(NOT_PLAYED), m_city(NOT_PLAYED), m_unit(NOT_PLAYED), m_overheadWhileBattle(NOT_PLAYED), m_battleCircle(NOT_PLAYED), 
00023 m_twoBattlesAtOnce(NOT_PLAYED)
00024 {
00025 }
00026 
00027 Tutorial::~Tutorial()
00028 {
00029         //nothing to do
00030 }
00031 
00032 void Tutorial::update()
00033 {
00034         if (m_ticksRemainingBeforeCurrentTutorialItemStops > 0) --m_ticksRemainingBeforeCurrentTutorialItemStops;
00035 }
00036 //static const int SMPL_TUTORIAL_CITIES                = 7;
00037 //static const int SMPL_TUTORIAL_INTRO                 = 8;
00038 //static const int SMPL_TUTORIAL_OVERHEAD              = 9;
00039 //static const int SMPL_TUTORIAL_UNITS                 = 10;
00040 //static const int SMPL_TUTORIAL_BATTLE_CIRCLE         = 11;
00041 //static const int SMPL_TUTORIAL_OVERHEAD_WHILE_BATTLE = 12;
00042 //static const int SMPL_TUTORIAL_BATTLE_MODE           = 13;
00043 //static const int SMPL_TUTORIAL_TWO_BATTLES_AT_ONCE   = 14;
00044 void Tutorial::intro()
00045 {
00046         if (m_ticksRemainingBeforeCurrentTutorialItemStops == 0 && m_intro == NOT_PLAYED)
00047         {
00048                 Sound::play(Sound::SMPL_TUTORIAL_INTRO, 1.0f);
00049                 m_intro = PLAYED;
00050                 const int SAMPLE_LENGTH(20);
00051                 const int ONE_SECOND_OF_TICKS(60);
00052                 m_ticksRemainingBeforeCurrentTutorialItemStops = SAMPLE_LENGTH * ONE_SECOND_OF_TICKS;
00053         }
00054 }
00055 
00056 void Tutorial::overhead()
00057 {
00058         if (m_ticksRemainingBeforeCurrentTutorialItemStops == 0 && m_overhead == NOT_PLAYED)
00059         {
00060                 Sound::play(Sound::SMPL_TUTORIAL_OVERHEAD, 1.0f);
00061                 m_overhead = PLAYED;
00062                 const int SAMPLE_LENGTH(25);
00063                 const int ONE_SECOND_OF_TICKS(60);
00064                 m_ticksRemainingBeforeCurrentTutorialItemStops = SAMPLE_LENGTH * ONE_SECOND_OF_TICKS;
00065         }
00066 }
00067 
00068 void Tutorial::battleMode()
00069 {
00070         if (m_ticksRemainingBeforeCurrentTutorialItemStops == 0 && m_battleMode == NOT_PLAYED)
00071         {
00072                 Sound::play(Sound::SMPL_TUTORIAL_BATTLE_MODE, 1.0f);
00073                 m_battleMode = PLAYED;
00074                 const int SAMPLE_LENGTH(35);
00075                 const int ONE_SECOND_OF_TICKS(60);
00076                 m_ticksRemainingBeforeCurrentTutorialItemStops = SAMPLE_LENGTH * ONE_SECOND_OF_TICKS;
00077         }
00078 }
00079 
00080 void Tutorial::city()
00081 {
00082         if (m_ticksRemainingBeforeCurrentTutorialItemStops == 0 && m_city == NOT_PLAYED)
00083         {
00084                 Sound::play(Sound::SMPL_TUTORIAL_CITIES, 1.0f);
00085                 m_city = PLAYED;
00086                 const int SAMPLE_LENGTH(35);
00087                 const int ONE_SECOND_OF_TICKS(60);
00088                 m_ticksRemainingBeforeCurrentTutorialItemStops = SAMPLE_LENGTH * ONE_SECOND_OF_TICKS;
00089 
00090         }
00091 }
00092 
00093 void Tutorial::unit()
00094 {
00095         if (m_ticksRemainingBeforeCurrentTutorialItemStops == 0 && m_unit == NOT_PLAYED)
00096         {
00097                 Sound::play(Sound::SMPL_TUTORIAL_UNITS, 1.0f);
00098                 m_unit = PLAYED;
00099                 const int SAMPLE_LENGTH(35);
00100                 const int ONE_SECOND_OF_TICKS(60);
00101                 m_ticksRemainingBeforeCurrentTutorialItemStops = SAMPLE_LENGTH * ONE_SECOND_OF_TICKS;
00102 
00103         }
00104 }
00105 
00106 void Tutorial::overheadWhileBattle()
00107 {
00108         if (m_ticksRemainingBeforeCurrentTutorialItemStops == 0 && m_overheadWhileBattle == NOT_PLAYED)
00109         {
00110                 Sound::play(Sound::SMPL_TUTORIAL_OVERHEAD_WHILE_BATTLE, 1.0f);
00111                 m_overheadWhileBattle = PLAYED;
00112                 const int SAMPLE_LENGTH(10);
00113                 const int ONE_SECOND_OF_TICKS(60);
00114                 m_ticksRemainingBeforeCurrentTutorialItemStops = SAMPLE_LENGTH * ONE_SECOND_OF_TICKS;
00115         }
00116 }
00117 
00118 void Tutorial::battleCircle()
00119 {
00120         if (m_ticksRemainingBeforeCurrentTutorialItemStops == 0 && m_battleCircle == NOT_PLAYED)
00121         {
00122                 Sound::play(Sound::SMPL_TUTORIAL_BATTLE_CIRCLE, 1.0f);
00123                 m_battleCircle = PLAYED;
00124                 const int SAMPLE_LENGTH(25);
00125                 const int ONE_SECOND_OF_TICKS(60);
00126                 m_ticksRemainingBeforeCurrentTutorialItemStops = SAMPLE_LENGTH * ONE_SECOND_OF_TICKS;
00127         }
00128 }
00129 
00130 void Tutorial::twoBattlesAtOnce()
00131 {
00132         if (m_ticksRemainingBeforeCurrentTutorialItemStops == 0 && m_twoBattlesAtOnce == NOT_PLAYED)
00133         {
00134                 Sound::play(Sound::SMPL_TUTORIAL_TWO_BATTLES_AT_ONCE, 1.0f);
00135                 m_twoBattlesAtOnce = PLAYED;
00136                 const int SAMPLE_LENGTH(15);
00137                 const int ONE_SECOND_OF_TICKS(60);
00138                 m_ticksRemainingBeforeCurrentTutorialItemStops = SAMPLE_LENGTH * ONE_SECOND_OF_TICKS;
00139         }
00140 }
00141 
00142 void Tutorial::stopTutorial()
00143 {
00144         for(int i(Sound::SMPL_TUTORIAL_CITIES); i < Sound::SMPL_TUTORIAL_TWO_BATTLES_AT_ONCE; ++i) Sound::stop(i);
00145         m_intro = PLAYED;
00146         m_overhead = PLAYED;
00147         m_battleMode = PLAYED;
00148         m_city = PLAYED;
00149         m_unit = PLAYED;
00150         m_overheadWhileBattle = PLAYED;
00151         m_battleCircle = PLAYED;
00152         m_twoBattlesAtOnce = PLAYED;
00153 }

Generated on Wed Apr 23 05:50:16 2003 for Modern Warfare by doxygen1.3-rc2