Fixed silly joystick axis bug.

This commit is contained in:
Chris Danford
2003-01-09 07:46:45 +00:00
parent 1b4ef26e5b
commit 22bb938dd2
11 changed files with 82 additions and 112 deletions
+3 -3
View File
@@ -84,7 +84,7 @@ MusicBannerWheel::MusicBannerWheel()
else // theres a song already selected (i.e. they came back from gameplay)...
{
// find our song and change the currentPos to wherever it may be.
for(int i=0; i<arraySongs.size(); i++)
for(unsigned i=0; i<arraySongs.size(); i++)
{
if( GAMESTATE->m_pCurSong == arraySongs[i])
{
@@ -104,7 +104,7 @@ MusicBannerWheel::MusicBannerWheel()
/************ TODO: OPTIMIZE THIS: MUST!!!! ********************/
void MusicBannerWheel::LoadSongData()
{
Song* pSong;
Song* pSong = NULL;
CStringArray asGraphicPaths;
if(MAXSONGSINBUFFER >= arraySongs.size() && SingleLoad != 1) // less than the MAXSONGSINBUFFER means we can get away with loading the lot in one go
@@ -115,7 +115,7 @@ void MusicBannerWheel::LoadSongData()
difference = MAXSONGSINBUFFER - arraySongs.size();
for(int i=0; i<=difference; i++)
{
for(int c=0; c<arraySongs.size(); c++)
for(unsigned c=0; c<arraySongs.size(); c++)
{
pSong = arraySongs[c];
+7 -1
View File
@@ -416,11 +416,17 @@ void RageInput::Update( float fDeltaTime )
for( int axis=0; axis<iNumJoyAxes; axis++ )
{
Sint16 val = SDL_JoystickGetAxis(pJoy,axis);
if( val < -100 )
LOG->Trace( "val = %d", val );
if( val < -16000 )
{
JoystickButton b = (JoystickButton)(JOY_LEFT+2*axis);
m_joyState[joy].button[b] = true;
}
else if( val > +16000 )
{
JoystickButton b = (JoystickButton)(JOY_RIGHT+2*axis);
m_joyState[joy].button[b] = true;
}
}
int iNumJoyHats = min(NUM_JOYSTICK_HATS,SDL_JoystickNumHats(pJoy));
+2 -1
View File
@@ -39,7 +39,8 @@ enum InputDevice {
// button byte codes for directional pad
enum JoystickButton {
JOY_LEFT = 0, JOY_RIGHT, JOY_UP, JOY_DOWN,
JOY_LEFT = 0, JOY_RIGHT,
JOY_UP, JOY_DOWN,
JOY_Z_UP, JOY_Z_DOWN,
JOY_Z_ROT_UP, JOY_Z_ROT_DOWN,
JOY_HAT_LEFT, JOY_HAT_RIGHT, JOY_HAT_UP, JOY_HAT_DOWN,
+6 -6
View File
@@ -30,16 +30,16 @@
#include "InputMapper.h"
#include "CodeDetector.h"
#define SCROLLING_LIST_X THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListX")
#define SCROLLING_LIST_Y THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListY")
#define PUMP_DIFF_X THEME->GetMetricI("ScreenEz2SelectMusic","PumpDifficultyX")
#define PUMP_DIFF_Y THEME->GetMetricI("ScreenEz2SelectMusic","PumpDifficultyY")
#define SCROLLING_LIST_X THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListX")
#define SCROLLING_LIST_Y THEME->GetMetricF("ScreenEz2SelectMusic","ScrollingListY")
#define PUMP_DIFF_X THEME->GetMetricF("ScreenEz2SelectMusic","PumpDifficultyX")
#define PUMP_DIFF_Y THEME->GetMetricF("ScreenEz2SelectMusic","PumpDifficultyY")
#define HELP_TEXT THEME->GetMetric("ScreenSelectMusic","HelpText")
#define TIMER_SECONDS THEME->GetMetricI("ScreenSelectMusic","TimerSeconds")
#define METER_X( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("MeterP%dX",p+1))
#define METER_Y( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("MeterP%dY",p+1))
#define GUIDE_X THEME->GetMetricF("ScreenSelectMode","GuideX")
#define GUIDE_Y THEME->GetMetricF("ScreenSelectMode","GuideY")
#define GUIDE_X THEME->GetMetricF("ScreenSelectMode","GuideX")
#define GUIDE_Y THEME->GetMetricF("ScreenSelectMode","GuideY")
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+2);
+1 -1
View File
@@ -51,7 +51,7 @@ protected:
Sprite m_StyleListFrame;
Sprite m_SelectedStyleFrame;
CArray<ModeChoice,ModeChoice> m_aPossibleModeChoices;
vector<ModeChoice> m_aPossibleModeChoices;
ScrollingList m_ScrollingList;
void RefreshModeChoices();
-32
View File
@@ -1,32 +0,0 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
Class: ScreenLoading
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ScreenLoading.h"
#include "GameState.h"
ScreenLoading::ScreenLoading()
{
m_sprLoading.Load( THEME->GetPathTo(GRAPHIC_LOADING) );
m_sprLoading.SetXY( CENTER_X, CENTER_Y );
this->AddSubActor( &m_sprLoading );
m_textMessage.Load( THEME->GetPathTo(FONT_NORMAL) );
m_textMessage.SetXY( CENTER_X, CENTER_Y );
this->AddSubActor( &m_textMessage );
}
void ScreenLoading::DrawPrimitives()
{
m_textMessage.SetText( GAMESTATE->m_sLoadingMessage );
Screen::DrawPrimitives();
}
-32
View File
@@ -1,32 +0,0 @@
#ifndef SCREENLOADING_H
#define SCREENLOADING_H
/*
-----------------------------------------------------------------------------
Class: ScreenLoading
Desc: Shows while game loads.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "Screen.h"
#include "BitmapText.h"
#include "Sprite.h"
class ScreenLoading : public Screen
{
public:
ScreenLoading();
virtual void DrawPrimitives();
protected:
BitmapText m_textMessage;
Sprite m_sprLoading;
};
#endif
+3 -2
View File
@@ -23,6 +23,7 @@
ScreenTestSound::ScreenTestSound()
{
int i;
this->AddChild(&HEEEEEEEEELP);
HEEEEEEEEELP.SetXY(450, 400);
@@ -35,7 +36,7 @@ ScreenTestSound::ScreenTestSound()
"a Set autostop\n"
"c Set continue");
for(int i = 0; i < nsounds; ++i)
for(i = 0; i < nsounds; ++i)
{
this->AddChild(&s[i].txt);
s[i].txt.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
@@ -62,7 +63,7 @@ s[0].s.SetPlaybackRate(1.20f);
//s[0].s.Play();
selected = 0;
for(int i = 0; i < nsounds; ++i)
for(i = 0; i < nsounds; ++i)
UpdateText(i);
}
+1
View File
@@ -185,6 +185,7 @@ ScreenTitleMenu::~ScreenTitleMenu()
void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
// LOG->Trace( "ScreenTitleMenu::Input()" );
LOG->Trace( "ScreenTitleMenu::Input( %d-%d )", DeviceI.device, DeviceI.button ); // debugging gameport joystick problem
if( m_Fade.IsClosing() )
return;
+59 -19
View File
@@ -57,7 +57,7 @@ LINK32=link.exe
# SUBTRACT LINK32 /verbose /pdb:none
# Begin Special Build Tool
IntDir=.\../Release6
TargetDir=\temp\stepmania
TargetDir=\stepmania\stepmania
TargetName=StepMania
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
@@ -92,7 +92,7 @@ LINK32=link.exe
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# Begin Special Build Tool
IntDir=.\../Debug6
TargetDir=\temp\stepmania
TargetDir=\stepmania\stepmania
TargetName=StepMania-debug
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
@@ -223,14 +223,6 @@ SOURCE=.\RageMovieTexture.h
# End Source File
# Begin Source File
SOURCE=.\RageNetworkClient.cpp
# End Source File
# Begin Source File
SOURCE=.\RageNetworkClient.h
# End Source File
# Begin Source File
SOURCE=.\RageSound.cpp
# End Source File
# Begin Source File
@@ -1272,6 +1264,14 @@ SOURCE=.\Screen.h
# End Source File
# Begin Source File
SOURCE=.\ScreenAlbums.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenAlbums.h
# End Source File
# Begin Source File
SOURCE=.\ScreenAppearanceOptions.cpp
# End Source File
# Begin Source File
@@ -1280,6 +1280,14 @@ SOURCE=.\ScreenAppearanceOptions.h
# End Source File
# Begin Source File
SOURCE=.\ScreenAttract.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenAttract.h
# End Source File
# Begin Source File
SOURCE=.\ScreenCaution.cpp
# End Source File
# Begin Source File
@@ -1288,6 +1296,18 @@ SOURCE=.\ScreenCaution.h
# End Source File
# Begin Source File
SOURCE=.\ScreenCompany.h
# End Source File
# Begin Source File
SOURCE=.\ScreenDemonstration.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenDemonstration.h
# End Source File
# Begin Source File
SOURCE=.\ScreenEdit.cpp
# End Source File
# Begin Source File
@@ -1361,7 +1381,11 @@ SOURCE=.\ScreenGraphicOptions.h
# End Source File
# Begin Source File
SOURCE=.\ScreenHowToPlay.cpp
SOURCE=.\ScreenHighScores.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenHighScores.h
# End Source File
# Begin Source File
@@ -1377,6 +1401,18 @@ SOURCE=.\ScreenInputOptions.h
# End Source File
# Begin Source File
SOURCE=.\ScreenInstructions.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenInstructions.h
# End Source File
# Begin Source File
SOURCE=.\ScreenLogo.h
# End Source File
# Begin Source File
SOURCE=.\ScreenMachineOptions.cpp
# End Source File
# Begin Source File
@@ -1401,6 +1437,10 @@ SOURCE=.\ScreenMapControllers.h
# End Source File
# Begin Source File
SOURCE=.\ScreenMemoryCard.h
# End Source File
# Begin Source File
SOURCE=.\ScreenMessage.h
# End Source File
# Begin Source File
@@ -1413,14 +1453,6 @@ SOURCE=.\ScreenMusicScroll.h
# End Source File
# Begin Source File
SOURCE=.\ScreenNetworkWaiting.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenNetworkWaiting.h
# End Source File
# Begin Source File
SOURCE=.\ScreenOptions.cpp
# End Source File
# Begin Source File
@@ -1571,6 +1603,14 @@ SOURCE=.\ScreenTitleMenu.cpp
SOURCE=.\ScreenTitleMenu.h
# End Source File
# Begin Source File
SOURCE=.\ScreenUnlock.h
# End Source File
# Begin Source File
SOURCE=.\ScreenWarning.h
# End Source File
# End Group
# Begin Group "Global Singletons"
-15
View File
@@ -1155,21 +1155,6 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
<File
RelativePath="RageMovieTextureHelper.h">
</File>
<File
RelativePath="RageNetworkClient.cpp">
</File>
<File
RelativePath="RageNetworkClient.h">
</File>
<File
RelativePath="RageNetworkPacket.h">
</File>
<File
RelativePath="RageNetworkServer.cpp">
</File>
<File
RelativePath="RageNetworkServer.h">
</File>
<File
RelativePath="RageSound.cpp">
</File>