3 * Daniel Nelson - 8/24/0
5 * Copyright (C) 2000 Daniel Nelson
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
25 * Watches for finished combo tabulators and generates the appropriate garbage
26 * blocks. Handles the combo tabulator free store.
30 #include "ComboManager.h"
31 #include "ComboTabulator.h"
32 #include "GarbageGenerator.h"
37 ComboTabulator
ComboManager::tabulatorStore
[GC_COMBO_TABULATOR_STORE_SIZE
];
38 bool ComboManager::storeMap
[GC_COMBO_TABULATOR_STORE_SIZE
];
39 int ComboManager::combo_count
;
41 void ComboManager::gameStart ( )
43 for (int n
= GC_COMBO_TABULATOR_STORE_SIZE
; n
--; ) {
45 tabulatorStore
[n
].id
= n
;
51 void ComboManager::timeStep ( )
53 // loop through the active combos
55 for (int n
= 0; c
; n
++) {
56 if (!storeMap
[n
]) continue;
57 ComboTabulator
&combo
= tabulatorStore
[n
];
60 // if this combo is complete
61 if (combo
.involvement_count
== 0) {
63 // the garbage generator
64 GarbageGenerator::comboComplete(combo
);
66 // delete the combo; circumvent deleteComboTabulator()
69 // if an elimination in this combo just occured
70 } else if (combo
.time_stamp
== Game::time_step
) {
73 int score
= Score::reportElimination(combo
);
74 combo
.base_accumulated_score
+= score
;
75 combo
.base_score_this_step
+= score
;
77 if (combo
.n_multipliers_this_step
!= 0)
78 Score::reportMultiplier(combo
);
79 combo
.base_score_this_step
= 0;
81 // notify the garbage generator; removes the elimination magnitude
82 GarbageGenerator::comboElimination(combo
);