Files
itgmania212121/stepmania/src/ArrowEffects.cpp
T

125 lines
3.5 KiB
C++
Raw Normal View History

2002-02-24 10:31:20 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: ArrowEffects.cpp
Desc: Functions that return properties of arrows based on StyleDef and PlayerOptions
2002-02-24 10:31:20 +00:00
2002-05-19 01:59:48 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
2002-02-24 10:31:20 +00:00
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ArrowEffects.h"
2002-05-19 01:59:48 +00:00
#include "Notes.h"
2002-04-28 20:42:32 +00:00
#include "ColorNote.h"
2002-05-01 19:14:55 +00:00
#include "GameConstantsAndTypes.h"
2002-04-16 17:31:00 +00:00
#include "GameManager.h"
2002-07-23 01:41:40 +00:00
#include "GameState.h"
2002-02-24 10:31:20 +00:00
float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBeat )
{
2002-05-19 01:59:48 +00:00
float fBeatsUntilStep = NoteRowToBeat( fStepIndex ) - fSongBeat;
2002-02-24 10:31:20 +00:00
float fYOffset = fBeatsUntilStep * ARROW_GAP;
switch( po.m_EffectType )
{
case PlayerOptions::EFFECT_BOOST:
fYOffset *= 1.4f / ((fYOffset+SCREEN_HEIGHT/1.6f)/SCREEN_HEIGHT);
break;
case PlayerOptions::EFFECT_WAVE:
fYOffset += 15.0f*sinf( fYOffset/38.0f );
break;
}
return fYOffset;
}
2002-04-16 17:31:00 +00:00
float ArrowGetXPos( const PlayerOptions& po, int iColNum, float fYOffset, float fSongBeat )
2002-02-24 10:31:20 +00:00
{
2002-07-23 01:41:40 +00:00
float fPixelOffsetFromCenter = GAMESTATE->GetCurrentStyleDef()->m_ColumnInfo[PLAYER_1][iColNum].fXOffset;
2002-02-24 10:31:20 +00:00
// BUG OR FEATURE??? THIS IS WHERE THE REAL COLUMN PLACEMENT HAPPENS!!!
// GAMEMANAGER SITS AROUND ON ITS ASS DOING NOTHING
//
// As I know very little about this system, and as this is the only place I can think of that I
// can possibly change my arrow placements, Ez2dancer column setups will be here until
// somebody makes some other system. In the meantime, if it works, i'm using it.
2002-07-23 01:41:40 +00:00
// Chris:
// It's working now, so I'm commenting out your placement code below.
/*
if ( GAMESTATE->m_CurGame == GAME_EZ2 )
{
fPixelOffsetFromCenter = fColOffsetFromCenter * ARROW_SIZE / 1.3f;
2002-07-23 01:41:40 +00:00
if ( GAEMSTATE->m_CurStyle == STYLE_EZ2_REAL || GAEMSTATE->m_CurStyle == STYLE_EZ2_REAL_VERSUS ) // real gets MEGA squashed
{
2002-07-15 23:53:13 +00:00
fPixelOffsetFromCenter = fColOffsetFromCenter * ARROW_SIZE / 1.6f;
}
2002-07-23 01:41:40 +00:00
else if ( GAEMSTATE->m_CurStyle == STYLE_EZ2_DOUBLE && GAEMSTATE->m_sMasterPlayerNumber == PLAYER_1)
{
fPixelOffsetFromCenter = (fColOffsetFromCenter + 2.9f) * ARROW_SIZE / 1.3f;
}
2002-07-23 01:41:40 +00:00
else if ( GAEMSTATE->m_CurStyle == STYLE_EZ2_DOUBLE && GAEMSTATE->m_sMasterPlayerNumber == PLAYER_2)
2002-07-15 23:53:13 +00:00
{
fPixelOffsetFromCenter = (fColOffsetFromCenter - 3.1f) * ARROW_SIZE / 1.3f;
}
}
2002-07-23 01:41:40 +00:00
*/
2002-02-24 10:31:20 +00:00
switch( po.m_EffectType )
{
case PlayerOptions::EFFECT_DRUNK:
2002-06-14 22:25:22 +00:00
fPixelOffsetFromCenter += cosf( TIMER->GetTimeSinceStart()/4 + iColNum*0.4f + fYOffset/SCREEN_HEIGHT*4) * ARROW_SIZE/3;
2002-02-24 10:31:20 +00:00
break;
}
return fPixelOffsetFromCenter;
}
2002-04-16 17:31:00 +00:00
float ArrowGetRotation( const PlayerOptions& po, int iColNum, float fYOffset )
2002-02-24 10:31:20 +00:00
{
2002-04-01 02:04:43 +00:00
float fRotation = 0; //StyleDef.m_ColumnToRotation[iColNum];
2002-02-25 23:29:39 +00:00
2002-02-24 10:31:20 +00:00
switch( po.m_EffectType )
{
case PlayerOptions::EFFECT_DIZZY:
fRotation += fYOffset/SCREEN_HEIGHT*6;
break;
}
return fRotation;
}
float ArrowGetYPos( const PlayerOptions& po, float fYOffset )
{
return fYOffset * po.m_fArrowScrollSpeed * (po.m_bReverseScroll ? -1 : 1 );
}
float ArrowGetAlpha( const PlayerOptions& po, float fYPos )
{
float fAlpha;
switch( po.m_AppearanceType )
{
case PlayerOptions::APPEARANCE_VISIBLE:
fAlpha = 1;
break;
case PlayerOptions::APPEARANCE_HIDDEN:
fAlpha = (fYPos-100)/200;
break;
case PlayerOptions::APPEARANCE_SUDDEN:
2002-06-27 17:49:10 +00:00
fAlpha = ((SCREEN_HEIGHT-fYPos)-260)/200;
2002-02-24 10:31:20 +00:00
break;
case PlayerOptions::APPEARANCE_STEALTH:
fAlpha = 0;
break;
default:
ASSERT( false );
fAlpha = 0;
2002-02-24 10:31:20 +00:00
};
if( fYPos < 0 )
fAlpha = 1;
return fAlpha;
};