00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00030 }
00031
00032 void Tutorial::update()
00033 {
00034 if (m_ticksRemainingBeforeCurrentTutorialItemStops > 0) --m_ticksRemainingBeforeCurrentTutorialItemStops;
00035 }
00036
00037
00038
00039
00040
00041
00042
00043
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 }