1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
/*************************************************************************
"I Have No Tomatoes"
Copyright (c) 2004, Mika Halttunen
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
Mika Halttunen <lsoft@mbnet.fi>
*************************************************************************/
#ifndef _SPECIAL_POWER
#define _SPECIAL_POWER
#include "enemy.h"
// Red special powers
#define RED_POWER_TRAP 0
#define RED_POWER_WILDFIRE 1
#define RED_POWER_NAPALM 2
// Green special powers
#define GREEN_POWER_WISP 3
#define GREEN_POWER_POTATOMAN 4
#define GREEN_POWER_FLOWERPOWER 5
// Blue special powers
#define BLUE_POWER_TELEPORT 6
#define BLUE_POWER_TURN 7
#define BLUE_POWER_LIGHTNING 8
// The height of the teleport power
#define TELEPORT_POWER_HEIGHT 15.0f
// Special power in progress? (zero == not using, 1 == p1 using, 2 == p2)
extern int using_special_power;
// Which special power
extern int which_special_power;
// Special power timer
extern int special_power_count;
// Does the special power pause the game?
extern bool special_power_pause;
void invoke_special_power(int who, int what);
void update_special_power();
void draw_special_power();
// A base class from which the special powers are derived
class SPECIAL_POWER {
public:
virtual void init() = 0; // Initialize the special power
virtual void draw() = 0; // Draw the special power
virtual void update() = 0; // Update the special power
};
// Trap power
class SP_TRAP : public SPECIAL_POWER {
public:
virtual void init();
virtual void draw();
virtual void update();
};
extern SP_TRAP sp_trap;
// Wildfire power
class SP_WILDFIRE : public SPECIAL_POWER {
public:
ENEMY *burning[ENEMY_AMOUNT]; // Pointers to the burning enemies
int burn_count[ENEMY_AMOUNT]; // Burning counters for the burning enemies
virtual void init();
virtual void draw();
virtual void update();
};
extern SP_WILDFIRE sp_wildfire;
// Napalm power
class SP_NAPALM : public SPECIAL_POWER {
public:
int cur_x, cur_y; // Current X and Y of the explosions
int explo_delay; // Delay between explosions
int oldx[2], oldy[2]; // Old player positions before the jump
virtual void init();
virtual void draw();
virtual void update();
};
extern SP_NAPALM sp_napalm;
// Wisp power
class SP_WISP : public SPECIAL_POWER {
public:
virtual void init();
virtual void draw();
virtual void update();
};
extern SP_WISP sp_wisp;
// Potato man power
class SP_POTATOMAN : public SPECIAL_POWER {
public:
virtual void init();
virtual void draw();
virtual void update();
};
extern SP_POTATOMAN sp_potatoman;
// Flower power
class SP_FLOWERPOWER : public SPECIAL_POWER {
public:
virtual void init();
virtual void draw();
virtual void update();
};
extern SP_FLOWERPOWER sp_flowerpower;
// Teleport power
class SP_TELEPORT : public SPECIAL_POWER {
public:
int who; // Who is teleporting?
int teleport_dir; // Teleport direction
float teleport_pos; // Position in the teleport "beam" (between 0 and 1)
int tx, ty; // Target position
virtual void init();
virtual void draw();
virtual void update();
};
extern SP_TELEPORT sp_teleport;
// Turn power
class SP_TURN : public SPECIAL_POWER {
public:
virtual void init();
virtual void draw();
virtual void update();
};
extern SP_TURN sp_turn;
// Lightning power
class SP_LIGHTNING : public SPECIAL_POWER {
public:
ENEMY *targets[ENEMY_AMOUNT]; // Target pointers
float noise[ENEMY_AMOUNT]; // Noise levels for the lightnings
int num_targets; // Number of targets
virtual void init();
virtual void draw();
virtual void update();
};
extern SP_LIGHTNING sp_lightning;
#endif
|