00001 /* 00002 * Marshmallow Duel DS v2 00003 * Copyright © 2007 Sam Pospischil http://pospi.spadgos.com 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00020 #ifndef _PICKUPSPAWNER_H 00021 #define _PICKUPSPAWNER_H 00022 00023 #include <PA9.h> 00024 #include <dswifi9.h> 00025 #include <vector> 00026 using std::vector; 00027 #include "macros.h" 00028 #include "spriteObject.h" 00029 00030 //forward declaration 00031 class Pickup; 00032 00049 class pickupSpawner : public spriteObject 00050 { 00051 public: 00052 pickupSpawner(spriteManager *newgm); 00053 virtual ~pickupSpawner(); 00054 00055 virtual void updateSprite(); 00056 00057 void pickupDied(); 00058 00064 enum spawnDir 00065 { 00066 SDIR_DOWN, 00067 SDIR_LEFT, 00068 SDIR_RIGHT 00069 }; 00070 void setDirection(spawnDir dir) {pickupDir = dir;} 00071 spawnDir getDirection() {return pickupDir;} 00072 00073 void addSpawnTime(u8 secs, u8 type); 00074 00076 static const u8 PICKUPLIFEMIN = 10; 00078 static const u8 PICKUPLIFEMAX = 25; 00080 static const u8 IDLEMIN = 26; 00082 static const u8 IDLEMAX = 50; 00083 00084 private: 00086 static const u16 PICKUPSPEEDMIN = 64; 00088 static const u16 PICKUPSPEEDMAX = 144; 00089 00090 void resetIdleTime(); 00091 00097 struct pendingPickup 00098 { 00099 u16 framesUntilSpawn; 00100 u8 nextType; 00101 }; 00102 00104 vector<pendingPickup> pendingPickups; 00106 spawnDir pickupDir; 00107 }; 00108 00109 #endif