From a6b6cdbb579edf61e9cd64221c7176edce41b535 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 12 Feb 2001 21:54:44 +0000 Subject: [PATCH] --- data/translations/text.dat | 2 + makefile.gaz | 1 + source/game/pause.cpp | 33 +++++++++------- source/player/player.cpp | 8 +++- source/player/player.h | 2 + source/player/pmodes.cpp | 38 +++++++++++++++++++ source/player/psfly.cpp | 26 ++++++------- source/player/psfly.h | 2 +- source/player/pstates.cpp | 12 ++++++ source/player/pstates.h | 1 + .../spongebob project/spongebob project.dsp | 8 ++++ 11 files changed, 103 insertions(+), 30 deletions(-) diff --git a/data/translations/text.dat b/data/translations/text.dat index 1dda739c9..9567e7441 100644 --- a/data/translations/text.dat +++ b/data/translations/text.dat @@ -151,6 +151,8 @@ eng=RESTART LEVEL ; The following texts DO NOT require translation ; --------------------------------------------------------------- +[STR__DEBUG__FLY_MODE] +eng=Set FLY mode [STR__DEBUG__BASICUNARMED_MODE] eng=Set BASICUNARMED mode [STR__DEBUG__FULLUNARMED_MODE] diff --git a/makefile.gaz b/makefile.gaz index d2322c9fd..047c53e80 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -153,6 +153,7 @@ player_src := demoplay \ psdead \ psduck \ psfall \ + psfly \ psidle \ psjump \ psrun \ diff --git a/source/game/pause.cpp b/source/game/pause.cpp index f88f3b8f6..058409df2 100644 --- a/source/game/pause.cpp +++ b/source/game/pause.cpp @@ -30,6 +30,10 @@ #include "mem\memory.h" #endif +#ifndef __PLAYER_PLAYER_H__ +#include "player\player.h" +#endif + /* Std Lib ------- */ @@ -37,10 +41,6 @@ /* Data ---- */ -#ifndef __SPR_UIGFX_H__ -#include -#endif - #ifndef __STRING_ENUMS__ #include #endif @@ -90,27 +90,32 @@ void CPauseMenu::init() (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,30,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, STR__PAUSE_MENU__QUIT, &m_quitGameFlag,true); -#ifdef __USER_paul__ + CGUIFactory::createValueButtonFrame(m_guiFrame, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,60,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, - STR__DEBUG__BASICUNARMED_MODE, - &newmode,0); + STR__DEBUG__FLY_MODE, + &newmode,PLAYER_MODE_FLY); CGUIFactory::createValueButtonFrame(m_guiFrame, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,80,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, - STR__DEBUG__FULLUNARMED_MODE, - &newmode,1); + STR__DEBUG__BASICUNARMED_MODE, + &newmode,PLAYER_MODE_BASICUNARMED); +#ifdef __USER_paul__ CGUIFactory::createValueButtonFrame(m_guiFrame, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,100,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, - STR__DEBUG__SQUEAKYBOOTS_MODE, - &newmode,2); + STR__DEBUG__FULLUNARMED_MODE, + &newmode,PLAYER_MODE_FULLUNARMED); CGUIFactory::createValueButtonFrame(m_guiFrame, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,120,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, - STR__DEBUG__NET_MODE, - &newmode,3); + STR__DEBUG__SQUEAKYBOOTS_MODE, + &newmode,PLAYER_MODE_SQUEAKYBOOTS); CGUIFactory::createValueButtonFrame(m_guiFrame, (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,140,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, + STR__DEBUG__NET_MODE, + &newmode,PLAYER_MODE_NET); + CGUIFactory::createValueButtonFrame(m_guiFrame, + (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,160,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, STR__DEBUG__CORALBLOWER_MODE, - &newmode,4); + &newmode,PLAYER_MODE_CORALBLOWER); #endif m_active=false; diff --git a/source/player/player.cpp b/source/player/player.cpp index 86fb708f3..6f9515926 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -378,7 +378,7 @@ Pos.vy=((Pos.vy-16)&0xfffffff0)+colHeight; } if(Pos.vx<16)Pos.vx=16; -else if(Pos.vx>m_mapEdge.vx)Pos.vx=m_mapEdge.vx; +else if(Pos.vx>m_mapEdge.vx-16)Pos.vx=m_mapEdge.vx-16; if(Pos.vy<16)Pos.vy=16; else if(Pos.vy>m_mapEdge.vy-16)Pos.vy=m_mapEdge.vy-16; @@ -762,6 +762,10 @@ DVECTOR CPlayer::getPlayerPos() { return Pos; } +void CPlayer::setPlayerPos(DVECTOR *_pos) +{ + Pos=*_pos; +} /*---------------------------------------------------------------------- @@ -801,7 +805,7 @@ int CPlayer::isOnSolidGround() if right half of player is hanging or 0 if no part of the player is hanging ---------------------------------------------------------------------- */ -int csize=20; +int csize=15; int CPlayer::isOnEdge() { int ret=0; diff --git a/source/player/player.h b/source/player/player.h index f440c0e73..20a274acb 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -76,6 +76,7 @@ typedef enum PLAYER_MODE_SQUEAKYBOOTS, PLAYER_MODE_NET, PLAYER_MODE_CORALBLOWER, + PLAYER_MODE_FLY, NUM_PLAYERMODES, }PLAYER_MODE; @@ -179,6 +180,7 @@ protected: DVECTOR getMoveVelocity(); void setMoveVelocity(DVECTOR *_moveVel); DVECTOR getPlayerPos(); + void setPlayerPos(DVECTOR *_pos); PLAYERINPUT getPadInputHeld(); PLAYERINPUT getPadInputDown(); diff --git a/source/player/pmodes.cpp b/source/player/pmodes.cpp index d246be1cc..3afa4a3d1 100644 --- a/source/player/pmodes.cpp +++ b/source/player/pmodes.cpp @@ -49,6 +49,10 @@ #include "player\psdead.h" #endif +#ifndef __PLAYER__PSFLY_H__ +#include "player\psfly.h" +#endif + /* Std Lib ------- */ @@ -89,6 +93,7 @@ CPlayerStateDuck stateDuck; CPlayerStateSoakUp stateSoackUp; CPlayerStateGetUp stateGetup; CPlayerStateDead stateDead; +CPlayerStateFly stateFly; @@ -264,6 +269,39 @@ CPlayer::PlayerMode CPlayer::s_modes[NUM_PLAYERMODES]= &stateDead, // STATE_DEAD } }, + + // + // Fly mode ( A useful debugging mode.. ) + // + { + { { + DEFAULT_PLAYER_JUMP_VELOCITY, // PM__JUMP_VELOCITY + DEFAULT_PLAYER_MAX_JUMP_FRAMES, // PM__MAX_JUMP_FRAMES + DEFAULT_PLAYER_MAX_SAFE_FALL_FRAMES, // PM__MAX_SAFE_FALL_FRAMES + DEFAULT_PLAYER_MAX_RUN_VELOCITY, // PM__MAX_RUN_VELOCITY + DEFAULT_PLAYER_RUN_SPEEDUP, // PM__RUN_SPEEDUP + DEFAULT_PLAYER_RUN_REVERSESLOWDOWN, // PM__RUN_REVERSESLOWDOWN + DEFAULT_PLAYER_RUN_SLOWDOWN, // PM__RUN_SLOWDOWN + } }, + { + &stateFly, // STATE_IDLE + &stateFly, // STATE_IDLETEETER + &stateFly, // STATE_JUMP + &stateFly, // STATE_RUN + &stateFly, // STATE_FALL + &stateFly, // STATE_FALLFAR + &stateFly, // STATE_BUTTBOUNCE + &stateFly, // STATE_BUTTFALL + &stateFly, // STATE_BUTTLAND + &stateFly, // STATE_ATTACK + &stateFly, // STATE_RUNATTACK + &stateFly, // STATE_AIRATTACK + &stateFly, // STATE_DUCK + &stateFly, // STATE_SOAKUP + &stateFly, // STATE_GETUP + &stateFly, // STATE_DEAD + } + }, }; diff --git a/source/player/psfly.cpp b/source/player/psfly.cpp index b29d3e365..735699d9e 100644 --- a/source/player/psfly.cpp +++ b/source/player/psfly.cpp @@ -62,7 +62,7 @@ Params: Returns: ---------------------------------------------------------------------- */ -void CPlayerStateFall::enter(CPlayer *_player) +void CPlayerStateFly::enter(CPlayer *_player) { setAnimNo(_player,ANIM_PLAYER_ANIM_IDLEHOOLA); } @@ -74,30 +74,30 @@ void CPlayerStateFall::enter(CPlayer *_player) Params: Returns: ---------------------------------------------------------------------- */ -void CPlayerStateFall::think(CPlayer *_player) +void CPlayerStateFly::think(CPlayer *_player) { int controlHeld; DVECTOR pos; controlHeld=getPadInputHeld(_player); pos=getPlayerPos(_player); - if(controlHeld&PI_UP) - { - pos.vx-=5; - } - else if(controlHeld&PI_DOWN) - { - pos.vx+=5; - } if(controlHeld&PI_LEFT) { - pos.vy-=5; + pos.vx-=8; } else if(controlHeld&PI_RIGHT) { - pos.vy+=5; + pos.vx+=8; } - this->setPlayerPos(_player,pos); + if(controlHeld&PI_UP) + { + pos.vy-=8; + } + else if(controlHeld&PI_DOWN) + { + pos.vy+=8; + } + this->setPlayerPos(_player,&pos); advanceAnimFrameAndCheckForEndOfAnim(_player); } diff --git a/source/player/psfly.h b/source/player/psfly.h index 4a30cdace..45e095643 100644 --- a/source/player/psfly.h +++ b/source/player/psfly.h @@ -32,7 +32,7 @@ Structure defintions -------------------- */ -class CPlayerStateFall : public CPlayerState +class CPlayerStateFly : public CPlayerState { public: virtual void enter(class CPlayer *_player); diff --git a/source/player/pstates.cpp b/source/player/pstates.cpp index c35b0db1a..efb9659f9 100644 --- a/source/player/pstates.cpp +++ b/source/player/pstates.cpp @@ -210,6 +210,18 @@ DVECTOR CPlayerState::getPlayerPos(CPlayer *_player) } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CPlayerState::setPlayerPos(class CPlayer *_player,DVECTOR *_pos) +{ + return _player->setPlayerPos(_pos); +} + + /*---------------------------------------------------------------------- Function: Purpose: diff --git a/source/player/pstates.h b/source/player/pstates.h index f0a13ff2c..7e553a9b3 100644 --- a/source/player/pstates.h +++ b/source/player/pstates.h @@ -54,6 +54,7 @@ protected: DVECTOR getMoveVelocity(class CPlayer *_player); void setMoveVelocity(class CPlayer *_player,DVECTOR *_moveVel); DVECTOR getPlayerPos(class CPlayer *_player); + void setPlayerPos(class CPlayer *_player,DVECTOR *_pos); int getPadInputHeld(class CPlayer *_player); int getPadInputDown(class CPlayer *_player); diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index e12b08997..0a1995e0e 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -749,6 +749,14 @@ SOURCE=..\..\..\source\player\psfall.h # End Source File # Begin Source File +SOURCE=..\..\..\source\player\psfly.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\player\psfly.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\player\psidle.cpp # End Source File # Begin Source File