Really low graphics patch thanks to Stephan Beyer
[crack-attack.git] / src / GarbageGenerator.h
blob03f537f8129159571032eee967f201641d28a695
1 /*
2 * GarbageGenerator.h
3 * Daniel Nelson - 8/24/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
26 #ifndef GARBAGEGENERATOR_H
27 #define GARBAGEGENERATOR_H
29 using namespace std;
31 #include "Game.h"
32 #include "MetaState.h"
33 #include "Communicator.h"
34 #include "Random.h"
36 class ComboTabulator;
37 class CommunicationBuffer;
39 class GarbageQueueElement {
40 public:
41 bool active;
42 int alarm;
43 int height;
44 int width;
45 int flavor;
48 /* static */ class GarbageGenerator {
49 public:
50 static void gameStart ( );
52 static void comboElimination ( ComboTabulator &combo );
53 static void comboComplete ( ComboTabulator &combo );
54 static void timeStep ( );
55 static void addToQueue ( CommunicationBuffer &buffer );
57 private:
58 static inline void sendGarbage ( int height, int width, int flavor )
60 if (!(MetaState::mode & CM_SOLO))
61 Communicator::sendGarbage(height, width, flavor);
62 else
63 dealLocalGarbage(height, width, flavor, Game::time_step);
66 static inline void sendSpecialGarbage ( int flavor )
68 if (!(MetaState::mode & CM_SOLO))
69 Communicator::sendGarbage(0, 0, flavor);
70 else
71 dealSpecialLocalGarbage(flavor, Game::time_step);
74 static inline int determineDropTime ( int time_stamp )
76 return time_stamp
77 + (GC_AVERAGE_GARBAGE_DROP_DELAY - GC_SPREAD_GARBAGE_DROP_DELAY / 2)
78 + Random::number(GC_SPREAD_GARBAGE_DROP_DELAY);
81 static void dealLocalGarbage ( int height, int width, int flavor,
82 int time_stamp );
83 static void dealSpecialLocalGarbage ( int flavor, int time_stamp );
85 static GarbageQueueElement garbage_queue[GC_GARBAGE_QUEUE_SIZE];
86 static int waiting_count;
89 #endif