Fixes for datatype size on amd64.
[crack-attack.git] / src / CountDownManager.cxx
blob898fb8f8fd8cf08921de2db80c09476ef63cd929
1 /*
2 * CountDownManager.cxx
3 * Daniel Nelson - 10/27/0
5 * Copyright (C) 2000 Daniel Nelson
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * Daniel Nelson - aluminumangel.org
22 * 174 W. 18th Ave.
23 * Columbus, OH 43210
25 * Very simple, but I need somewhere to put this code.
28 #include "CountDownManager.h"
30 #include "Game.h"
31 #include "MessageManager.h"
32 #include "Displayer.h"
33 #ifdef AUDIO_ENABLED
34 #include "Sound.h"
35 #include "Music.h"
36 #endif
39 int CountDownManager::state;
40 int CountDownManager::start_pause_alarm;
41 int CountDownManager::message_switch_alarm;
43 void CountDownManager::gameStart ( )
45 start_pause_alarm = GC_START_PAUSE_DELAY;
46 message_switch_alarm = GC_START_PAUSE_DELAY / 3;
47 state = 3;
49 MessageManager::readyMessage(state);
50 #ifdef AUDIO_ENABLED
51 Music::fadeout( 3000 );
52 #endif
55 void CountDownManager::cleanUp ( )
57 if (state != -1) MessageManager::freeMessage();
60 void CountDownManager::timeStep_inline_split_ ( )
62 if (start_pause_alarm)
63 start_pause_alarm--;
65 if (message_switch_alarm == 30) {
66 #ifdef AUDIO_ENABLED
67 Sound::play( GC_SOUND_COUNTDOWN, 1 + state * 3 );
68 #endif
70 if (--message_switch_alarm == 0) {
71 if (--state == -1) {
72 MessageManager::freeMessage();
73 message_switch_alarm = 0;
75 } else if (state == MS_COUNT_DOWN_GO) {
76 MessageManager::freeMessage();
77 MessageManager::readyMessage(MS_COUNT_DOWN_GO);
78 #ifdef AUDIO_ENABLED
79 Music::stop();
80 Music::play();
81 #endif
82 message_switch_alarm = GC_START_PAUSE_DELAY / 3;
84 } else {
85 MessageManager::nextMessage(state);
86 message_switch_alarm = GC_START_PAUSE_DELAY / 3;