2005-02-13 03:40:37 +00:00
/* PlayerState - Holds per-player game state. */
2004-12-20 06:25:59 +00:00
#ifndef PlayerState_H
#define PlayerState_H
2006-11-29 14:57:21 +00:00
#include "Attack.h"
#include "ModsGroup.h"
2004-12-20 06:25:59 +00:00
#include "PlayerNumber.h"
#include "PlayerOptions.h"
2006-05-22 20:06:33 +00:00
#include "RageTimer.h"
2007-01-16 00:20:14 +00:00
#include "SampleHistory.h"
2005-08-30 01:58:54 +00:00
struct lua_State ;
2004-12-20 06:25:59 +00:00
2005-08-23 20:49:30 +00:00
class PlayerState
2004-12-20 06:25:59 +00:00
{
2005-08-23 20:49:30 +00:00
public :
2006-01-13 05:02:44 +00:00
PlayerState ();
void Reset ();
2005-04-07 18:32:19 +00:00
void Update ( float fDelta );
2004-12-20 10:47:41 +00:00
2004-12-20 06:25:59 +00:00
// TODO: Remove use of PlayerNumber. All data about the player should live
// in PlayerState and callers should not use PlayerNumber to index into
// GameState.
2006-07-10 00:24:13 +00:00
PlayerNumber m_PlayerNumber ;
MultiPlayer m_mp ;
2004-12-20 06:25:59 +00:00
2007-04-06 15:44:39 +00:00
void ResetToDefaultPlayerOptions ( ModsLevel l );
2006-08-05 02:38:05 +00:00
ModsGroup < PlayerOptions > m_PlayerOptions ;
2004-12-20 06:25:59 +00:00
//
// Used in Gameplay
//
2006-07-10 00:24:13 +00:00
mutable float m_fLastDrawnBeat ; // Set by NoteField. Used to push note-changing modifers back so that notes doesn't pop.
2004-12-20 06:25:59 +00:00
2006-07-10 00:24:13 +00:00
HealthState m_HealthState ;
2004-12-20 06:25:59 +00:00
2007-01-17 12:02:56 +00:00
float m_fLastStrumMusicSeconds ; // Set to the MusicSeconds of when the a strum button was pressed. If -1, the strum window has passed.
2006-12-01 05:37:33 +00:00
float m_fLastHopoNoteMusicSeconds ; // Set to the MusicSeconds of the last note successfully strummed or hammered in a hopochain, -1, then there is no current hopo chain
int m_iLastHopoNoteCol ; // if -1, then there is no current hopo chain
void ClearHopoState ()
{
m_fLastHopoNoteMusicSeconds = - 1 ;
m_iLastHopoNoteCol = - 1 ;
}
2006-11-30 12:29:01 +00:00
2004-12-20 06:25:59 +00:00
PlayerController m_PlayerController ;
2007-01-16 00:20:14 +00:00
SampleHistory m_EffectHistory ;
2004-12-20 06:25:59 +00:00
//
// Used in Battle and Rave
//
2006-01-13 05:14:42 +00:00
void LaunchAttack ( const Attack & a );
void RemoveActiveAttacks ( AttackLevel al = NUM_ATTACK_LEVELS /*all*/ );
void EndActiveAttacks ();
2005-07-07 21:29:35 +00:00
void RebuildPlayerOptionsFromActiveAttacks ();
2005-07-07 21:24:59 +00:00
int GetSumOfActiveAttackLevels () const ;
2006-07-10 00:24:13 +00:00
int m_iCpuSkill ; // only used when m_PlayerController is PC_CPU
2004-12-20 06:25:59 +00:00
// Attacks take a while to transition out of use. Account for this in PlayerAI
// by still penalizing it for 1 second after the player options are rebuilt.
2006-07-10 00:24:13 +00:00
int m_iLastPositiveSumOfAttackLevels ;
float m_fSecondsUntilAttacksPhasedOut ; // positive means PlayerAI is still affected
bool m_bAttackBeganThisUpdate ; // flag for other objects to watch (play sounds)
bool m_bAttackEndedThisUpdate ; // flag for other objects to watch (play sounds)
2006-11-30 12:29:01 +00:00
2006-07-10 00:24:13 +00:00
AttackArray m_ActiveAttacks ;
vector < Attack > m_ModsToApply ;
2004-12-20 06:25:59 +00:00
//
// Used in Rave
//
2006-07-10 00:24:13 +00:00
float m_fSuperMeter ; // between 0 and NUM_ATTACK_LEVELS
float m_fSuperMeterGrowthScale ;
2004-12-20 06:25:59 +00:00
//
// Used in Battle
//
2006-01-13 05:14:42 +00:00
void RemoveAllInventory ();
2006-07-10 00:24:13 +00:00
Attack m_Inventory [ NUM_INVENTORY_SLOTS ];
2005-08-30 01:58:54 +00:00
// Lua
void PushSelf ( lua_State * L );
2004-12-20 06:25:59 +00:00
};
#endif
/*
* (c) 2001-2004 Chris Danford, Chris Gomez
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/