00001 /****************************************************************************** 00002 * Wormux is a convivial mass murder game. 00003 * Copyright (C) 2001-2004 Lawrence Azzoug. 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00018 ****************************************************************************** 00019 * Ninja rope. 00020 *****************************************************************************/ 00021 00022 #ifndef NINJA_ROPE_H 00023 #define NINJA_ROPE_H 00024 //----------------------------------------------------------------------------- 00025 #include "weapon.h" 00026 #include "../include/base.h" 00027 //----------------------------------------------------------------------------- 00028 00029 const int node_max=200; 00030 00031 class NinjaRope : public Weapon 00032 { 00033 private: 00034 struct s_rope_node 00035 { 00036 int x,y; 00037 double angle ; 00038 int sense ; 00039 }; 00040 00041 uint last_mvt; 00042 double last_broken_node_angle; 00043 double last_broken_node_sense; 00044 00045 // Rope launching data. 00046 bool m_attaching; 00047 bool m_rope_attached; 00048 double m_initial_angle; 00049 uint m_launch_time; 00050 uint m_hooked_time; 00051 Sprite* m_hook_sprite; 00052 Sprite* m_node_sprite; 00053 00054 public: 00055 s_rope_node rope_node[node_max]; 00056 int last_node; 00057 int m_fixation_x, m_fixation_y; 00058 bool go_left, go_right ; 00059 double delta_len ; 00060 00061 NinjaRope(); 00062 void Active(); 00063 void Draw(); 00064 void HandleKeyEvent(Action::Action_t action, Keyboard::Key_Event_t event_type) ; 00065 void NotifyMove(bool collision); 00066 void SignalTurnEnd(); 00067 EmptyWeaponConfig& cfg(); 00068 protected: 00069 void Refresh(); 00070 void p_Deselect(); 00071 bool p_Shoot(); 00072 void GoUp(); 00073 void GoDown(); 00074 void GoLeft(); 00075 void GoRight(); 00076 void StopLeft(); 00077 void StopRight(); 00078 void TryAttachRope(); 00079 void UnattachRope(); 00080 bool TryAddNode(int CurrentSense) ; 00081 bool TryBreakNode(int CurrentSense) ; 00082 }; 00083 00084 //----------------------------------------------------------------------------- 00085 #endif /* NINJA_ROPE_H */