This commit is contained in:
parent
d696597924
commit
9c548b05e2
7 changed files with 54 additions and 1 deletions
|
@ -1688,6 +1688,18 @@ void CPlayer::setPlayerCollisionSize(int _x,int _y,int _w,int _h)
|
|||
setCollisionSize(_w,_h);
|
||||
setCollisionCentreOffset(_x,_y);
|
||||
}
|
||||
void CPlayer::getPlayerCollisionSize(int *_x,int *_y,int *_w,int *_h)
|
||||
{
|
||||
DVECTOR offset,size;
|
||||
|
||||
offset=getCollisionCentreOffset();
|
||||
size=getCollisionSize();
|
||||
|
||||
*_x=offset.vx;
|
||||
*_y=offset.vy;
|
||||
*_w=size.vx;
|
||||
*_h=size.vy;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
end */
|
||||
|
|
|
@ -337,6 +337,7 @@ public:
|
|||
};
|
||||
void resetPlayerCollisionSizeToBase();
|
||||
void setPlayerCollisionSize(int _x,int _y,int _w,int _h);
|
||||
void getPlayerCollisionSize(int *_x,int *_y,int *_w,int *_h);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -62,6 +62,10 @@ void CPlayerModeChop::enter()
|
|||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
int chopcsx=0;
|
||||
int chopcsy=-30;
|
||||
int chopcsw=80;
|
||||
int chopcsh=60;
|
||||
void CPlayerModeChop::think()
|
||||
{
|
||||
// If we're chopping then restore the 'real' anim number/frame before
|
||||
|
@ -78,6 +82,8 @@ void CPlayerModeChop::think()
|
|||
if(!m_chopping&&getPadInputDown()&PI_ACTION&&canAttackFromThisState())
|
||||
{
|
||||
m_chopFrame=0;
|
||||
getPlayerCollisionSize(&m_savedCSX,&m_savedCSY,&m_savedCSW,&m_savedCSH);
|
||||
setPlayerCollisionSize(chopcsx,chopcsy,chopcsw,chopcsh);
|
||||
m_chopping=true;
|
||||
}
|
||||
|
||||
|
@ -92,6 +98,7 @@ void CPlayerModeChop::think()
|
|||
m_player->setAnimNo(m_savedAnimNo);
|
||||
m_player->setAnimFrame(m_savedAnimFrame);
|
||||
m_chopping=false;
|
||||
setPlayerCollisionSize(m_savedCSX,m_savedCSY,m_savedCSW,m_savedCSH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,6 +139,28 @@ ATTACK_STATE CPlayerModeChop::getAttackState()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CPlayerModeChop::setPlayerCollisionSize(int _x,int _y,int _w,int _h)
|
||||
{
|
||||
if(m_chopping)
|
||||
{
|
||||
m_savedCSX=_x;
|
||||
m_savedCSY=_y;
|
||||
m_savedCSW=_w;
|
||||
m_savedCSY=_h;
|
||||
}
|
||||
else
|
||||
{
|
||||
CPlayerModeBase::setPlayerCollisionSize(_x,_y,_w,_h);
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
|
|
|
@ -45,6 +45,8 @@ public:
|
|||
|
||||
virtual ATTACK_STATE getAttackState();
|
||||
|
||||
virtual void setPlayerCollisionSize(int _x,int _y,int _w,int _h);
|
||||
|
||||
private:
|
||||
int canAttackFromThisState();
|
||||
|
||||
|
@ -52,6 +54,8 @@ private:
|
|||
int m_chopFrame;
|
||||
int m_chopping;
|
||||
|
||||
int m_savedCSX,m_savedCSY,m_savedCSW,m_savedCSH;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -480,6 +480,11 @@ void CPlayerModeBase::setPlayerCollisionSize(int _x,int _y,int _w,int _h)
|
|||
{
|
||||
m_player->setPlayerCollisionSize(_x,_y,_w,_h);
|
||||
}
|
||||
void CPlayerModeBase::getPlayerCollisionSize(int *_x,int *_y,int *_w,int *_h)
|
||||
{
|
||||
m_player->getPlayerCollisionSize(_x,_y,_w,_h);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
|
|
|
@ -146,7 +146,8 @@ public:
|
|||
int isOnEdge();
|
||||
int canMoveLeft();
|
||||
int canMoveRight();
|
||||
void setPlayerCollisionSize(int _x,int _y,int _w,int _h);
|
||||
virtual void setPlayerCollisionSize(int _x,int _y,int _w,int _h);
|
||||
virtual void getPlayerCollisionSize(int *_x,int *_y,int *_w,int *_h);
|
||||
|
||||
void moveLeft();
|
||||
void moveRight();
|
||||
|
|
|
@ -141,6 +141,7 @@ public:
|
|||
// -- Collision --
|
||||
public:
|
||||
DVECTOR getCollisionCentre() {return m_collisionCentre;}
|
||||
DVECTOR getCollisionCentreOffset() {return m_collisionCentreOffset;}
|
||||
int getCollisionRadius() {return m_collisionRadius;}
|
||||
CRECT getCollisionArea() {return m_collisionArea;}
|
||||
s16 getCollisionAngle() {return m_collisionAngle;} // pkg - move to CNpcPlatform?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue