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 _WEAPON_H 00021 #define _WEAPON_H 00022 00023 #include <PA9.h> 00024 #include <dswifi9.h> 00025 #include <vector> 00026 #include <string> 00027 using namespace std; 00028 #include "macros.h" 00029 #include "pickup.h" 00030 00031 //forward declaration 00032 class Player; 00033 00052 class Weapon 00053 { 00054 public: 00055 Weapon(Player* p); 00056 virtual ~Weapon(); 00057 00058 virtual bool fire(); 00059 virtual void stopFiring(); 00060 virtual void weaponTick(); 00061 00066 bool isFiring() {return bFiring;} 00071 bool wasFiring() {return bWasFiring;} 00072 00077 bool midairWeapon() {return canFireInAir;} 00078 00083 s8 getAmmo() {return ammo;} 00084 00089 Pickup::pickupType getType() {return myType;} 00090 00091 protected: 00096 virtual void weaponFireAction() = 0; 00097 00098 void handleMovementAndAmmo(); 00099 00101 Player* pawn; 00102 00104 Pickup::pickupType myType; 00105 00107 bool canFireStanding; 00109 bool canFireInAir; 00111 bool canFireCrouching; 00113 bool canMoveWhileFiring; 00115 s8 ammo; 00116 00118 bool bHeldFire; 00120 vector<u8> firingAnim; 00122 u8 fireAnimSpeed; 00123 00125 bool bFiring; 00127 bool bWasFiring; 00128 00129 #ifdef __MDDEBUG 00130 string className; 00131 #endif 00132 }; 00133 00134 #endif