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 #include "wp_chut.h" 00021 #include "player.h" 00022 #include "gameManager.h" 00023 00024 wp_chut::~wp_chut() 00025 { 00026 if (isFiring() || wasFiring()) 00027 pawn->updateAnimation(); 00028 } 00029 00030 void wp_chut::weaponTick() 00031 { 00032 if (pawn->isOnGround() && isFiring()) 00033 stopFiring(); 00034 00035 if (isFiring()) 00036 { 00037 if (pawn->getvy() > (FALLSPEED>>8)) 00038 pawn->setvy(FALLSPEED>>8); 00039 pawn->setFrame(36); 00040 } else if (wasFiring()) 00041 { 00042 pawn->updateAnimation(); 00043 } 00044 00045 Weapon::weaponTick(); 00046 } 00047 00048 void wp_chut::weaponFireAction() 00049 { 00050 pawn->setUnstable(false); 00051 #ifdef __WITHSOUND 00052 pawn->playSound(&pawn->gm->chutOpen); 00053 #endif 00054 } 00055 00056 void wp_chut::stopFiring() 00057 { 00058 Weapon::stopFiring(); 00059 pawn->setUnstable(false); 00060 #ifdef __WITHSOUND 00061 pawn->playSound(&pawn->gm->chutClose); 00062 #endif 00063 }