00001 /* PlayerNumber */ 00002 00003 #ifndef PlayerState_H 00004 #define PlayerState_H 00005 00006 #include "PlayerNumber.h" 00007 #include "PlayerOptions.h" 00008 #include <map> 00009 #include "Attack.h" 00010 00011 struct PlayerState 00012 { 00013 PlayerState() 00014 { 00015 m_PlayerNumber = PLAYER_INVALID; 00016 Reset(); 00017 } 00018 void Reset() 00019 { 00020 m_CurrentPlayerOptions.Init(); 00021 m_PlayerOptions.Init(); 00022 m_StoredPlayerOptions.Init(); 00023 00024 m_BeatToNoteSkin.clear(); 00025 m_fLastDrawnBeat = -100; 00026 00027 m_HealthState = ALIVE; 00028 00029 m_PlayerController = PC_HUMAN; 00030 00031 m_iCpuSkill = 5; 00032 00033 m_iLastPositiveSumOfAttackLevels = 0; 00034 m_fSecondsUntilAttacksPhasedOut = 0; 00035 m_bAttackBeganThisUpdate = false; 00036 m_bAttackEndedThisUpdate = false; 00037 m_ActiveAttacks.clear(); 00038 m_ModsToApply.clear(); 00039 00040 m_fSuperMeter = 0; // between 0 and NUM_ATTACK_LEVELS 00041 m_fSuperMeterGrowthScale = 1; 00042 00043 for( int i=0; i<NUM_INVENTORY_SLOTS; i++ ) 00044 m_Inventory[i].MakeBlank(); 00045 } 00046 00047 00048 // TODO: Remove use of PlayerNumber. All data about the player should live 00049 // in PlayerState and callers should not use PlayerNumber to index into 00050 // GameState. 00051 PlayerNumber m_PlayerNumber; 00052 00053 00054 PlayerOptions m_CurrentPlayerOptions; // current approaches destination 00055 PlayerOptions m_PlayerOptions; // change this, and current will move gradually toward it 00056 PlayerOptions m_StoredPlayerOptions; // user's choices on the PlayerOptions screen 00057 00058 // 00059 // Used in Gameplay 00060 // 00061 map<float,CString> m_BeatToNoteSkin; 00062 mutable float m_fLastDrawnBeat; // Set by NoteField. Used to push NoteSkin-changing modifers back so that the NoteSkin doesn't pop. 00063 00064 enum HealthState { HOT, ALIVE, DANGER, DEAD }; 00065 HealthState m_HealthState; 00066 00067 PlayerController m_PlayerController; 00068 00069 // 00070 // Used in Battle and Rave 00071 // 00072 int m_iCpuSkill; // only used when m_PlayerController is PC_CPU 00073 // Attacks take a while to transition out of use. Account for this in PlayerAI 00074 // by still penalizing it for 1 second after the player options are rebuilt. 00075 int m_iLastPositiveSumOfAttackLevels; 00076 float m_fSecondsUntilAttacksPhasedOut; // positive means PlayerAI is still affected 00077 bool m_bAttackBeganThisUpdate; // flag for other objects to watch (play sounds) 00078 bool m_bAttackEndedThisUpdate; // flag for other objects to watch (play sounds) 00079 AttackArray m_ActiveAttacks; 00080 vector<Attack> m_ModsToApply; 00081 00082 // 00083 // Used in Rave 00084 // 00085 float m_fSuperMeter; // between 0 and NUM_ATTACK_LEVELS 00086 float m_fSuperMeterGrowthScale; 00087 00088 // 00089 // Used in Battle 00090 // 00091 Attack m_Inventory[NUM_INVENTORY_SLOTS]; 00092 }; 00093 00094 #endif 00095 00096 /* 00097 * (c) 2001-2004 Chris Danford, Chris Gomez 00098 * All rights reserved. 00099 * 00100 * Permission is hereby granted, free of charge, to any person obtaining a 00101 * copy of this software and associated documentation files (the 00102 * "Software"), to deal in the Software without restriction, including 00103 * without limitation the rights to use, copy, modify, merge, publish, 00104 * distribute, and/or sell copies of the Software, and to permit persons to 00105 * whom the Software is furnished to do so, provided that the above 00106 * copyright notice(s) and this permission notice appear in all copies of 00107 * the Software and that both the above copyright notice(s) and this 00108 * permission notice appear in supporting documentation. 00109 * 00110 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00111 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00112 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00113 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00114 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00115 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00116 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00117 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00118 * PERFORMANCE OF THIS SOFTWARE. 00119 */