This commit is contained in:
parent
dc14c36d6c
commit
6e16891116
@ -281,6 +281,42 @@ void CBaseRespawningPickup::collect(class CPlayer *_player)
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CBaseWeaponPickup::init()
|
||||
{
|
||||
CBasePickup::init();
|
||||
|
||||
m_dontAutoPickUpUntilPlayerMovesOffMe=true;
|
||||
m_collidedWithPlayer=true;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
void CBaseWeaponPickup::think(int _frames)
|
||||
{
|
||||
CBasePickup::think(_frames);
|
||||
|
||||
if(!m_collidedWithPlayer)
|
||||
{
|
||||
m_dontAutoPickUpUntilPlayerMovesOffMe=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_collidedWithPlayer=false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
@ -292,9 +328,18 @@ void CBaseWeaponPickup::collidedWith(CThing *_thisThing)
|
||||
switch(_thisThing->getThingType())
|
||||
{
|
||||
case TYPE_PLAYER:
|
||||
if(((CPlayer*)_thisThing)->tryingToPickupWeapon())
|
||||
{
|
||||
collect((CPlayer*)_thisThing);
|
||||
CPlayer *player;
|
||||
player=(CPlayer*)_thisThing;
|
||||
if(player->tryingToManuallyPickupWeapon()||
|
||||
(!m_dontAutoPickUpUntilPlayerMovesOffMe&&player->tryingToAutomaticallyPickupWeapon()))
|
||||
{
|
||||
collect(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_collidedWithPlayer=true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -113,8 +113,14 @@ private:
|
||||
|
||||
class CBaseWeaponPickup : public CBasePickup
|
||||
{
|
||||
public:
|
||||
virtual void init();
|
||||
virtual void think(int _frames);
|
||||
|
||||
protected:
|
||||
virtual void collidedWith(CThing *_thisThing);
|
||||
int m_dontAutoPickUpUntilPlayerMovesOffMe;
|
||||
int m_collidedWithPlayer;
|
||||
|
||||
};
|
||||
|
||||
|
@ -81,6 +81,10 @@
|
||||
#include "game\game.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PICKUPS_PICKUP_H__
|
||||
#include "pickups\pickup.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
@ -675,9 +679,6 @@ void CPlayer::shutdown()
|
||||
static int oldmode=-1;
|
||||
int newmode=-1;
|
||||
|
||||
int scmax=160;
|
||||
int scspeed=5;
|
||||
|
||||
void CPlayer::think(int _frames)
|
||||
{
|
||||
int i;
|
||||
@ -741,31 +742,55 @@ if(newmode!=-1)
|
||||
}
|
||||
}
|
||||
|
||||
m_tryingToPickupWeapon=false;
|
||||
m_tryingToManuallyPickupWeapon=false;
|
||||
m_tryingToAutomaticallyPickupWeapon=false;
|
||||
for(i=0;i<_frames;i++)
|
||||
{
|
||||
// Think
|
||||
updatePadInput();
|
||||
if(!m_tryingToPickupWeapon)
|
||||
{
|
||||
|
||||
// Weapon collect/drop/swap stuff..
|
||||
if(m_currentMode==PLAYER_MODE_BASICUNARMED||
|
||||
m_currentMode==PLAYER_MODE_FULLUNARMED)
|
||||
{
|
||||
// Always trying to pickup weapon if unarmed... means that when SB walks
|
||||
// over an item whilst unarmed, he automatically picks it up
|
||||
m_tryingToPickupWeapon=true;
|
||||
m_tryingToAutomaticallyPickupWeapon=true;
|
||||
}
|
||||
else if(getPadInputDown()&PI_WEAPONCHANGE)
|
||||
if(getPadInputDown()&PI_WEAPONCHANGE)
|
||||
{
|
||||
if(!m_tryingToPickupWeapon&&
|
||||
m_currentMode!=PLAYER_MODE_BASICUNARMED&&
|
||||
// Trying to pick up a weapon
|
||||
m_tryingToManuallyPickupWeapon=true;
|
||||
|
||||
// If already armed then drop current weapon
|
||||
if(m_currentMode!=PLAYER_MODE_BASICUNARMED&&
|
||||
m_currentMode!=PLAYER_MODE_FULLUNARMED&&
|
||||
m_currentMode!=PLAYER_MODE_DEAD)
|
||||
{
|
||||
// Drop current weapon
|
||||
setMode(PLAYER_MODE_FULLUNARMED);
|
||||
static const int s_pickupsToDrop[NUM_PLAYERMODES]=
|
||||
{
|
||||
-1, // PLAYER_MODE_BASICUNARMED,
|
||||
-1, // PLAYER_MODE_FULLUNARMED,
|
||||
-1, // PLAYER_MODE_BALLOON,
|
||||
PICKUP__BUBBLE_WAND, // PLAYER_MODE_BUBBLE_MIXTURE,
|
||||
PICKUP__NET, // PLAYER_MODE_NET,
|
||||
PICKUP__CORAL_BLOWER, // PLAYER_MODE_CORALBLOWER,
|
||||
PICKUP__JELLY_LAUNCHER, // PLAYER_MODE_JELLY_LAUNCHER,
|
||||
-1, // PLAYER_MODE_DEAD,
|
||||
-1, // PLAYER_MODE_FLY,
|
||||
};
|
||||
|
||||
int pickupToDrop;
|
||||
pickupToDrop=s_pickupsToDrop[m_currentMode];
|
||||
if(pickupToDrop!=-1)
|
||||
{
|
||||
DVECTOR pickupPos;
|
||||
CBasePickup *pickup;
|
||||
pickupPos.vx=Pos.vx;
|
||||
pickupPos.vy=Pos.vy-30;
|
||||
pickup=createPickup((PICKUP_TYPE)pickupToDrop,&pickupPos);
|
||||
pickup->setPos(&pickupPos);
|
||||
}
|
||||
m_tryingToPickupWeapon=true;
|
||||
setMode(PLAYER_MODE_FULLUNARMED);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1651,6 +1676,8 @@ void CPlayer::respawn()
|
||||
m_ledgeLookAhead=m_lastLedgeLookAhead=0;
|
||||
m_ledgeLookOffset=0;
|
||||
m_ledgeLookTimer=0;
|
||||
m_tryingToManuallyPickupWeapon=false;
|
||||
m_tryingToAutomaticallyPickupWeapon=false;
|
||||
|
||||
m_squeakyBootsTimer=0;
|
||||
m_invincibilityRingTimer=0;
|
||||
@ -1828,7 +1855,7 @@ void CPlayer::inSoakUpState()
|
||||
_thing must point to the thing that caused the damage
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
#if defined(__USER_daveo__)
|
||||
#if defined(__USER_daveo__) || defined(__USER_paul__)
|
||||
int invincibleSponge=true; // NB: This is for debugging purposes only so don't try and use it for a permenant cheat mode..
|
||||
#else
|
||||
int invincibleSponge=false; // NB: This is for debugging purposes only so don't try and use it for a permenant cheat mode..
|
||||
|
@ -260,7 +260,8 @@ public:
|
||||
void setPlayerPos(DVECTOR *_pos) {Pos=*_pos;}
|
||||
PLAYERINPUT getPadInputHeld() {return m_padInput;}
|
||||
PLAYERINPUT getPadInputDown() {return m_padInputDown;}
|
||||
int tryingToPickupWeapon() {return m_tryingToPickupWeapon;}
|
||||
int tryingToManuallyPickupWeapon() {return m_tryingToManuallyPickupWeapon;}
|
||||
int tryingToAutomaticallyPickupWeapon() {return m_tryingToAutomaticallyPickupWeapon;}
|
||||
|
||||
void inSoakUpState();
|
||||
void takeDamage(DAMAGE_TYPE _damage,REACT_DIRECTION _reactDirection=REACT__UP,CThing *_thing=NULL);
|
||||
@ -338,7 +339,8 @@ private:
|
||||
PLAYERINPUT m_padInput; // Controls that are being held down
|
||||
PLAYERINPUT m_lastPadInput; // Last frames controls
|
||||
PLAYERINPUT m_padInputDown; // Controls that were pressed this frame
|
||||
int m_tryingToPickupWeapon;
|
||||
int m_tryingToManuallyPickupWeapon;
|
||||
int m_tryingToAutomaticallyPickupWeapon;
|
||||
|
||||
|
||||
// Various info about the current map
|
||||
|
Loading…
Reference in New Issue
Block a user