From 719f92e773f4577698aae68757df65cdd0c643ef Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 26 Nov 2003 08:25:45 +0000 Subject: [PATCH] add AttackDisplay --- stepmania/Themes/default/metrics.ini | 5 ++ stepmania/src/AttackDisplay.cpp | 39 +++++++++++++ stepmania/src/AttackDisplay.h | 36 ++++++++++++ stepmania/src/Combo.h | 1 - stepmania/src/NoteFieldPositioning.h | 2 +- stepmania/src/Player.cpp | 10 ++++ stepmania/src/Player.h | 3 + stepmania/src/ScoreKeeperRave.cpp | 2 +- stepmania/src/StepMania.dsp | 83 ++++++++++++++++++---------- 9 files changed, 150 insertions(+), 31 deletions(-) create mode 100644 stepmania/src/AttackDisplay.cpp create mode 100644 stepmania/src/AttackDisplay.h diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 695cdd2761..e168f51f7e 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -1968,6 +1968,11 @@ ComboXOffsetOneSideP2=0 ComboXOffsetBothSides=0 ComboY=270 ComboYReverse=210 +AttackDisplayXOffsetOneSideP1=0 +AttackDisplayXOffsetOneSideP2=0 +AttackDisplayXOffsetBothSides=0 +AttackDisplayY=190 +AttackDisplayYReverse=290 HoldJudgmentYStandard=150 HoldJudgmentYReverse=330 BrightGhostComboThreshold=100 diff --git a/stepmania/src/AttackDisplay.cpp b/stepmania/src/AttackDisplay.cpp new file mode 100644 index 0000000000..090f333a95 --- /dev/null +++ b/stepmania/src/AttackDisplay.cpp @@ -0,0 +1,39 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: AttackDisplay + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "AttackDisplay.h" +#include "ThemeManager.h" +#include "GameState.h" + + +AttackDisplay::AttackDisplay() +{ + m_textAttack.LoadFromFont( THEME->GetPathToF("AttackDisplay") ); + m_textAttack.SetDiffuseAlpha( 0 ); // invisible + this->AddChild( &m_textAttack ); +} + +void AttackDisplay::Update( float fDelta ) +{ + ActorFrame::Update( fDelta ); + + // FIXME: Make GAMESTATE->m_ActiveAttacks a vector + if( !GAMESTATE->m_ActiveAttacks[m_PlayerNumber][0].IsBlank() ) + { + m_textAttack.SetDiffuseAlpha( 1 ); + m_textAttack.SetText( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][0].sModifier ); + } + else + { + m_textAttack.SetDiffuseAlpha( 0 ); + } +} \ No newline at end of file diff --git a/stepmania/src/AttackDisplay.h b/stepmania/src/AttackDisplay.h new file mode 100644 index 0000000000..2fb55181b1 --- /dev/null +++ b/stepmania/src/AttackDisplay.h @@ -0,0 +1,36 @@ +#ifndef AttackDisplay_H +#define AttackDisplay_H +/* +----------------------------------------------------------------------------- + Class: AttackDisplay + + Desc: + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ActorFrame.h" +#include "Sprite.h" +#include "BitmapText.h" +#include "PlayerNumber.h" +#include "GameConstantsAndTypes.h" // for TapNoteScore + + +class AttackDisplay : public ActorFrame +{ +public: + AttackDisplay(); + + void Init( PlayerNumber pn ) { m_PlayerNumber = pn; } + + virtual void Update( float fDelta ); + +protected: + PlayerNumber m_PlayerNumber; + + BitmapText m_textAttack; +}; + +#endif diff --git a/stepmania/src/Combo.h b/stepmania/src/Combo.h index 9f709cd491..dda2a438ab 100644 --- a/stepmania/src/Combo.h +++ b/stepmania/src/Combo.h @@ -16,7 +16,6 @@ #include "BitmapText.h" #include "PlayerNumber.h" #include "GameConstantsAndTypes.h" // for TapNoteScore -class Inventory; class Combo : public ActorFrame diff --git a/stepmania/src/NoteFieldPositioning.h b/stepmania/src/NoteFieldPositioning.h index 94ca98b8a5..f74e77c781 100644 --- a/stepmania/src/NoteFieldPositioning.h +++ b/stepmania/src/NoteFieldPositioning.h @@ -44,7 +44,7 @@ struct NoteFieldMode float m_fFirstPixelToDrawScale, m_fLastPixelToDrawScale; CString m_Backdrop; - CString m_JudgmentCmd, m_ComboCmd; + CString m_JudgmentCmd, m_ComboCmd, m_AttackDisplayCmd; CString m_HoldJudgmentCmd[MAX_NOTE_TRACKS]; }; diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index cdabfaf7aa..807acb2171 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -43,6 +43,9 @@ CachedThemeMetricF GRAY_ARROWS_Y_REVERSE ("Player","GrayArrowsYReverse"); #define COMBO_X( p, both_sides ) THEME->GetMetricF("Player",both_sides ? "ComboXOffsetBothSides" : ssprintf("ComboXOffsetOneSideP%d",p+1)) #define COMBO_Y THEME->GetMetricF("Player","ComboY") #define COMBO_Y_REVERSE THEME->GetMetricF("Player","ComboYReverse") +#define ATTACK_DISPLAY_X( p, both_sides ) THEME->GetMetricF("Player",both_sides ? "AttackDisplayXOffsetBothSides" : ssprintf("AttackDisplayXOffsetOneSideP%d",p+1)) +#define ATTACK_DISPLAY_Y THEME->GetMetricF("Player","AttackDisplayY") +#define ATTACK_DISPLAY_Y_REVERSE THEME->GetMetricF("Player","AttackDisplayYReverse") CachedThemeMetricF HOLD_JUDGMENT_Y_STANDARD ("Player","HoldJudgmentYStandard"); CachedThemeMetricF HOLD_JUDGMENT_Y_REVERSE ("Player","HoldJudgmentYReverse"); CachedThemeMetricI BRIGHT_GHOST_COMBO_THRESHOLD("Player","BrightGhostComboThreshold"); @@ -85,6 +88,7 @@ PlayerMinus::PlayerMinus() this->AddChild( &m_Judgment ); this->AddChild( &m_ProTimingDisplay ); this->AddChild( &m_Combo ); + this->AddChild( &m_AttackDisplay ); for( int c=0; cAddChild( &m_HoldJudgment[c] ); @@ -134,6 +138,7 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p m_Judgment.StopTweening(); // m_Combo.Reset(); // don't reset combos between songs in a course! m_Combo.Init( pn ); + m_AttackDisplay.Init( pn ); m_Judgment.Reset(); /* Don't re-init this; that'll reload graphics. Add a separate Reset() call @@ -192,6 +197,8 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyleDef()->m_StyleType==StyleDef::ONE_PLAYER_TWO_CREDITS; m_Combo.SetX( COMBO_X(m_PlayerNumber,bPlayerUsingBothSides) ); m_Combo.SetY( bReverse ? COMBO_Y_REVERSE : COMBO_Y ); + m_AttackDisplay.SetX( ATTACK_DISPLAY_X(m_PlayerNumber,bPlayerUsingBothSides) ); + m_AttackDisplay.SetY( bReverse ? ATTACK_DISPLAY_Y_REVERSE : ATTACK_DISPLAY_Y ); m_Judgment.SetX( JUDGMENT_X(m_PlayerNumber,bPlayerUsingBothSides) ); m_Judgment.SetY( bReverse ? JUDGMENT_Y_REVERSE : JUDGMENT_Y ); m_ProTimingDisplay.SetX( JUDGMENT_X(m_PlayerNumber,bPlayerUsingBothSides) ); @@ -201,6 +208,7 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p m_Judgment.Command( g_NoteFieldMode[pn].m_JudgmentCmd ); m_ProTimingDisplay.Command( g_NoteFieldMode[pn].m_JudgmentCmd ); m_Combo.Command( g_NoteFieldMode[pn].m_ComboCmd ); + m_AttackDisplay.Command( g_NoteFieldMode[pn].m_AttackDisplayCmd ); int c; for( c=0; cm_iColsPerPlayer; c++ ) @@ -434,6 +442,8 @@ void PlayerMinus::DrawPrimitives() if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fBlind == 0 ) m_Combo.Draw(); + m_AttackDisplay.Draw(); + if( TAP_JUDGMENTS_UNDER_FIELD ) DrawTapJudgments(); diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index 225970abe9..4fcf980438 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -28,6 +28,7 @@ #include "ProTimingDisplay.h" #include "RageSound.h" #include "DancingCharacters.h" +#include "AttackDisplay.h" class ScoreDisplay; class LifeMeter; @@ -83,6 +84,8 @@ protected: Combo m_Combo; + AttackDisplay m_AttackDisplay; + int m_iDCState; // DancingCharacters* m_pDancingCharacters; // used to adjust the 2D anims dancing states LifeMeter* m_pLifeMeter; diff --git a/stepmania/src/ScoreKeeperRave.cpp b/stepmania/src/ScoreKeeperRave.cpp index caa2c3281f..1e01ed2850 100644 --- a/stepmania/src/ScoreKeeperRave.cpp +++ b/stepmania/src/ScoreKeeperRave.cpp @@ -102,7 +102,7 @@ void ScoreKeeperRave::LaunchAttack( AttackLevel al ) // apply new attack GAMESTATE->LaunchAttack( pnToAttack, a ); - SCREENMAN->SystemMessage( ssprintf( "attacking %d with %s", pnToAttack, sAttackToGive.c_str() ) ); +// SCREENMAN->SystemMessage( ssprintf( "attacking %d with %s", pnToAttack, sAttackToGive.c_str() ) ); m_soundLaunchAttack.Play(); } diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 584626f090..8df18368ac 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# Microsoft Developer Studio Generated Build File, Format Version 60000 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Application" 0x0101 @@ -62,10 +62,10 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib # Begin Special Build Tool IntDir=.\../Debug6 -TargetDir=\projects\stepmania\stepmania +TargetDir=\stepmania\stepmania TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -98,8 +98,12 @@ XBCP=xbecopy.exe # ADD BASE XBCP /NOLOGO # ADD XBCP /NOLOGO # Begin Special Build Tool -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ - /Fo$(IntDir)\ +IntDir=.\Debug +TargetDir=\stepmania\stepmania +TargetName=default +SOURCE="$(InputPath)" +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ + /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -136,10 +140,10 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /pdb:none # Begin Special Build Tool IntDir=.\../Release6 -TargetDir=\projects\stepmania\stepmania +TargetDir=\stepmania\stepmania TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -176,8 +180,12 @@ XBCP=xbecopy.exe # ADD BASE XBCP /NOLOGO # ADD XBCP /NOLOGO # Begin Special Build Tool -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ - /Fo$(IntDir)\ +IntDir=.\StepMania___Xbox_Release +TargetDir=\stepmania\stepmania +TargetName=default +SOURCE="$(InputPath)" +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ + /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -2300,6 +2308,25 @@ SOURCE=.\arch\Lights\LightsDriver_Null.h # End Source File # Begin Source File +SOURCE=.\arch\Lights\LightsDriver_SystemMessage.cpp + +!IF "$(CFG)" == "StepMania - Win32 Debug" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" + +!ELSEIF "$(CFG)" == "StepMania - Win32 Release" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Release" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\arch\Lights\LightsDriver_SystemMessage.h +# End Source File +# Begin Source File + SOURCE=.\arch\Lights\LightsDriver_Win32Parallel.cpp !IF "$(CFG)" == "StepMania - Win32 Debug" @@ -2934,6 +2961,25 @@ SOURCE=.\ArrowEffects.h # End Source File # Begin Source File +SOURCE=.\AttackDisplay.cpp + +!IF "$(CFG)" == "StepMania - Win32 Debug" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" + +!ELSEIF "$(CFG)" == "StepMania - Win32 Release" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Release" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\AttackDisplay.h +# End Source File +# Begin Source File + SOURCE=.\Background.cpp !IF "$(CFG)" == "StepMania - Win32 Debug" @@ -5558,25 +5604,6 @@ SOURCE=.\error2.bmp # End Source File # Begin Source File -SOURCE=.\arch\Lights\LightsDriver_SystemMessage.cpp - -!IF "$(CFG)" == "StepMania - Win32 Debug" - -!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" - -!ELSEIF "$(CFG)" == "StepMania - Win32 Release" - -!ELSEIF "$(CFG)" == "StepMania - Xbox Release" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\arch\Lights\LightsDriver_SystemMessage.h -# End Source File -# Begin Source File - SOURCE=.\loading.bmp # End Source File # Begin Source File