1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
/* $Id: Player.h,v 1.21 2003/07/16 16:11:14 nan Exp $ */
// Copyright (C) 2000, 2001, 2002 神南 吉宏(Kanna Yoshihiro)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef _Player_
#define _Player_
#include "PlayerView.h"
#include "PlayerView2D.h"
// m_playerType
#define PLAYER_PROTO 0 // Prototype player
#define PLAYER_PENATTACK 1 // Pen Attack
#define PLAYER_SHAKECUT 2 // Cut
#define PLAYER_PENDRIVE 3 // Pen Drive
// m_swingType
#define SWING_NORMAL 0 //
#define SWING_POKE 1 // push?
#define SWING_SMASH 2 //
#define SWING_DRIVE 3 //
#define SWING_CUT 4 //
#define SWING_BLOCK 5 //
class PlayerView;
class HitMark;
class Ball;
class Player {
friend class Howto;
friend class Opening;
friend class OpeningView;
public:
Player();
Player( long side );
Player( long playerType, long side, double x, double y, double z,
double vx, double vy, double vz,long status, long swing,
long swingType, bool swingSide, long afterSwing, long swingError,
double targetX, double targetY, double eyeX, double eyeY,
double eyeZ, long pow, double spin, double stamina, long statusMax );
virtual ~Player();
void operator=(Player&);
static Player* Create( long player, long side, long type );
virtual bool Init();
//virtual bool Reset( struct PlayerData *p );
virtual bool Reset( Player *p );
virtual bool Move( SDL_keysym *KeyHistory, long *MouseXHistory,
long *MouseYHistory, unsigned long *MouseBHistory,
int Histptr );
virtual bool AddStatus( long diff );
virtual View *GetView() { return m_View; };
virtual long GetSide() { return m_side; }
virtual long GetPlayerType() { return m_playerType; }
virtual double GetX() { return m_x; }
virtual double GetY() { return m_y; }
virtual double GetZ() { return m_z; }
virtual double GetVX() { return m_vx; }
virtual double GetVY() { return m_vy; }
virtual double GetVZ() { return m_vz; }
virtual long GetPower() { return m_pow; }
virtual double GetSpin() { return m_spin; }
virtual double GetTargetX() { return m_targetX; }
virtual double GetTargetY() { return m_targetY; }
virtual double GetEyeX() { return m_eyeX; }
virtual double GetEyeY() { return m_eyeY; }
virtual double GetEyeZ() { return m_eyeZ; }
virtual double GetLookAtX() { return m_lookAtX; }
virtual double GetLookAtY() { return m_lookAtY; }
virtual double GetLookAtZ() { return m_lookAtZ; }
virtual double GetStamina() { return m_stamina; }
virtual long GetStatus() { return m_status; }
virtual long GetSwing() { return m_swing; }
virtual long GetSwingType() { return m_swingType; }
virtual bool GetSwingSide() { return m_swingSide; }
virtual long GetSwingError() { return m_swingError; }
virtual long GetAfterSwing() { return m_afterSwing; }
virtual long GetDragX() { return m_dragX; }
virtual long GetDragY() { return m_dragY; }
virtual bool GetShoulder( double &x, double &y, double ° );
virtual bool GetElbow( double °x, double& degy );
virtual bool GetHand( double °x, double °y, double °z );
// true -> forehand
// false -> backhand
virtual bool ForeOrBack();
virtual bool Warp( double x, double y, double z,
double vx, double vy, double vz );
virtual bool ExternalSwing( long pow, double spin, long swingType, long swing );
virtual bool Warp( char *buf );
virtual bool ExternalSwing( char *buf );
virtual char * SendSwing( char *buf );
virtual char * SendLocation( char *buf );
virtual bool SendAll( int sd );
virtual bool GetModifiedTarget( double &targetX, double &targetY );
virtual void CalcLevel( Ball *ball, double &diff, double &level, double &maxVy );
long StatusBorder();
protected:
long m_playerType; // Player type
long m_side; // 1 --- ( y < 0 )
// -1 --- ( y > 0 )
double m_x; // player location
double m_y;
double m_z;
double m_vx; // player velocity
double m_vy;
double m_vz;
long m_status; // status gauge
long m_swing; // swing status
long m_swingType; // swing type
bool m_swingSide; // forehand or backhand
long m_afterSwing; //
long m_swingError; // Error when hitting
// 0 --- Perfect
// 1 --- Great
// 2 --- Good
// 3 --- Boo
// 4 --- Miss
double m_targetX; // location of target circle
double m_targetY; // location of target circle
double m_eyeX; // Viewpoint
double m_eyeY;
double m_eyeZ;
double m_lookAtX;
double m_lookAtY;
double m_lookAtZ;
long m_pow; // power
double m_spin; // topspin/backspin
double m_stamina;
long m_statusMax; // Max status value
long m_dragX;
long m_dragY; // Mouse drag
PlayerView* m_View;
double m_lastSendX;
double m_lastSendY;
double m_lastSendZ;
double m_lastSendVX;
double m_lastSendVY;
double m_lastSendVZ;
long m_lastSendCount;
virtual bool KeyCheck( SDL_keysym *KeyHistory, long *MouseXHistory,
long *MouseYHistory, unsigned long *MouseBHistory,
int Histptr );
virtual bool Swing( long power );
virtual bool StartSwing( long power );
virtual bool HitBall();
virtual bool SwingError();
void UpdateLastSend();
void AddError( double &vx, double &vy, double &vz );
};
#endif // _Player_
|