00001 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 5 -*- */ 00002 00003 /* 00004 * Combination of a first person action and a real time strategy battle game. 00005 */ 00006 00007 /* 00008 * CannonTurret.h 00009 * MetalWarriors 00010 * $Revision: 1.2 $ 00011 * 00012 * Created by Erik Ytterberg on Thu Aug 4 2005. 00013 * Copyright (c) 2005 Daniel Aarno and Erik Ytterberg - All rights reserved. 00014 * 00015 * This program is free software; you can redistribute it and/or modify 00016 * it under the terms of the GNU General Public License as published by 00017 * the Free Software Foundation; either version 2 of the License, or 00018 * (at your option) any later version. 00019 * 00020 * This program is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * You should have received a copy of the GNU General Public License 00026 * along with this program; if not, write to the Free Software 00027 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00028 */ 00029 00030 #ifndef CANNONTURRET_H 00031 #define CANNONTURRET_H 00032 00033 #include "Model.h" 00034 #include "Target.h" 00035 00036 class CannonTurret 00037 { 00038 public: 00039 float fi; 00040 float theta; 00041 float desired_fi; 00042 float desired_theta; 00043 model_cap_data_t *turret_angle; 00044 model_cap_data_t *barrel_angle; 00045 int power; 00046 float reload_timer; 00047 00048 bool turretRight; 00049 bool turretLeft; 00050 bool barrelUp; 00051 bool barrelDown; 00052 bool camFollowTurret; 00053 00054 protected: 00055 float *turret_translation; 00056 float *barrel_translation; 00057 00058 float *cameraAimPos; //This should point to the parents camRelFollow 00059 00060 public: 00061 CannonTurret(CompModel *model, float *aim); 00062 void update(float dTime, float *nomal, float *rot); 00063 void setBarrelAngle(float angle); 00064 void incBarrelAngle(bool b); 00065 void decBarrelAngle(bool b); 00066 void setTurretAngle(float angle); 00067 void incTurretAngle(bool b); 00068 void decTurretAngle(bool b); 00069 void setCamFollowTurret(bool b); 00070 bool aimReady(void); 00071 GroundTarget *fire(float *pos, float *rot, bool predict); 00072 float getReloadTimer(void); 00073 void setReloadTimer(float new_timer); 00074 00075 protected: 00076 float stabilizeBarrel(float *normal, float *rot); 00077 }; 00078 00079 #endif /*CANNONTURRET_H*/
1.4.7