-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kill attacks, battle mode, and rave mode, and many things exclusive t…
…o them (combinedlifemeter)
- Loading branch information
1 parent
5682c18
commit 89bf1c8
Showing
61 changed files
with
32 additions
and
3,336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +0,0 @@ | ||
#include "global.h" | ||
#include "ActiveAttackList.h" | ||
#include "RageUtil.h" | ||
#include "GameState.h" | ||
#include "Inventory.h" | ||
#include "RageTimer.h" | ||
#include "PlayerOptions.h" | ||
#include "PlayerState.h" | ||
|
||
ActiveAttackList::ActiveAttackList() | ||
{ | ||
} | ||
|
||
void ActiveAttackList::Init( const PlayerState* pPlayerState ) | ||
{ | ||
m_pPlayerState = pPlayerState; | ||
} | ||
|
||
void ActiveAttackList::Update( float fDelta ) | ||
{ | ||
bool bTimeToRefresh = | ||
IsFirstUpdate() || // check this before running Actor::Update() | ||
m_pPlayerState->m_bAttackBeganThisUpdate || | ||
m_pPlayerState->m_bAttackEndedThisUpdate; | ||
|
||
BitmapText::Update( fDelta ); | ||
|
||
if( bTimeToRefresh ) | ||
Refresh(); | ||
} | ||
|
||
void ActiveAttackList::Refresh() | ||
{ | ||
const AttackArray& attacks = m_pPlayerState->m_ActiveAttacks; | ||
|
||
vector<RString> vsThemedMods; | ||
for( unsigned i=0; i<attacks.size(); i++ ) | ||
{ | ||
const Attack& attack = attacks[i]; | ||
|
||
if( !attack.bOn ) | ||
continue; // hasn't started yet | ||
if( !attack.bShowInAttackList ) | ||
continue; | ||
|
||
PlayerOptions po; | ||
po.FromString( attack.sModifiers ); | ||
po.GetLocalizedMods( vsThemedMods ); | ||
} | ||
|
||
RString s = join( "\n", vsThemedMods ); | ||
|
||
this->SetText( s ); // BitmapText will not rebuild vertices if these strings are the same. | ||
} | ||
|
||
/* | ||
* (c) 2004 Chris Danford | ||
* 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. | ||
*/ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +0,0 @@ | ||
#ifndef ACTIVE_ATTACK_LIST_H | ||
#define ACTIVE_ATTACK_LIST_H | ||
|
||
#include "BitmapText.h" | ||
class PlayerState; | ||
|
||
/** @brief Shows currently active Player modifiers during gameplay. */ | ||
class ActiveAttackList : public BitmapText | ||
{ | ||
public: | ||
/** @brief The constructor that does nothing. */ | ||
ActiveAttackList(); | ||
/** | ||
* @brief Set up the PlayerState. | ||
* @param pPlayerState the PlayerState involved with the attacks. */ | ||
void Init( const PlayerState* pPlayerState ); | ||
/** | ||
* @brief Look into updating the list. | ||
* @param fDelta the present time. */ | ||
virtual void Update( float fDelta ); | ||
/** @brief Refresh the list of attacks. */ | ||
void Refresh(); | ||
|
||
protected: | ||
/** @brief the PlayerState of the Player who is dealing with the attack list. */ | ||
const PlayerState* m_pPlayerState; | ||
}; | ||
|
||
#endif | ||
|
||
/** | ||
* @file | ||
* @author Chris Danford (c) 2004 | ||
* @section LICENSE | ||
* 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. | ||
*/ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,146 +0,0 @@ | ||
#include "global.h" | ||
#include "Attack.h" | ||
#include "GameState.h" | ||
#include "RageUtil.h" | ||
#include "Song.h" | ||
#include "Foreach.h" | ||
#include "PlayerOptions.h" | ||
#include "PlayerState.h" | ||
|
||
void Attack::GetAttackBeats( const Song *pSong, float &fStartBeat, float &fEndBeat ) const | ||
{ | ||
ASSERT( pSong != NULL ); | ||
ASSERT_M( fStartSecond >= 0, ssprintf("StartSecond: %f",fStartSecond) ); | ||
|
||
const TimingData &timing = pSong->m_SongTiming; | ||
fStartBeat = timing.GetBeatFromElapsedTime( fStartSecond ); | ||
fEndBeat = timing.GetBeatFromElapsedTime( fStartSecond+fSecsRemaining ); | ||
} | ||
|
||
/* Get the range for an attack that's being applied in realtime, eg. during battle | ||
* mode. We need a PlayerState for this, so we can push the region off-screen to | ||
* prevent popping when the attack has note modifers. */ | ||
void Attack::GetRealtimeAttackBeats( const Song *pSong, const PlayerState* pPlayerState, float &fStartBeat, float &fEndBeat ) const | ||
{ | ||
ASSERT( pSong != NULL ); | ||
|
||
if( fStartSecond >= 0 ) | ||
{ | ||
GetAttackBeats( pSong, fStartBeat, fEndBeat ); | ||
return; | ||
} | ||
|
||
ASSERT( pPlayerState != NULL ); | ||
|
||
/* If reasonable, push the attack forward 8 beats so that notes on screen don't change suddenly. */ | ||
fStartBeat = min( GAMESTATE->m_Position.m_fSongBeat+8, pPlayerState->m_fLastDrawnBeat ); | ||
fStartBeat = truncf(fStartBeat)+1; | ||
|
||
const TimingData &timing = pSong->m_SongTiming; | ||
const float lStartSecond = timing.WhereUAtBro( fStartBeat ); | ||
const float fEndSecond = lStartSecond + fSecsRemaining; | ||
fEndBeat = timing.GetBeatFromElapsedTime( fEndSecond ); | ||
fEndBeat = truncf(fEndBeat)+1; | ||
|
||
// loading the course should have caught this. | ||
ASSERT_M( fEndBeat >= fStartBeat, ssprintf("EndBeat %f >= StartBeat %f", fEndBeat, fStartBeat) ); | ||
} | ||
|
||
bool Attack::operator== ( const Attack &rhs ) const | ||
{ | ||
#define EQUAL(a) (a==rhs.a) | ||
return | ||
EQUAL(level) && | ||
EQUAL(fStartSecond) && | ||
EQUAL(fSecsRemaining) && | ||
EQUAL(sModifiers) && | ||
EQUAL(bOn) && | ||
EQUAL(bGlobal); | ||
} | ||
|
||
bool Attack::ContainsTransformOrTurn() const | ||
{ | ||
PlayerOptions po; | ||
po.FromString( sModifiers ); | ||
return po.ContainsTransformOrTurn(); | ||
} | ||
|
||
Attack Attack::FromGlobalCourseModifier( const RString &sModifiers ) | ||
{ | ||
Attack a; | ||
a.fStartSecond = 0; | ||
a.fSecsRemaining = 10000; /* whole song */ | ||
a.level = ATTACK_LEVEL_1; | ||
a.sModifiers = sModifiers; | ||
a.bGlobal = true; | ||
return a; | ||
} | ||
|
||
RString Attack::GetTextDescription() const | ||
{ | ||
RString s = sModifiers + " " + ssprintf("(%.2f seconds)", fSecsRemaining); | ||
return s; | ||
} | ||
|
||
int Attack::GetNumAttacks() const | ||
{ | ||
vector<RString> tmp; | ||
split(this->sModifiers, ",", tmp); | ||
return tmp.size(); | ||
} | ||
|
||
bool AttackArray::ContainsTransformOrTurn() const | ||
{ | ||
FOREACH_CONST( Attack, *this, a ) | ||
{ | ||
if( a->ContainsTransformOrTurn() ) | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
vector<RString> AttackArray::ToVectorString() const | ||
{ | ||
vector<RString> ret; | ||
FOREACH_CONST( Attack, *this, a ) | ||
{ | ||
ret.push_back(ssprintf("TIME=%f:LEN=%f:MODS=%s", | ||
a->fStartSecond, | ||
a->fSecsRemaining, | ||
a->sModifiers.c_str())); | ||
} | ||
return ret; | ||
} | ||
|
||
void AttackArray::UpdateStartTimes(float delta) | ||
{ | ||
FOREACH(Attack, *this, a) | ||
{ | ||
a->fStartSecond += delta; | ||
} | ||
} | ||
|
||
/* | ||
* (c) 2003-2004 Chris Danford | ||
* 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. | ||
*/ | ||
Oops, something went wrong.