From 8e3f39f3d94fed9fb599d29fcdc87dfd4890041f Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 12 Apr 2001 18:48:33 +0000 Subject: [PATCH] --- source/player/player.cpp | 10 ++++++++++ source/player/player.h | 12 ++++++++++++ source/player/pmchop.cpp | 13 ++++++++++--- source/player/pmchop.h | 2 +- source/player/pmodes.cpp | 6 +++--- source/player/pmodes.h | 5 +++-- 6 files changed, 39 insertions(+), 9 deletions(-) diff --git a/source/player/player.cpp b/source/player/player.cpp index 534b2adae..0126edaf5 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -633,6 +633,16 @@ void CPlayer::addLife() } } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +ATTACK_STATE CPlayer::getAttackState() +{ + return m_currentPlayerModeClass->getAttackState(); +} /*---------------------------------------------------------------------- Function: diff --git a/source/player/player.h b/source/player/player.h index 853377135..dc8392e98 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -121,6 +121,16 @@ typedef enum }PLAYERINPUT; +// For getAttackState() +typedef enum +{ + ATTACK_STATE__NONE, + ATTACK_STATE__KARATE, + ATTACK_STATE__BUTT_BOUNCE, +} ATTACK_STATE; + + + /*---------------------------------------------------------------------- Structure defintions -------------------- */ @@ -153,6 +163,8 @@ public: void addHealth(int _health); void addLife(); + ATTACK_STATE getAttackState(); + int isRecoveringFromHit() {return m_invincibleFrameCount!=0;} public: void setMode(PLAYER_MODE _mode); diff --git a/source/player/pmchop.cpp b/source/player/pmchop.cpp index 77632ecaf..9e61b43ec 100644 --- a/source/player/pmchop.cpp +++ b/source/player/pmchop.cpp @@ -120,9 +120,16 @@ void CPlayerModeChop::setAnimFrame(int _animFrame) Params: Returns: ---------------------------------------------------------------------- */ -int CPlayerModeChop::isInAttackState() +ATTACK_STATE CPlayerModeChop::getAttackState() { - return m_chopping||CPlayerModeBase::isInAttackState(); + if(m_chopping) + { + return ATTACK_STATE__KARATE; + } + else + { + return CPlayerModeBase::getAttackState(); + } } /*---------------------------------------------------------------------- @@ -131,7 +138,7 @@ int CPlayerModeChop::isInAttackState() Params: Returns: ---------------------------------------------------------------------- */ -int CPlayerModeChop::canAttackFromThisState() +int CPlayerModeChop::canAttackFromThisState() { int ret=false; diff --git a/source/player/pmchop.h b/source/player/pmchop.h index dd607bac0..953f1dcf3 100644 --- a/source/player/pmchop.h +++ b/source/player/pmchop.h @@ -43,7 +43,7 @@ public: virtual void setAnimNo(int _animNo); virtual void setAnimFrame(int _animFrame); - virtual int isInAttackState(); + virtual ATTACK_STATE getAttackState(); private: int canAttackFromThisState(); diff --git a/source/player/pmodes.cpp b/source/player/pmodes.cpp index 5e795ce9a..9951134fa 100644 --- a/source/player/pmodes.cpp +++ b/source/player/pmodes.cpp @@ -193,15 +193,15 @@ void CPlayerModeBase::render() Params: Returns: ---------------------------------------------------------------------- */ -int CPlayerModeBase::isInAttackState() +ATTACK_STATE CPlayerModeBase::getAttackState() { - int ret=false; + ATTACK_STATE ret=ATTACK_STATE__NONE; switch(getState()) { case STATE_BUTTFALL: case STATE_BUTTLAND: - ret=true; + ret=ATTACK_STATE__BUTT_BOUNCE; break; case STATE_IDLE: diff --git a/source/player/pmodes.h b/source/player/pmodes.h index 8136ff077..ebd0cf15f 100644 --- a/source/player/pmodes.h +++ b/source/player/pmodes.h @@ -88,7 +88,8 @@ public: int getPadInputHeld(); int getPadInputDown(); - virtual int isInAttackState() {return false;} + virtual ATTACK_STATE getAttackState() {return ATTACK_STATE__NONE;} + protected: DVECTOR getPlayerPos(); @@ -113,7 +114,7 @@ public: virtual void think(); virtual void render(); - virtual int isInAttackState(); + virtual ATTACK_STATE getAttackState(); virtual int canTeeter() {return m_currentState==STATE_IDLE;} virtual int canFallForever() {return m_currentState==STATE_BUTTFALL;}