[Player] CheckpointsFlashOnHold metric added (bool). also cleanup/comment/etc.
This commit is contained in:
@@ -0,0 +1,161 @@
|
|||||||
|
-- sm-ssc fallback theme | script ring 03 | Gameplay.lua
|
||||||
|
-- [en] This file is used to store settings that should be different in each
|
||||||
|
-- game mode.
|
||||||
|
|
||||||
|
-- GameCompatibleModes:
|
||||||
|
-- [en] returns possible modes for ScreenSelectPlayMode
|
||||||
|
function GameCompatibleModes()
|
||||||
|
sGame = GAMESTATE:GetCurrentGame():GetName();
|
||||||
|
local Modes = {
|
||||||
|
dance = "Single,Double,Solo,Versus,Couple",
|
||||||
|
pump = "Single,Double,HalfDouble,Versus,Couple",
|
||||||
|
beat = "5Keys,7Keys,10Keys,14Keys",
|
||||||
|
kb7 = "KB7",
|
||||||
|
para = "Single",
|
||||||
|
lights = "Single", -- lights shouldn't be playable
|
||||||
|
};
|
||||||
|
return Modes[sGame];
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ComboContinue:
|
||||||
|
-- [en]
|
||||||
|
function ComboContinue()
|
||||||
|
sGame = GAMESTATE:GetCurrentGame():GetName();
|
||||||
|
local Continue = {
|
||||||
|
dance = GAMESTATE:GetPlayMode() == "PlayMode_Oni" and "TapNoteScore_W2" or "TapNoteScore_W3",
|
||||||
|
pump = "TapNoteScore_W4",
|
||||||
|
beat = "TapNoteScore_W3",
|
||||||
|
kb7 = "TapNoteScore_W3",
|
||||||
|
para = "TapNoteScore_W4",
|
||||||
|
};
|
||||||
|
return Continue[sGame]
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ComboMaintain()
|
||||||
|
sGame = GAMESTATE:GetCurrentGame():GetName();
|
||||||
|
local Maintain = {
|
||||||
|
dance = "TapNoteScore_W3",
|
||||||
|
pump = "TapNoteScore_W4",
|
||||||
|
beat = "TapNoteScore_W3",
|
||||||
|
kb7 = "TapNoteScore_W3",
|
||||||
|
para = "TapNoteScore_W4",
|
||||||
|
};
|
||||||
|
return Maintain[sGame]
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ComboPerRow()
|
||||||
|
sGame = GAMESTATE:GetCurrentGame():GetName();
|
||||||
|
if sGame == "pump" then
|
||||||
|
return true;
|
||||||
|
elseif GAMESTATE:GetPlayMode() == "PlayMode_Oni" then
|
||||||
|
return true;
|
||||||
|
else return false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function HitCombo()
|
||||||
|
sGame = GAMESTATE:GetCurrentGame():GetName();
|
||||||
|
local Combo = {
|
||||||
|
dance = 2,
|
||||||
|
pump = 4,
|
||||||
|
beat = 2,
|
||||||
|
kb7 = 2,
|
||||||
|
para = 2,
|
||||||
|
};
|
||||||
|
return Combo[sGame]
|
||||||
|
end;
|
||||||
|
|
||||||
|
function MissCombo()
|
||||||
|
sGame = GAMESTATE:GetCurrentGame():GetName();
|
||||||
|
local Combo = {
|
||||||
|
dance = 2,
|
||||||
|
pump = 4,
|
||||||
|
beat = 0,
|
||||||
|
kb7 = 0,
|
||||||
|
para = 0,
|
||||||
|
};
|
||||||
|
return Combo[sGame]
|
||||||
|
end;
|
||||||
|
|
||||||
|
function FailCombo() -- The combo that causes game failure.
|
||||||
|
sGame = GAMESTATE:GetCurrentGame():GetName();
|
||||||
|
local Combo = {
|
||||||
|
dance = 30, -- ITG/Pump Pro does it this way.
|
||||||
|
pump = 51,
|
||||||
|
beat = -1,
|
||||||
|
kb7 = -1,
|
||||||
|
para = -1,
|
||||||
|
};
|
||||||
|
return Combo[sGame]
|
||||||
|
end;
|
||||||
|
|
||||||
|
-- todo: use tables for some of these -aj
|
||||||
|
function HoldTiming()
|
||||||
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
|
return 0;
|
||||||
|
else return PREFSMAN:GetPreference("TimingWindowSecondsHold");
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function HoldJudgmentFail()
|
||||||
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
|
return cmd();
|
||||||
|
else return cmd(finishtweening;shadowlength,0;diffusealpha,1;zoom,1;y,-10;linear,0.8;y,10;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function HoldJudgmentPass()
|
||||||
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
|
return cmd();
|
||||||
|
else return cmd(finishtweening;shadowlength,0;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function HoldHeadStep()
|
||||||
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
|
return false;
|
||||||
|
else return true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function InitialHoldLife()
|
||||||
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
|
return 0.05;
|
||||||
|
else return 1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function MaxHoldLife()
|
||||||
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
|
return 0.05;
|
||||||
|
else return 1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ImmediateHoldLetGo()
|
||||||
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
|
return false;
|
||||||
|
else return true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function RollBodyIncrementsCombo()
|
||||||
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
|
return false;
|
||||||
|
else return true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CheckpointsTapsSeparateJudgment()
|
||||||
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
|
return false;
|
||||||
|
else return true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ScoreMissedHoldsAndRolls()
|
||||||
|
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
||||||
|
return false;
|
||||||
|
else return true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
@@ -128,158 +128,3 @@ end
|
|||||||
|
|
||||||
--[[ end helper functions ]]
|
--[[ end helper functions ]]
|
||||||
-- this code is in the public domain.
|
-- this code is in the public domain.
|
||||||
|
|
||||||
--[[ these should probably be moved into another file: ]]
|
|
||||||
function GameCompatibleModes()
|
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
|
||||||
local Modes = {
|
|
||||||
dance = "Single,Double,Solo,Versus,Couple",
|
|
||||||
pump = "Single,Double,HalfDouble,Versus,Couple",
|
|
||||||
beat = "5Keys,7Keys,10Keys,14Keys",
|
|
||||||
kb7 = "KB7",
|
|
||||||
para = "Single",
|
|
||||||
lights = "Single", -- lights shouldn't be playable
|
|
||||||
};
|
|
||||||
return Modes[sGame];
|
|
||||||
end
|
|
||||||
|
|
||||||
function ComboContinue()
|
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
|
||||||
local Continue = {
|
|
||||||
dance = GAMESTATE:GetPlayMode() == "PlayMode_Oni" and "TapNoteScore_W2" or "TapNoteScore_W3",
|
|
||||||
pump = "TapNoteScore_W4",
|
|
||||||
beat = "TapNoteScore_W3",
|
|
||||||
kb7 = "TapNoteScore_W3",
|
|
||||||
para = "TapNoteScore_W4",
|
|
||||||
};
|
|
||||||
return Continue[sGame]
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ComboMaintain()
|
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
|
||||||
local Maintain = {
|
|
||||||
dance = "TapNoteScore_W3",
|
|
||||||
pump = "TapNoteScore_W4",
|
|
||||||
beat = "TapNoteScore_W3",
|
|
||||||
kb7 = "TapNoteScore_W3",
|
|
||||||
para = "TapNoteScore_W4",
|
|
||||||
};
|
|
||||||
return Maintain[sGame]
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ComboPerRow()
|
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
|
||||||
if sGame == "pump" then
|
|
||||||
return true;
|
|
||||||
elseif GAMESTATE:GetPlayMode() == "PlayMode_Oni" then
|
|
||||||
return true;
|
|
||||||
else return false;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function HitCombo()
|
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
|
||||||
local Combo = {
|
|
||||||
dance = 2,
|
|
||||||
pump = 4,
|
|
||||||
beat = 2,
|
|
||||||
kb7 = 2,
|
|
||||||
para = 2,
|
|
||||||
};
|
|
||||||
return Combo[sGame]
|
|
||||||
end;
|
|
||||||
|
|
||||||
function MissCombo()
|
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
|
||||||
local Combo = {
|
|
||||||
dance = 2,
|
|
||||||
pump = 4,
|
|
||||||
beat = 0,
|
|
||||||
kb7 = 0,
|
|
||||||
para = 0,
|
|
||||||
};
|
|
||||||
return Combo[sGame]
|
|
||||||
end;
|
|
||||||
|
|
||||||
function FailCombo() -- The combo that causes game failure.
|
|
||||||
sGame = GAMESTATE:GetCurrentGame():GetName();
|
|
||||||
local Combo = {
|
|
||||||
dance = 30, -- ITG/Pump Pro does it this way.
|
|
||||||
pump = 51,
|
|
||||||
beat = -1,
|
|
||||||
kb7 = -1,
|
|
||||||
para = -1,
|
|
||||||
};
|
|
||||||
return Combo[sGame]
|
|
||||||
end;
|
|
||||||
|
|
||||||
-- todo: use tables for some of these -aj
|
|
||||||
function HoldTiming()
|
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
|
||||||
return 0;
|
|
||||||
else return PREFSMAN:GetPreference("TimingWindowSecondsHold");
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function HoldJudgmentFail()
|
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
|
||||||
return cmd();
|
|
||||||
else return cmd(finishtweening;shadowlength,0;diffusealpha,1;zoom,1;y,-10;linear,0.8;y,10;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function HoldJudgmentPass()
|
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
|
||||||
return cmd();
|
|
||||||
else return cmd(finishtweening;shadowlength,0;diffusealpha,1;zoom,1.25;linear,0.3;zoomx,1;zoomy,1;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function HoldHeadStep()
|
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
|
||||||
return false;
|
|
||||||
else return true;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function InitialHoldLife()
|
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
|
||||||
return 0.05;
|
|
||||||
else return 1;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function MaxHoldLife()
|
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
|
||||||
return 0.05;
|
|
||||||
else return 1;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ImmediateHoldLetGo()
|
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
|
||||||
return false;
|
|
||||||
else return true;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function RollBodyIncrementsCombo()
|
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
|
||||||
return false;
|
|
||||||
else return true;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function CheckpointsTapsSeparateJudgment()
|
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
|
||||||
return false;
|
|
||||||
else return true;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ScoreMissedHoldsAndRolls()
|
|
||||||
if GAMESTATE:GetCurrentGame():GetName() == "pump" then
|
|
||||||
return false;
|
|
||||||
else return true;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|||||||
@@ -1,5 +1,28 @@
|
|||||||
todo: edit this document to reflect sm-ssc's structure
|
sm-ssc Scripts Directory: Introduction
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
Hello, and welcome to the sm-ssc Scripts directory. You'll notice that our Lua
|
||||||
|
scripts have numbers at the beginning of them. This is to control the order of
|
||||||
|
execution.
|
||||||
|
|
||||||
|
In sm-ssc, scripts in subdirectories of Scripts/
|
||||||
|
(e.g. Scripts/01/somescript.lua) are loaded before scripts in the root of
|
||||||
|
Scripts/ (e.g. Scripts/01 base.lua). This is important to know when making a
|
||||||
|
theme for sm-ssc.
|
||||||
|
|
||||||
|
In sm-ssc, there are five rings of script execution:
|
||||||
|
|
||||||
|
00 - Initialization
|
||||||
|
|
||||||
|
01 - Base
|
||||||
|
|
||||||
|
02 - Defaults
|
||||||
|
|
||||||
|
03 - Extensions
|
||||||
|
|
||||||
|
04 - ?
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
previously:
|
||||||
SMOKE WEED '98 Scripts Directory Organization,
|
SMOKE WEED '98 Scripts Directory Organization,
|
||||||
or "An applied case of application of prefixes to control order of execution".
|
or "An applied case of application of prefixes to control order of execution".
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ DefaultNoteSkinName="default"
|
|||||||
DifficultiesToShow="beginner,easy,medium,hard,challenge"
|
DifficultiesToShow="beginner,easy,medium,hard,challenge"
|
||||||
# Same as above, but for courses.
|
# Same as above, but for courses.
|
||||||
CourseDifficultiesToShow="easy,medium,hard"
|
CourseDifficultiesToShow="easy,medium,hard"
|
||||||
# Things to hide. You couldn't play cabinet nayways.
|
# Things to hide. You couldn't play cabinet anyways.
|
||||||
StepsTypesToHide="lights-cabinet"
|
StepsTypesToHide="lights-cabinet"
|
||||||
#~ StepsTypesToHide="dance-couple,dance-solo,pump-halfdouble,lights-cabinet"
|
#~ StepsTypesToHide="dance-couple,dance-solo,pump-halfdouble,lights-cabinet"
|
||||||
# Useless?
|
# Useless?
|
||||||
@@ -831,13 +831,14 @@ ComboUnderField=true
|
|||||||
PenalizeTapScoreNone=false
|
PenalizeTapScoreNone=false
|
||||||
JudgeHoldNotesOnSameRowTogether=(GAMESTATE:GetCurrentGame():GetName() == "pump")
|
JudgeHoldNotesOnSameRowTogether=(GAMESTATE:GetCurrentGame():GetName() == "pump")
|
||||||
HoldCheckpoints=(GAMESTATE:GetCurrentGame():GetName() == "pump")
|
HoldCheckpoints=(GAMESTATE:GetCurrentGame():GetName() == "pump")
|
||||||
|
CheckpointsUseTimeSignatures=(GAMESTATE:GetCurrentGame():GetName() == "pump")
|
||||||
|
CheckpointsTapsSeparateJudgment=CheckpointsTapsSeparateJudgment()
|
||||||
|
CheckpointsFlashOnHold=false
|
||||||
ImmediateHoldLetGo=ImmediateHoldLetGo()
|
ImmediateHoldLetGo=ImmediateHoldLetGo()
|
||||||
RequireStepOnHoldHeads=HoldHeadStep()
|
RequireStepOnHoldHeads=HoldHeadStep()
|
||||||
CheckpointsUseTimeSignatures=(GAMESTATE:GetCurrentGame():GetName() == "pump")
|
|
||||||
InitialHoldLife=InitialHoldLife()
|
InitialHoldLife=InitialHoldLife()
|
||||||
MaxHoldLife=MaxHoldLife()
|
MaxHoldLife=MaxHoldLife()
|
||||||
RollBodyIncrementsCombo=RollBodyIncrementsCombo()
|
RollBodyIncrementsCombo=RollBodyIncrementsCombo()
|
||||||
CheckpointsTapsSeparateJudgment=CheckpointsTapsSeparateJudgment()
|
|
||||||
ScoreMissedHoldsAndRolls=ScoreMissedHoldsAndRolls()
|
ScoreMissedHoldsAndRolls=ScoreMissedHoldsAndRolls()
|
||||||
|
|
||||||
[Profile]
|
[Profile]
|
||||||
|
|||||||
+5
-3
@@ -764,6 +764,8 @@ void GameState::FinishStage()
|
|||||||
if( m_bDemonstrationOrJukebox )
|
if( m_bDemonstrationOrJukebox )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// todo: simplify. profile saving is accomplished in ScreenProfileSave
|
||||||
|
// now; all this code does differently is save machine profile as well. -aj
|
||||||
if( IsEventMode() )
|
if( IsEventMode() )
|
||||||
{
|
{
|
||||||
const int iSaveProfileEvery = 3;
|
const int iSaveProfileEvery = 3;
|
||||||
@@ -1413,7 +1415,7 @@ void GameState::GetAllUsedNoteSkins( vector<RString> &out ) const
|
|||||||
{
|
{
|
||||||
out.push_back( m_pPlayerState[pn]->m_PlayerOptions.GetCurrent().m_sNoteSkin );
|
out.push_back( m_pPlayerState[pn]->m_PlayerOptions.GetCurrent().m_sNoteSkin );
|
||||||
|
|
||||||
/* Add note skins that are used in courses. */
|
// Add note skins that are used in courses.
|
||||||
if( IsCourseMode() )
|
if( IsCourseMode() )
|
||||||
{
|
{
|
||||||
const Trail *pTrail = m_pCurTrail[pn];
|
const Trail *pTrail = m_pCurTrail[pn];
|
||||||
@@ -1429,7 +1431,7 @@ void GameState::GetAllUsedNoteSkins( vector<RString> &out ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove duplicates. */
|
// Remove duplicates.
|
||||||
sort( out.begin(), out.end() );
|
sort( out.begin(), out.end() );
|
||||||
out.erase( unique( out.begin(), out.end() ), out.end() );
|
out.erase( unique( out.begin(), out.end() ), out.end() );
|
||||||
}
|
}
|
||||||
@@ -1457,7 +1459,7 @@ PlayerOptions::FailType GameState::GetPlayerFailType( const PlayerState *pPlayer
|
|||||||
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||||
PlayerOptions::FailType ft = pPlayerState->m_PlayerOptions.GetCurrent().m_FailType;
|
PlayerOptions::FailType ft = pPlayerState->m_PlayerOptions.GetCurrent().m_FailType;
|
||||||
|
|
||||||
/* If the player changed the fail mode explicitly, leave it alone. */
|
// If the player changed the fail mode explicitly, leave it alone.
|
||||||
if( m_bChangedFailTypeOnScreenSongOptions )
|
if( m_bChangedFailTypeOnScreenSongOptions )
|
||||||
return ft;
|
return ft;
|
||||||
|
|
||||||
|
|||||||
@@ -376,8 +376,6 @@ void MusicWheel::GetSongList( vector<Song*> &arraySongs, SortOrder so )
|
|||||||
if( pSong->HasStepsType(GAMESTATE->GetCurrentStyle()->m_StepsType) )
|
if( pSong->HasStepsType(GAMESTATE->GetCurrentStyle()->m_StepsType) )
|
||||||
arraySongs.push_back( pSong );
|
arraySongs.push_back( pSong );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hack: Add extra stage item if it was eliminated for any reason
|
/* Hack: Add extra stage item if it was eliminated for any reason
|
||||||
|
|||||||
@@ -752,8 +752,8 @@ void NetworkSyncManager::SendSMOnline( )
|
|||||||
|
|
||||||
SMOStepType NetworkSyncManager::TranslateStepType(int score)
|
SMOStepType NetworkSyncManager::TranslateStepType(int score)
|
||||||
{
|
{
|
||||||
/* Translate from Stepmania's constantly changing TapNoteScore to SMO's
|
/* Translate from Stepmania's constantly changing TapNoteScore
|
||||||
note scores */
|
* to SMO's note scores */
|
||||||
switch(score)
|
switch(score)
|
||||||
{
|
{
|
||||||
case TNS_HitMine:
|
case TNS_HitMine:
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ enum SMOStepType
|
|||||||
|
|
||||||
const NSCommand NSServerOffset = (NSCommand)128;
|
const NSCommand NSServerOffset = (NSCommand)128;
|
||||||
|
|
||||||
|
// TODO: Provide a Lua binding that gives access to this data. -aj
|
||||||
struct EndOfGame_PlayerData
|
struct EndOfGame_PlayerData
|
||||||
{
|
{
|
||||||
int name;
|
int name;
|
||||||
@@ -139,10 +140,10 @@ public:
|
|||||||
bool isSMOnline;
|
bool isSMOnline;
|
||||||
bool isSMOLoggedIn[NUM_PLAYERS];
|
bool isSMOLoggedIn[NUM_PLAYERS];
|
||||||
|
|
||||||
vector <int> m_PlayerStatus;
|
vector<int> m_PlayerStatus;
|
||||||
int m_ActivePlayers;
|
int m_ActivePlayers;
|
||||||
vector <int> m_ActivePlayer;
|
vector<int> m_ActivePlayer;
|
||||||
vector <RString> m_PlayerNames;
|
vector<RString> m_PlayerNames;
|
||||||
|
|
||||||
// Used for ScreenNetEvaluation
|
// Used for ScreenNetEvaluation
|
||||||
vector<EndOfGame_PlayerData> m_EvalPlayerData;
|
vector<EndOfGame_PlayerData> m_EvalPlayerData;
|
||||||
|
|||||||
+8
-12
@@ -126,8 +126,8 @@ void NoteField::CacheAllUsedNoteSkins()
|
|||||||
for( unsigned i=0; i < asSkins.size(); ++i )
|
for( unsigned i=0; i < asSkins.size(); ++i )
|
||||||
CacheNoteSkin( asSkins[i] );
|
CacheNoteSkin( asSkins[i] );
|
||||||
|
|
||||||
/* If we're changing note skins in the editor, we can have old note skins lying
|
/* If we're changing note skins in the editor, we can have old note skins
|
||||||
* around. Remove them so they don't accumulate. */
|
* lying around. Remove them so they don't accumulate. */
|
||||||
set<RString> setNoteSkinsToUnload;
|
set<RString> setNoteSkinsToUnload;
|
||||||
FOREACHM( RString, NoteDisplayCols *, m_NoteDisplays, d )
|
FOREACHM( RString, NoteDisplayCols *, m_NoteDisplays, d )
|
||||||
{
|
{
|
||||||
@@ -218,7 +218,6 @@ void NoteField::Update( float fDeltaTime )
|
|||||||
const float fYOffsetCurrent = ArrowEffects::GetYOffset( m_pPlayerState, 0, m_fCurrentBeatLastUpdate );
|
const float fYOffsetCurrent = ArrowEffects::GetYOffset( m_pPlayerState, 0, m_fCurrentBeatLastUpdate );
|
||||||
m_fYPosCurrentBeatLastUpdate = ArrowEffects::GetYPos( m_pPlayerState, 0, fYOffsetCurrent, m_fYReverseOffsetPixels );
|
m_fYPosCurrentBeatLastUpdate = ArrowEffects::GetYPos( m_pPlayerState, 0, fYOffsetCurrent, m_fYReverseOffsetPixels );
|
||||||
|
|
||||||
|
|
||||||
m_rectMarkerBar.Update( fDeltaTime );
|
m_rectMarkerBar.Update( fDeltaTime );
|
||||||
|
|
||||||
NoteDisplayCols *cur = m_pCurDisplay;
|
NoteDisplayCols *cur = m_pCurDisplay;
|
||||||
@@ -226,19 +225,16 @@ void NoteField::Update( float fDeltaTime )
|
|||||||
cur->m_ReceptorArrowRow.Update( fDeltaTime );
|
cur->m_ReceptorArrowRow.Update( fDeltaTime );
|
||||||
cur->m_GhostArrowRow.Update( fDeltaTime );
|
cur->m_GhostArrowRow.Update( fDeltaTime );
|
||||||
|
|
||||||
|
// TODO: make fade time of 1.5 seconds metricable instead? -aj
|
||||||
if( m_fPercentFadeToFail >= 0 )
|
if( m_fPercentFadeToFail >= 0 )
|
||||||
m_fPercentFadeToFail = min( m_fPercentFadeToFail + fDeltaTime/1.5f, 1 ); // take 1.5 seconds to totally fade
|
m_fPercentFadeToFail = min( m_fPercentFadeToFail + fDeltaTime/1.5f, 1 ); // take 1.5 seconds to totally fade
|
||||||
|
|
||||||
|
|
||||||
// Update fade to failed
|
// Update fade to failed
|
||||||
m_pCurDisplay->m_ReceptorArrowRow.SetFadeToFailPercent( m_fPercentFadeToFail );
|
m_pCurDisplay->m_ReceptorArrowRow.SetFadeToFailPercent( m_fPercentFadeToFail );
|
||||||
|
|
||||||
|
|
||||||
NoteDisplay::Update( fDeltaTime );
|
NoteDisplay::Update( fDeltaTime );
|
||||||
/*
|
/* Update all NoteDisplays. Hack: We need to call this once per frame, not
|
||||||
* Update all NoteDisplays. Hack: We need to call this once per frame, not
|
* once per player. */
|
||||||
* once per player.
|
|
||||||
*/
|
|
||||||
// TODO: Remove use of PlayerNumber.
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
|
||||||
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
@@ -315,16 +311,15 @@ void NoteField::DrawBeatBar( const float fBeat, BeatBarType type, int iMeasureIn
|
|||||||
|
|
||||||
void NoteField::DrawBoard( int iDrawDistanceAfterTargetsPixels, int iDrawDistanceBeforeTargetsPixels )
|
void NoteField::DrawBoard( int iDrawDistanceAfterTargetsPixels, int iDrawDistanceBeforeTargetsPixels )
|
||||||
{
|
{
|
||||||
|
// Draw the board centered on fYPosAt0 so that the board doesn't slide as
|
||||||
|
// the draw distance changes with modifiers.
|
||||||
const float fYPosAt0 = ArrowEffects::GetYPos( m_pPlayerState, 0, 0, m_fYReverseOffsetPixels );
|
const float fYPosAt0 = ArrowEffects::GetYPos( m_pPlayerState, 0, 0, m_fYReverseOffsetPixels );
|
||||||
|
|
||||||
// Draw the board centered on fYPosAt0 so that the board doesn't slide as the draw distance changes with modifiers.
|
|
||||||
|
|
||||||
// todo: make this an AutoActor instead? -aj
|
// todo: make this an AutoActor instead? -aj
|
||||||
Sprite *pSprite = dynamic_cast<Sprite *>( (Actor*)m_sprBoard );
|
Sprite *pSprite = dynamic_cast<Sprite *>( (Actor*)m_sprBoard );
|
||||||
if( pSprite == NULL )
|
if( pSprite == NULL )
|
||||||
RageException::Throw( "Board must be a Sprite" );
|
RageException::Throw( "Board must be a Sprite" );
|
||||||
|
|
||||||
|
|
||||||
RectF rect = *pSprite->GetCurrentTextureCoordRect();
|
RectF rect = *pSprite->GetCurrentTextureCoordRect();
|
||||||
const float fBoardGraphicHeightPixels = pSprite->GetUnzoomedHeight();
|
const float fBoardGraphicHeightPixels = pSprite->GetUnzoomedHeight();
|
||||||
float fTexCoordOffset = m_fBoardOffsetPixels / fBoardGraphicHeightPixels;
|
float fTexCoordOffset = m_fBoardOffsetPixels / fBoardGraphicHeightPixels;
|
||||||
@@ -336,6 +331,7 @@ void NoteField::DrawBoard( int iDrawDistanceAfterTargetsPixels, int iDrawDistanc
|
|||||||
pSprite->ZoomToHeight( fHeight );
|
pSprite->ZoomToHeight( fHeight );
|
||||||
pSprite->SetY( fY );
|
pSprite->SetY( fY );
|
||||||
|
|
||||||
|
// handle tex coord offset and fade
|
||||||
rect.top = -fTexCoordOffset-(iDrawDistanceBeforeTargetsPixels/fBoardGraphicHeightPixels);
|
rect.top = -fTexCoordOffset-(iDrawDistanceBeforeTargetsPixels/fBoardGraphicHeightPixels);
|
||||||
rect.bottom = -fTexCoordOffset+(-iDrawDistanceAfterTargetsPixels/fBoardGraphicHeightPixels);
|
rect.bottom = -fTexCoordOffset+(-iDrawDistanceAfterTargetsPixels/fBoardGraphicHeightPixels);
|
||||||
pSprite->SetCustomTextureRect( rect );
|
pSprite->SetCustomTextureRect( rect );
|
||||||
|
|||||||
@@ -16,14 +16,13 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include "SpecialFiles.h"
|
#include "SpecialFiles.h"
|
||||||
|
|
||||||
|
|
||||||
NoteSkinManager* NOTESKIN = NULL; // global object accessable from anywhere in the program
|
NoteSkinManager* NOTESKIN = NULL; // global object accessable from anywhere in the program
|
||||||
|
|
||||||
|
|
||||||
const RString GAME_COMMON_NOTESKIN_NAME = "common";
|
const RString GAME_COMMON_NOTESKIN_NAME = "common";
|
||||||
const RString GAME_BASE_NOTESKIN_NAME = "default";
|
const RString GAME_BASE_NOTESKIN_NAME = "default";
|
||||||
|
|
||||||
// this isn't a global because of nondeterministic global actor ordering might init this before SpecialFiles::NOTESKINS_DIR
|
// this isn't a global because of nondeterministic global actor ordering
|
||||||
|
// might init this before SpecialFiles::NOTESKINS_DIR
|
||||||
#define GLOBAL_BASE_DIR (SpecialFiles::NOTESKINS_DIR + GAME_COMMON_NOTESKIN_NAME + "/")
|
#define GLOBAL_BASE_DIR (SpecialFiles::NOTESKINS_DIR + GAME_COMMON_NOTESKIN_NAME + "/")
|
||||||
|
|
||||||
static map<RString,RString> g_PathCache;
|
static map<RString,RString> g_PathCache;
|
||||||
@@ -96,7 +95,7 @@ void NoteSkinManager::LoadNoteSkinData( const RString &sNoteSkinName, NoteSkinDa
|
|||||||
data_out.metrics.Clear();
|
data_out.metrics.Clear();
|
||||||
data_out.vsDirSearchOrder.clear();
|
data_out.vsDirSearchOrder.clear();
|
||||||
|
|
||||||
/* Read the current NoteSkin and all of its fallbacks */
|
// Read the current NoteSkin and all of its fallbacks
|
||||||
LoadNoteSkinDataRecursive( sNoteSkinName, data_out );
|
LoadNoteSkinDataRecursive( sNoteSkinName, data_out );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,7 +412,7 @@ Actor *NoteSkinManager::LoadActor( const RString &sButton, const RString &sEleme
|
|||||||
|
|
||||||
if( bSpriteOnly )
|
if( bSpriteOnly )
|
||||||
{
|
{
|
||||||
/* Make sure pActor is a Sprite (or something derived from Sprite). */
|
// Make sure pActor is a Sprite (or something derived from Sprite).
|
||||||
Sprite *pSprite = dynamic_cast<Sprite *>( pRet );
|
Sprite *pSprite = dynamic_cast<Sprite *>( pRet );
|
||||||
if( pSprite == NULL )
|
if( pSprite == NULL )
|
||||||
LOG->Warn( "%s: %s %s must be a Sprite", m_sCurrentNoteSkin.c_str(), sButton.c_str(), sElement.c_str() );
|
LOG->Warn( "%s: %s %s must be a Sprite", m_sCurrentNoteSkin.c_str(), sButton.c_str(), sElement.c_str() );
|
||||||
|
|||||||
+1
-3
@@ -23,7 +23,7 @@ private:
|
|||||||
RString m_sMetricsGroup;
|
RString m_sMetricsGroup;
|
||||||
|
|
||||||
BitmapText m_textItem;
|
BitmapText m_textItem;
|
||||||
OptionsCursor m_Underline[NUM_PLAYERS];
|
OptionsCursor m_Underline[NUM_PLAYERS];
|
||||||
AutoActor m_sprFrame;
|
AutoActor m_sprFrame;
|
||||||
BitmapText m_textTitle;
|
BitmapText m_textTitle;
|
||||||
ModIcon m_ModIcon;
|
ModIcon m_ModIcon;
|
||||||
@@ -110,9 +110,7 @@ public:
|
|||||||
|
|
||||||
void Reload();
|
void Reload();
|
||||||
|
|
||||||
//
|
|
||||||
// Messages
|
// Messages
|
||||||
//
|
|
||||||
virtual void HandleMessage( const Message &msg );
|
virtual void HandleMessage( const Message &msg );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
+41
-49
@@ -113,6 +113,7 @@ int OptionRowHandlerUtil::GetOneSelection( const vector<bool> &vbSelected )
|
|||||||
|
|
||||||
static LocalizedString OFF ( "OptionRowHandler", "Off" );
|
static LocalizedString OFF ( "OptionRowHandler", "Off" );
|
||||||
|
|
||||||
|
// begin OptionRow handlers
|
||||||
class OptionRowHandlerList : public OptionRowHandler
|
class OptionRowHandlerList : public OptionRowHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -145,7 +146,7 @@ public:
|
|||||||
m_Default.Load( -1, ParseCommands(ENTRY_DEFAULT(sParam)) );
|
m_Default.Load( -1, ParseCommands(ENTRY_DEFAULT(sParam)) );
|
||||||
|
|
||||||
{
|
{
|
||||||
/* Parse the basic configuration metric. */
|
// Parse the basic configuration metric.
|
||||||
Commands cmds = ParseCommands( ENTRY(sParam) );
|
Commands cmds = ParseCommands( ENTRY(sParam) );
|
||||||
if( cmds.v.size() < 1 )
|
if( cmds.v.size() < 1 )
|
||||||
RageException::Throw( "Parse error in \"ScreenOptionsMaster::%s\".", sParam.c_str() );
|
RageException::Throw( "Parse error in \"ScreenOptionsMaster::%s\".", sParam.c_str() );
|
||||||
@@ -466,8 +467,8 @@ class OptionRowHandlerListSteps : public OptionRowHandlerList
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We have neither a song nor a course. We may be preloading the screen
|
/* We have neither a song nor a course. We may be preloading the
|
||||||
* for future use. */
|
* screen for future use. */
|
||||||
m_Def.m_vsChoices.push_back( "n/a" );
|
m_Def.m_vsChoices.push_back( "n/a" );
|
||||||
m_aListEntries.push_back( GameCommand() );
|
m_aListEntries.push_back( GameCommand() );
|
||||||
}
|
}
|
||||||
@@ -805,7 +806,7 @@ public:
|
|||||||
|
|
||||||
m_EnabledForPlayersFunc.PushSelf( L );
|
m_EnabledForPlayersFunc.PushSelf( L );
|
||||||
|
|
||||||
/* Argument 1 (self): */
|
// Argument 1 (self):
|
||||||
m_pLuaTable->PushSelf( L );
|
m_pLuaTable->PushSelf( L );
|
||||||
|
|
||||||
lua_call( L, 1, 1 ); // call function with 1 argument and 1 result
|
lua_call( L, 1, 1 ); // call function with 1 argument and 1 result
|
||||||
@@ -817,12 +818,12 @@ public:
|
|||||||
lua_pushnil( L );
|
lua_pushnil( L );
|
||||||
while( lua_next(L, -2) != 0 )
|
while( lua_next(L, -2) != 0 )
|
||||||
{
|
{
|
||||||
/* `key' is at index -2 and `value' at index -1 */
|
// `key' is at index -2 and `value' at index -1
|
||||||
PlayerNumber pn = (PlayerNumber)luaL_checkint( L, -1 );
|
PlayerNumber pn = (PlayerNumber)luaL_checkint( L, -1 );
|
||||||
|
|
||||||
m_Def.m_vEnabledForPlayers.insert( pn );
|
m_Def.m_vEnabledForPlayers.insert( pn );
|
||||||
|
|
||||||
lua_pop( L, 1 ); /* removes `value'; keeps `key' for next iteration */
|
lua_pop( L, 1 ); // removes `value'; keeps `key' for next iteration
|
||||||
}
|
}
|
||||||
lua_pop( L, 1 );
|
lua_pop( L, 1 );
|
||||||
|
|
||||||
@@ -841,7 +842,7 @@ public:
|
|||||||
|
|
||||||
Lua *L = LUA->Get();
|
Lua *L = LUA->Get();
|
||||||
|
|
||||||
/* Run the Lua expression. It should return a table. */
|
// Run the Lua expression. It should return a table.
|
||||||
m_pLuaTable->SetFromExpression( sLuaFunction );
|
m_pLuaTable->SetFromExpression( sLuaFunction );
|
||||||
|
|
||||||
if( m_pLuaTable->GetLuaType() != LUA_TTABLE )
|
if( m_pLuaTable->GetLuaType() != LUA_TTABLE )
|
||||||
@@ -857,19 +858,16 @@ public:
|
|||||||
m_Def.m_sName = pStr;
|
m_Def.m_sName = pStr;
|
||||||
lua_pop( L, 1 );
|
lua_pop( L, 1 );
|
||||||
|
|
||||||
|
|
||||||
lua_pushstring( L, "OneChoiceForAllPlayers" );
|
lua_pushstring( L, "OneChoiceForAllPlayers" );
|
||||||
lua_gettable( L, -2 );
|
lua_gettable( L, -2 );
|
||||||
m_Def.m_bOneChoiceForAllPlayers = !!lua_toboolean( L, -1 );
|
m_Def.m_bOneChoiceForAllPlayers = !!lua_toboolean( L, -1 );
|
||||||
lua_pop( L, 1 );
|
lua_pop( L, 1 );
|
||||||
|
|
||||||
|
|
||||||
lua_pushstring( L, "ExportOnChange" );
|
lua_pushstring( L, "ExportOnChange" );
|
||||||
lua_gettable( L, -2 );
|
lua_gettable( L, -2 );
|
||||||
m_Def.m_bExportOnChange = !!lua_toboolean( L, -1 );
|
m_Def.m_bExportOnChange = !!lua_toboolean( L, -1 );
|
||||||
lua_pop( L, 1 );
|
lua_pop( L, 1 );
|
||||||
|
|
||||||
|
|
||||||
lua_pushstring( L, "LayoutType" );
|
lua_pushstring( L, "LayoutType" );
|
||||||
lua_gettable( L, -2 );
|
lua_gettable( L, -2 );
|
||||||
pStr = lua_tostring( L, -1 );
|
pStr = lua_tostring( L, -1 );
|
||||||
@@ -879,7 +877,6 @@ public:
|
|||||||
ASSERT( m_Def.m_layoutType != LayoutType_Invalid );
|
ASSERT( m_Def.m_layoutType != LayoutType_Invalid );
|
||||||
lua_pop( L, 1 );
|
lua_pop( L, 1 );
|
||||||
|
|
||||||
|
|
||||||
lua_pushstring( L, "SelectType" );
|
lua_pushstring( L, "SelectType" );
|
||||||
lua_gettable( L, -2 );
|
lua_gettable( L, -2 );
|
||||||
pStr = lua_tostring( L, -1 );
|
pStr = lua_tostring( L, -1 );
|
||||||
@@ -889,8 +886,7 @@ public:
|
|||||||
ASSERT( m_Def.m_selectType != SelectType_Invalid );
|
ASSERT( m_Def.m_selectType != SelectType_Invalid );
|
||||||
lua_pop( L, 1 );
|
lua_pop( L, 1 );
|
||||||
|
|
||||||
|
// Iterate over the "Choices" table.
|
||||||
/* Iterate over the "Choices" table. */
|
|
||||||
lua_pushstring( L, "Choices" );
|
lua_pushstring( L, "Choices" );
|
||||||
lua_gettable( L, -2 );
|
lua_gettable( L, -2 );
|
||||||
if( !lua_istable( L, -1 ) )
|
if( !lua_istable( L, -1 ) )
|
||||||
@@ -899,7 +895,7 @@ public:
|
|||||||
lua_pushnil( L );
|
lua_pushnil( L );
|
||||||
while( lua_next(L, -2) != 0 )
|
while( lua_next(L, -2) != 0 )
|
||||||
{
|
{
|
||||||
/* `key' is at index -2 and `value' at index -1 */
|
// `key' is at index -2 and `value' at index -1
|
||||||
const char *pValue = lua_tostring( L, -1 );
|
const char *pValue = lua_tostring( L, -1 );
|
||||||
if( pValue == NULL )
|
if( pValue == NULL )
|
||||||
RageException::Throw( "\"%s\" Column entry is not a string.", sLuaFunction.c_str() );
|
RageException::Throw( "\"%s\" Column entry is not a string.", sLuaFunction.c_str() );
|
||||||
@@ -907,13 +903,12 @@ public:
|
|||||||
|
|
||||||
m_Def.m_vsChoices.push_back( pValue );
|
m_Def.m_vsChoices.push_back( pValue );
|
||||||
|
|
||||||
lua_pop( L, 1 ); /* removes `value'; keeps `key' for next iteration */
|
lua_pop( L, 1 ); // removes `value'; keeps `key' for next iteration
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_pop( L, 1 ); /* pop choices table */
|
lua_pop( L, 1 ); // pop choices table
|
||||||
|
|
||||||
|
// Set the EnabledForPlayers function.
|
||||||
/* Set the EnabledForPlayers function. */
|
|
||||||
lua_pushstring( L, "EnabledForPlayers" );
|
lua_pushstring( L, "EnabledForPlayers" );
|
||||||
lua_gettable( L, -2 );
|
lua_gettable( L, -2 );
|
||||||
if( !lua_isfunction( L, -1 ) && !lua_isnil( L, -1 ) )
|
if( !lua_isfunction( L, -1 ) && !lua_isnil( L, -1 ) )
|
||||||
@@ -921,7 +916,7 @@ public:
|
|||||||
m_EnabledForPlayersFunc.SetFromStack( L );
|
m_EnabledForPlayersFunc.SetFromStack( L );
|
||||||
SetEnabledForPlayers();
|
SetEnabledForPlayers();
|
||||||
|
|
||||||
/* Iterate over the "ReloadRowMessages" table. */
|
// Iterate over the "ReloadRowMessages" table.
|
||||||
lua_pushstring( L, "ReloadRowMessages" );
|
lua_pushstring( L, "ReloadRowMessages" );
|
||||||
lua_gettable( L, -2 );
|
lua_gettable( L, -2 );
|
||||||
if( !lua_isnil( L, -1 ) )
|
if( !lua_isnil( L, -1 ) )
|
||||||
@@ -932,7 +927,7 @@ public:
|
|||||||
lua_pushnil( L );
|
lua_pushnil( L );
|
||||||
while( lua_next(L, -2) != 0 )
|
while( lua_next(L, -2) != 0 )
|
||||||
{
|
{
|
||||||
/* `key' is at index -2 and `value' at index -1 */
|
// `key' is at index -2 and `value' at index -1
|
||||||
const char *pValue = lua_tostring( L, -1 );
|
const char *pValue = lua_tostring( L, -1 );
|
||||||
if( pValue == NULL )
|
if( pValue == NULL )
|
||||||
RageException::Throw( "\"%s\" Column entry is not a string.", sLuaFunction.c_str() );
|
RageException::Throw( "\"%s\" Column entry is not a string.", sLuaFunction.c_str() );
|
||||||
@@ -940,23 +935,21 @@ public:
|
|||||||
|
|
||||||
m_vsReloadRowMessages.push_back( pValue );
|
m_vsReloadRowMessages.push_back( pValue );
|
||||||
|
|
||||||
lua_pop( L, 1 ); /* removes `value'; keeps `key' for next iteration */
|
lua_pop( L, 1 ); // removes `value'; keeps `key' for next iteration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lua_pop( L, 1 ); /* pop ReloadRowMessages table */
|
lua_pop( L, 1 ); // pop ReloadRowMessages table
|
||||||
|
|
||||||
|
// Look for "ExportOnChange" value.
|
||||||
/* Look for "ExportOnChange" value. */
|
|
||||||
lua_pushstring( L, "ExportOnChange" );
|
lua_pushstring( L, "ExportOnChange" );
|
||||||
lua_gettable( L, -2 );
|
lua_gettable( L, -2 );
|
||||||
if( !lua_isnil( L, -1 ) )
|
if( !lua_isnil( L, -1 ) )
|
||||||
{
|
{
|
||||||
m_Def.m_bExportOnChange = !!MyLua_checkboolean( L, -1 );
|
m_Def.m_bExportOnChange = !!MyLua_checkboolean( L, -1 );
|
||||||
}
|
}
|
||||||
lua_pop( L, 1 ); /* pop ExportOnChange value */
|
lua_pop( L, 1 ); // pop ExportOnChange value
|
||||||
|
|
||||||
|
lua_pop( L, 1 ); // pop main table
|
||||||
lua_pop( L, 1 ); /* pop main table */
|
|
||||||
ASSERT( lua_gettop(L) == 0 );
|
ASSERT( lua_gettop(L) == 0 );
|
||||||
|
|
||||||
LUA->Release(L);
|
LUA->Release(L);
|
||||||
@@ -979,18 +972,18 @@ public:
|
|||||||
PlayerNumber p = *pn;
|
PlayerNumber p = *pn;
|
||||||
vector<bool> &vbSelOut = vbSelectedOut[p];
|
vector<bool> &vbSelOut = vbSelectedOut[p];
|
||||||
|
|
||||||
/* Evaluate the LoadSelections(self,array,pn) function, where array is a table
|
/* Evaluate the LoadSelections(self,array,pn) function, where
|
||||||
* representing vbSelectedOut. */
|
* array is a table representing vbSelectedOut. */
|
||||||
|
|
||||||
/* All selections default to false. */
|
// All selections default to false.
|
||||||
for( unsigned i = 0; i < vbSelOut.size(); ++i )
|
for( unsigned i = 0; i < vbSelOut.size(); ++i )
|
||||||
vbSelOut[i] = false;
|
vbSelOut[i] = false;
|
||||||
|
|
||||||
/* Create the vbSelectedOut table. */
|
// Create the vbSelectedOut table
|
||||||
LuaHelpers::CreateTableFromArrayB( L, vbSelOut );
|
LuaHelpers::CreateTableFromArrayB( L, vbSelOut );
|
||||||
ASSERT( lua_gettop(L) == 1 ); /* vbSelectedOut table */
|
ASSERT( lua_gettop(L) == 1 ); // vbSelectedOut table
|
||||||
|
|
||||||
/* Get the function to call from m_LuaTable. */
|
// Get the function to call from m_LuaTable.
|
||||||
m_pLuaTable->PushSelf( L );
|
m_pLuaTable->PushSelf( L );
|
||||||
ASSERT( lua_istable( L, -1 ) );
|
ASSERT( lua_istable( L, -1 ) );
|
||||||
|
|
||||||
@@ -999,25 +992,25 @@ public:
|
|||||||
if( !lua_isfunction( L, -1 ) )
|
if( !lua_isfunction( L, -1 ) )
|
||||||
RageException::Throw( "\"%s\" \"LoadSelections\" entry is not a function.", m_Def.m_sName.c_str() );
|
RageException::Throw( "\"%s\" \"LoadSelections\" entry is not a function.", m_Def.m_sName.c_str() );
|
||||||
|
|
||||||
/* Argument 1 (self): */
|
// Argument 1 (self):
|
||||||
m_pLuaTable->PushSelf( L );
|
m_pLuaTable->PushSelf( L );
|
||||||
|
|
||||||
/* Argument 2 (vbSelectedOut): */
|
// Argument 2 (vbSelectedOut):
|
||||||
lua_pushvalue( L, 1 );
|
lua_pushvalue( L, 1 );
|
||||||
|
|
||||||
/* Argument 3 (pn): */
|
// Argument 3 (pn):
|
||||||
LuaHelpers::Push( L, p );
|
LuaHelpers::Push( L, p );
|
||||||
|
|
||||||
ASSERT( lua_gettop(L) == 6 ); /* vbSelectedOut, m_iLuaTable, function, self, arg, arg */
|
ASSERT( lua_gettop(L) == 6 ); // vbSelectedOut, m_iLuaTable, function, self, arg, arg
|
||||||
|
|
||||||
lua_call( L, 3, 0 ); // call function with 3 arguments and 0 results
|
lua_call( L, 3, 0 ); // call function with 3 arguments and 0 results
|
||||||
ASSERT( lua_gettop(L) == 2 );
|
ASSERT( lua_gettop(L) == 2 );
|
||||||
|
|
||||||
lua_pop( L, 1 ); /* pop option table */
|
lua_pop( L, 1 ); // pop option table
|
||||||
|
|
||||||
LuaHelpers::ReadArrayFromTableB( L, vbSelOut );
|
LuaHelpers::ReadArrayFromTableB( L, vbSelOut );
|
||||||
|
|
||||||
lua_pop( L, 1 ); /* pop vbSelectedOut table */
|
lua_pop( L, 1 ); // pop vbSelectedOut table
|
||||||
|
|
||||||
ASSERT( lua_gettop(L) == 0 );
|
ASSERT( lua_gettop(L) == 0 );
|
||||||
}
|
}
|
||||||
@@ -1040,11 +1033,11 @@ public:
|
|||||||
|
|
||||||
vector<bool> vbSelectedCopy = vbSel;
|
vector<bool> vbSelectedCopy = vbSel;
|
||||||
|
|
||||||
/* Create the vbSelectedOut table. */
|
// Create the vbSelectedOut table.
|
||||||
LuaHelpers::CreateTableFromArrayB( L, vbSelectedCopy );
|
LuaHelpers::CreateTableFromArrayB( L, vbSelectedCopy );
|
||||||
ASSERT( lua_gettop(L) == 1 ); /* vbSelectedOut table */
|
ASSERT( lua_gettop(L) == 1 ); // vbSelectedOut table
|
||||||
|
|
||||||
/* Get the function to call. */
|
// Get the function to call.
|
||||||
m_pLuaTable->PushSelf( L );
|
m_pLuaTable->PushSelf( L );
|
||||||
ASSERT( lua_istable( L, -1 ) );
|
ASSERT( lua_istable( L, -1 ) );
|
||||||
|
|
||||||
@@ -1053,22 +1046,22 @@ public:
|
|||||||
if( !lua_isfunction( L, -1 ) )
|
if( !lua_isfunction( L, -1 ) )
|
||||||
RageException::Throw( "\"%s\" \"SaveSelections\" entry is not a function.", m_Def.m_sName.c_str() );
|
RageException::Throw( "\"%s\" \"SaveSelections\" entry is not a function.", m_Def.m_sName.c_str() );
|
||||||
|
|
||||||
/* Argument 1 (self): */
|
// Argument 1 (self):
|
||||||
m_pLuaTable->PushSelf( L );
|
m_pLuaTable->PushSelf( L );
|
||||||
|
|
||||||
/* Argument 2 (vbSelectedOut): */
|
// Argument 2 (vbSelectedOut):
|
||||||
lua_pushvalue( L, 1 );
|
lua_pushvalue( L, 1 );
|
||||||
|
|
||||||
/* Argument 3 (pn): */
|
// Argument 3 (pn):
|
||||||
LuaHelpers::Push( L, p );
|
LuaHelpers::Push( L, p );
|
||||||
|
|
||||||
ASSERT( lua_gettop(L) == 6 ); /* vbSelectedOut, m_iLuaTable, function, self, arg, arg */
|
ASSERT( lua_gettop(L) == 6 ); // vbSelectedOut, m_iLuaTable, function, self, arg, arg
|
||||||
|
|
||||||
lua_call( L, 3, 0 ); // call function with 3 arguments and 0 results
|
lua_call( L, 3, 0 ); // call function with 3 arguments and 0 results
|
||||||
ASSERT( lua_gettop(L) == 2 );
|
ASSERT( lua_gettop(L) == 2 );
|
||||||
|
|
||||||
lua_pop( L, 1 ); /* pop option table */
|
lua_pop( L, 1 ); // pop option table
|
||||||
lua_pop( L, 1 ); /* pop vbSelected table */
|
lua_pop( L, 1 ); // pop vbSelected table
|
||||||
|
|
||||||
ASSERT( lua_gettop(L) == 0 );
|
ASSERT( lua_gettop(L) == 0 );
|
||||||
}
|
}
|
||||||
@@ -1309,7 +1302,6 @@ public:
|
|||||||
OptionRowHandlerNull() { Init(); }
|
OptionRowHandlerNull() { Init(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
OptionRowHandler* OptionRowHandlerUtil::Make( const Commands &cmds )
|
OptionRowHandler* OptionRowHandlerUtil::Make( const Commands &cmds )
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public:
|
|||||||
|
|
||||||
virtual int GetDefaultOption() const { return -1; }
|
virtual int GetDefaultOption() const { return -1; }
|
||||||
virtual void ImportOption( OptionRow *pRow, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const { }
|
virtual void ImportOption( OptionRow *pRow, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const { }
|
||||||
/* Returns an OPT mask. */
|
// Returns an OPT mask.
|
||||||
virtual int ExportOption( const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const { return 0; }
|
virtual int ExportOption( const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const { return 0; }
|
||||||
virtual void GetIconTextAndGameCommand( int iFirstSelection, RString &sIconTextOut, GameCommand &gcOut ) const;
|
virtual void GetIconTextAndGameCommand( int iFirstSelection, RString &sIconTextOut, GameCommand &gcOut ) const;
|
||||||
virtual RString GetScreen( int iChoice ) const { return RString(); }
|
virtual RString GetScreen( int iChoice ) const { return RString(); }
|
||||||
|
|||||||
+4
-4
@@ -51,16 +51,16 @@ public:
|
|||||||
|
|
||||||
void Link( OptionsList *pLink ) { m_pLinked = pLink; }
|
void Link( OptionsList *pLink ) { m_pLinked = pLink; }
|
||||||
|
|
||||||
/* Show the top-level menu. */
|
// Show the top-level menu.
|
||||||
void Open();
|
void Open();
|
||||||
|
|
||||||
/* Close all menus (for menu timer). */
|
// Close all menus (for menu timer).
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
void Input( const InputEventPlus &input );
|
void Input( const InputEventPlus &input );
|
||||||
bool IsOpened() const { return m_asMenuStack.size() > 0; }
|
bool IsOpened() const { return m_asMenuStack.size() > 0; }
|
||||||
|
|
||||||
bool Start(); /* return true if the last menu was popped in response to this press */
|
bool Start(); // return true if the last menu was popped in response to this press
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ThemeMetric<RString> TOP_MENU;
|
ThemeMetric<RString> TOP_MENU;
|
||||||
@@ -94,7 +94,7 @@ private:
|
|||||||
map<RString, OptionRowHandler *> m_Rows;
|
map<RString, OptionRowHandler *> m_Rows;
|
||||||
map<RString, vector<bool> > m_bSelections;
|
map<RString, vector<bool> > m_bSelections;
|
||||||
set<RString> m_setDirectRows;
|
set<RString> m_setDirectRows;
|
||||||
set<RString> m_setTopMenus; /* list of top-level menus, pointing to submenus */
|
set<RString> m_setTopMenus; // list of top-level menus, pointing to submenus
|
||||||
|
|
||||||
PlayerNumber m_pn;
|
PlayerNumber m_pn;
|
||||||
AutoActor m_Cursor;
|
AutoActor m_Cursor;
|
||||||
|
|||||||
+10
-5
@@ -132,6 +132,7 @@ ThemeMetric<bool> PENALIZE_TAP_SCORE_NONE ( "Player", "PenalizeTapScoreNone" );
|
|||||||
ThemeMetric<bool> JUDGE_HOLD_NOTES_ON_SAME_ROW_TOGETHER ( "Player", "JudgeHoldNotesOnSameRowTogether" );
|
ThemeMetric<bool> JUDGE_HOLD_NOTES_ON_SAME_ROW_TOGETHER ( "Player", "JudgeHoldNotesOnSameRowTogether" );
|
||||||
ThemeMetric<bool> HOLD_CHECKPOINTS ( "Player", "HoldCheckpoints" );
|
ThemeMetric<bool> HOLD_CHECKPOINTS ( "Player", "HoldCheckpoints" );
|
||||||
ThemeMetric<bool> CHECKPOINTS_USE_TIME_SIGNATURES ( "Player", "CheckpointsUseTimeSignatures" );
|
ThemeMetric<bool> CHECKPOINTS_USE_TIME_SIGNATURES ( "Player", "CheckpointsUseTimeSignatures" );
|
||||||
|
ThemeMetric<bool> CHECKPOINTS_FLASH_ON_HOLD ( "Player", "CheckpointsFlashOnHold" ); // sm-ssc addition
|
||||||
ThemeMetric<bool> IMMEDIATE_HOLD_LET_GO ( "Player", "ImmediateHoldLetGo" );
|
ThemeMetric<bool> IMMEDIATE_HOLD_LET_GO ( "Player", "ImmediateHoldLetGo" );
|
||||||
ThemeMetric<bool> REQUIRE_STEP_ON_HOLD_HEADS ( "Player", "RequireStepOnHoldHeads" );
|
ThemeMetric<bool> REQUIRE_STEP_ON_HOLD_HEADS ( "Player", "RequireStepOnHoldHeads" );
|
||||||
//ThemeMetric<bool> REQUIRE_STEP_ON_TAP_NOTES ( "Player", "RequireStepOnTapNotes" ); // parastar stuff; leave in though
|
//ThemeMetric<bool> REQUIRE_STEP_ON_TAP_NOTES ( "Player", "RequireStepOnTapNotes" ); // parastar stuff; leave in though
|
||||||
@@ -2064,7 +2065,7 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b
|
|||||||
goto done_checking_hopo;
|
goto done_checking_hopo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// can't hopo on the same note 2x in a row
|
// con't hopo on the same note 2x in a row
|
||||||
if( col == m_pPlayerState->m_iLastHopoNoteCol )
|
if( col == m_pPlayerState->m_iLastHopoNoteCol )
|
||||||
{
|
{
|
||||||
bDidHopo = false;
|
bDidHopo = false;
|
||||||
@@ -2834,11 +2835,15 @@ void Player::HandleHoldCheckpoint( int iRow, int iNumHoldsHeldThisRow, int iNumH
|
|||||||
|
|
||||||
if( iNumHoldsMissedThisRow == 0 )
|
if( iNumHoldsMissedThisRow == 0 )
|
||||||
{
|
{
|
||||||
FOREACH_CONST( int, viColsWithHold, i )
|
// added for http://ssc.ajworld.net/sm-ssc/bugtracker/view.php?id=16 -aj
|
||||||
|
if( CHECKPOINTS_FLASH_ON_HOLD )
|
||||||
{
|
{
|
||||||
bool bBright = m_pPlayerStageStats && m_pPlayerStageStats->m_iCurCombo>(int)BRIGHT_GHOST_COMBO_THRESHOLD;
|
FOREACH_CONST( int, viColsWithHold, i )
|
||||||
if( m_pNoteField )
|
{
|
||||||
m_pNoteField->DidHoldNote( *i, HNS_Held, bBright );
|
bool bBright = m_pPlayerStageStats && m_pPlayerStageStats->m_iCurCombo>(int)BRIGHT_GHOST_COMBO_THRESHOLD;
|
||||||
|
if( m_pNoteField )
|
||||||
|
m_pNoteField->DidHoldNote( *i, HNS_Held, bBright );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -156,7 +156,7 @@ void Screen::Update( float fDeltaTime )
|
|||||||
CHECKPOINT_M( ssprintf("ScreenMessage(%s)", ScreenMessageHelpers::ScreenMessageToString(SM).c_str()) );
|
CHECKPOINT_M( ssprintf("ScreenMessage(%s)", ScreenMessageHelpers::ScreenMessageToString(SM).c_str()) );
|
||||||
this->HandleScreenMessage( SM );
|
this->HandleScreenMessage( SM );
|
||||||
|
|
||||||
/* If the size changed, start over. */
|
// If the size changed, start over.
|
||||||
if( iSize != m_QueuedMessages.size() )
|
if( iSize != m_QueuedMessages.size() )
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
@@ -177,12 +177,12 @@ void Screen::Input( const InputEventPlus &input )
|
|||||||
if( m_Codes.InputMessage(input, msg) )
|
if( m_Codes.InputMessage(input, msg) )
|
||||||
this->HandleMessage( msg );
|
this->HandleMessage( msg );
|
||||||
|
|
||||||
/* Don't send release messages with the default handler. */
|
// Don't send release messages with the default handler.
|
||||||
switch( input.type )
|
switch( input.type )
|
||||||
{
|
{
|
||||||
case IET_FIRST_PRESS:
|
case IET_FIRST_PRESS:
|
||||||
case IET_REPEAT:
|
case IET_REPEAT:
|
||||||
break; /* OK */
|
break; // OK
|
||||||
default:
|
default:
|
||||||
return; // don't care
|
return; // don't care
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ void Screen::Input( const InputEventPlus &input )
|
|||||||
case GAME_BUTTON_MENULEFT: this->MenuLeft ( input ); return;
|
case GAME_BUTTON_MENULEFT: this->MenuLeft ( input ); return;
|
||||||
case GAME_BUTTON_MENURIGHT: this->MenuRight ( input ); return;
|
case GAME_BUTTON_MENURIGHT: this->MenuRight ( input ); return;
|
||||||
case GAME_BUTTON_BACK:
|
case GAME_BUTTON_BACK:
|
||||||
/* Don't make the user hold the back button if they're pressing escape and escape is the back button. */
|
// Don't make the user hold the back button if they're pressing escape and escape is the back button.
|
||||||
if( !PREFSMAN->m_bDelayedBack || input.type==IET_REPEAT || (input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_ESC) )
|
if( !PREFSMAN->m_bDelayedBack || input.type==IET_REPEAT || (input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_ESC) )
|
||||||
this->MenuBack( input );
|
this->MenuBack( input );
|
||||||
return;
|
return;
|
||||||
|
|||||||
+4
-4
@@ -40,10 +40,10 @@ public:
|
|||||||
* derived classes exist. (Don't call it directly; use InitScreen.) */
|
* derived classes exist. (Don't call it directly; use InitScreen.) */
|
||||||
virtual void Init();
|
virtual void Init();
|
||||||
|
|
||||||
/* This is called immediately before the screen is used. */
|
// This is called immediately before the screen is used.
|
||||||
virtual void BeginScreen();
|
virtual void BeginScreen();
|
||||||
|
|
||||||
/* This is called when the screen is popped. */
|
// This is called when the screen is popped.
|
||||||
virtual void EndScreen();
|
virtual void EndScreen();
|
||||||
|
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
@@ -83,9 +83,9 @@ protected:
|
|||||||
RString m_sNextScreen;
|
RString m_sNextScreen;
|
||||||
ScreenMessage m_smSendOnPop;
|
ScreenMessage m_smSendOnPop;
|
||||||
|
|
||||||
float m_fLockInputSecs;
|
float m_fLockInputSecs;
|
||||||
|
|
||||||
/* If currently between BeginScreen/EndScreen calls: */
|
// If currently between BeginScreen/EndScreen calls:
|
||||||
bool m_bRunning;
|
bool m_bRunning;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -474,6 +474,7 @@ void ScreenGameplay::Init()
|
|||||||
|
|
||||||
pi->m_pPlayer->SetX( fPlayerX );
|
pi->m_pPlayer->SetX( fPlayerX );
|
||||||
pi->m_pPlayer->RunCommands( PLAYER_INIT_COMMAND );
|
pi->m_pPlayer->RunCommands( PLAYER_INIT_COMMAND );
|
||||||
|
//ActorUtil::LoadAllCommands(pi->m_pPlayer, m_sName);
|
||||||
this->AddChild( pi->m_pPlayer );
|
this->AddChild( pi->m_pPlayer );
|
||||||
pi->m_pPlayer->PlayCommand( "On" );
|
pi->m_pPlayer->PlayCommand( "On" );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ void ScreenNetEvaluation::RedoUserTexts()
|
|||||||
{
|
{
|
||||||
m_iActivePlayers = NSMAN->m_ActivePlayers;
|
m_iActivePlayers = NSMAN->m_ActivePlayers;
|
||||||
|
|
||||||
//If unnecessary, just don't do this function.
|
// If unnecessary, just don't do this function.
|
||||||
if ( m_iActivePlayers == (int)m_textUsers.size() )
|
if ( m_iActivePlayers == (int)m_textUsers.size() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ void ScreenNetEvaluation::RedoUserTexts()
|
|||||||
for( int i=0; i<m_iActivePlayers; ++i )
|
for( int i=0; i<m_iActivePlayers; ++i )
|
||||||
{
|
{
|
||||||
m_textUsers[i].LoadFromFont( THEME->GetPathF(m_sName,"names") );
|
m_textUsers[i].LoadFromFont( THEME->GetPathF(m_sName,"names") );
|
||||||
m_textUsers[i].SetName( "User" );
|
m_textUsers[i].SetName( ssprintf("User") );
|
||||||
m_textUsers[i].SetShadowLength( 1 );
|
m_textUsers[i].SetShadowLength( 1 );
|
||||||
m_textUsers[i].SetXY( cx, cy );
|
m_textUsers[i].SetXY( cx, cy );
|
||||||
|
|
||||||
@@ -150,10 +150,12 @@ void ScreenNetEvaluation::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
m_textUsers[i].SetText( NSMAN->m_PlayerNames[NSMAN->m_EvalPlayerData[i].name] );
|
m_textUsers[i].SetText( NSMAN->m_PlayerNames[NSMAN->m_EvalPlayerData[i].name] );
|
||||||
if ( NSMAN->m_EvalPlayerData[i].grade < Grade_Tier03 ) //Yes, hardcoded (I'd like to leave it that way)
|
// Yes, hardcoded (I'd like to leave it that way) -CNLohr (in reference to Grade_Tier03)
|
||||||
m_textUsers[i].SetRainbowScroll( true );
|
// Themes can read this differently. The correct solution depends...
|
||||||
else
|
// TODO: make this a server-side variable, or just find out
|
||||||
m_textUsers[i].SetRainbowScroll( false );
|
// the data from the theme? If we find out from the theme, people
|
||||||
|
// will be using different themes so it means nothing. -aj
|
||||||
|
m_textUsers[i].SetRainbowScroll( NSMAN->m_EvalPlayerData[i].grade < Grade_Tier03 );
|
||||||
ON_COMMAND( m_textUsers[i] );
|
ON_COMMAND( m_textUsers[i] );
|
||||||
LOG->Trace( "SMNETCheckpoint%d", i );
|
LOG->Trace( "SMNETCheckpoint%d", i );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ static const char *PromptAnswerNames[] = {
|
|||||||
};
|
};
|
||||||
XToString( PromptAnswer );
|
XToString( PromptAnswer );
|
||||||
|
|
||||||
/* Settings: */
|
// Settings:
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
RString g_sText;
|
RString g_sText;
|
||||||
|
|||||||
+2
-4
@@ -26,10 +26,10 @@ public:
|
|||||||
|
|
||||||
void UpdateAnimationState(); // take m_fSecondsIntoState, and move to a new state
|
void UpdateAnimationState(); // take m_fSecondsIntoState, and move to a new state
|
||||||
|
|
||||||
/* Adjust texture properties for song backgrounds. */
|
// Adjust texture properties for song backgrounds.
|
||||||
static RageTextureID SongBGTexture( RageTextureID ID );
|
static RageTextureID SongBGTexture( RageTextureID ID );
|
||||||
|
|
||||||
/* Adjust texture properties for song banners. */
|
// Adjust texture properties for song banners.
|
||||||
static RageTextureID SongBannerTexture( RageTextureID ID );
|
static RageTextureID SongBannerTexture( RageTextureID ID );
|
||||||
|
|
||||||
virtual void Load( RageTextureID ID );
|
virtual void Load( RageTextureID ID );
|
||||||
@@ -67,9 +67,7 @@ public:
|
|||||||
void CropTo( float fWidth, float fHeight );
|
void CropTo( float fWidth, float fHeight );
|
||||||
static bool IsDiagonalBanner( int iWidth, int iHeight );
|
static bool IsDiagonalBanner( int iWidth, int iHeight );
|
||||||
|
|
||||||
//
|
|
||||||
// Commands
|
// Commands
|
||||||
//
|
|
||||||
virtual void PushSelf( lua_State *L );
|
virtual void PushSelf( lua_State *L );
|
||||||
|
|
||||||
void SetAllStateDelays(float fDelay);
|
void SetAllStateDelays(float fDelay);
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ private:
|
|||||||
StageStats m_AccumPlayedStageStats;
|
StageStats m_AccumPlayedStageStats;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern StatsManager* STATSMAN; // global and accessable from anywhere in our program
|
extern StatsManager* STATSMAN; // global and accessable from anywhere in our program
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -67,12 +67,11 @@ static void CheckForDirectInputDebugMode()
|
|||||||
if( RegistryAccess::GetRegValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\DirectInput", "emulation", iVal) )
|
if( RegistryAccess::GetRegValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\DirectInput", "emulation", iVal) )
|
||||||
{
|
{
|
||||||
if( iVal & 0x8 )
|
if( iVal & 0x8 )
|
||||||
LOG->Warn("DirectInput keyboard debug mode appears to be enabled. This reduces\n"
|
LOG->Warn("DirectInput keyboard debug mode appears to be enabled. This reduces\n"
|
||||||
"input timing accuracy significantly. Disabling this is strongly recommended." );
|
"input timing accuracy significantly. Disabling this is strongly recommended." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL CALLBACK CountDevicesCallback( const DIDEVICEINSTANCE *pdidInstance, void *pContext )
|
static BOOL CALLBACK CountDevicesCallback( const DIDEVICEINSTANCE *pdidInstance, void *pContext )
|
||||||
{
|
{
|
||||||
(*(int*)pContext)++;
|
(*(int*)pContext)++;
|
||||||
@@ -194,7 +193,7 @@ InputHandler_DInput::~InputHandler_DInput()
|
|||||||
|
|
||||||
void InputHandler_DInput::WindowReset()
|
void InputHandler_DInput::WindowReset()
|
||||||
{
|
{
|
||||||
/* We need to reopen keyboards. */
|
// We need to reopen keyboards.
|
||||||
ShutdownThread();
|
ShutdownThread();
|
||||||
|
|
||||||
for( unsigned i = 0; i < Devices.size(); ++i )
|
for( unsigned i = 0; i < Devices.size(); ++i )
|
||||||
@@ -204,12 +203,12 @@ void InputHandler_DInput::WindowReset()
|
|||||||
|
|
||||||
Devices[i].Close();
|
Devices[i].Close();
|
||||||
|
|
||||||
/* We lose buffered inputs here, so we need to clear all pressed keys. */
|
// We lose buffered inputs here, so we need to clear all pressed keys.
|
||||||
INPUTFILTER->ResetDevice( Devices[i].dev );
|
INPUTFILTER->ResetDevice( Devices[i].dev );
|
||||||
|
|
||||||
bool ret = Devices[i].Open();
|
bool ret = Devices[i].Open();
|
||||||
|
|
||||||
/* Reopening it should succeed. */
|
// Reopening it should succeed.
|
||||||
ASSERT( ret );
|
ASSERT( ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +408,7 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
|
|||||||
|
|
||||||
if( GetForegroundWindow() != GraphicsWindow::GetHwnd() )
|
if( GetForegroundWindow() != GraphicsWindow::GetHwnd() )
|
||||||
{
|
{
|
||||||
/* Discard input when not focused, and release all keys. */
|
// Discard input when not focused, and release all keys.
|
||||||
INPUTFILTER->ResetDevice( device.dev );
|
INPUTFILTER->ResetDevice( device.dev );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -426,74 +425,74 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
|
|||||||
|
|
||||||
switch( in.type )
|
switch( in.type )
|
||||||
{
|
{
|
||||||
case in.KEY:
|
case in.KEY:
|
||||||
/*
|
|
||||||
switch( in.num )
|
|
||||||
{
|
|
||||||
// "Joystick with Keyboard" hack
|
|
||||||
case 115: //s
|
|
||||||
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_UP, !!(evtbuf[i].dwData & 0x80), tm) );
|
|
||||||
break;
|
|
||||||
case 120: //x
|
|
||||||
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_DOWN, !!(evtbuf[i].dwData & 0x80), tm) );
|
|
||||||
break;
|
|
||||||
case 122: //z
|
|
||||||
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_LEFT, !!(evtbuf[i].dwData & 0x80), tm) );
|
|
||||||
break;
|
|
||||||
case 99: //c
|
|
||||||
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_RIGHT, !!(evtbuf[i].dwData & 0x80), tm) );
|
|
||||||
break;
|
|
||||||
case 100: //d
|
|
||||||
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_BUTTON_1, !!(evtbuf[i].dwData & 0x80), tm) );
|
|
||||||
break;
|
|
||||||
case 101: //e
|
|
||||||
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_BUTTON_2, !!(evtbuf[i].dwData & 0x80), tm) );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
*/
|
|
||||||
ButtonPressed( DeviceInput(dev, (DeviceButton) in.num, !!(evtbuf[i].dwData & 0x80), tm) );
|
|
||||||
/*
|
/*
|
||||||
|
switch( in.num )
|
||||||
|
{
|
||||||
|
// "Joystick with Keyboard" hack
|
||||||
|
case 115: //s
|
||||||
|
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_UP, !!(evtbuf[i].dwData & 0x80), tm) );
|
||||||
|
break;
|
||||||
|
case 120: //x
|
||||||
|
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_DOWN, !!(evtbuf[i].dwData & 0x80), tm) );
|
||||||
|
break;
|
||||||
|
case 122: //z
|
||||||
|
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_LEFT, !!(evtbuf[i].dwData & 0x80), tm) );
|
||||||
|
break;
|
||||||
|
case 99: //c
|
||||||
|
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_RIGHT, !!(evtbuf[i].dwData & 0x80), tm) );
|
||||||
|
break;
|
||||||
|
case 100: //d
|
||||||
|
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_BUTTON_1, !!(evtbuf[i].dwData & 0x80), tm) );
|
||||||
|
break;
|
||||||
|
case 101: //e
|
||||||
|
ButtonPressed( DeviceInput(DEVICE_JOY1, JOY_BUTTON_2, !!(evtbuf[i].dwData & 0x80), tm) );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
*/
|
||||||
|
ButtonPressed( DeviceInput(dev, (DeviceButton) in.num, !!(evtbuf[i].dwData & 0x80), tm) );
|
||||||
|
/*
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
|
||||||
|
case in.BUTTON:
|
||||||
|
ButtonPressed( DeviceInput(dev, enum_add2(JOY_BUTTON_1, in.num), !!evtbuf[i].dwData, tm) );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case in.AXIS:
|
||||||
|
{
|
||||||
|
DeviceButton up = DeviceButton_Invalid, down = DeviceButton_Invalid;
|
||||||
|
switch(in.ofs)
|
||||||
|
{
|
||||||
|
case DIJOFS_X: up = JOY_LEFT; down = JOY_RIGHT; break;
|
||||||
|
case DIJOFS_Y: up = JOY_UP; down = JOY_DOWN; break;
|
||||||
|
case DIJOFS_Z: up = JOY_Z_UP; down = JOY_Z_DOWN; break;
|
||||||
|
case DIJOFS_RX: up = JOY_ROT_UP; down = JOY_ROT_DOWN; break;
|
||||||
|
case DIJOFS_RY: up = JOY_ROT_LEFT; down = JOY_ROT_RIGHT; break;
|
||||||
|
case DIJOFS_RZ: up = JOY_ROT_Z_UP; down = JOY_ROT_Z_DOWN; break;
|
||||||
|
case DIJOFS_SLIDER(0): up = JOY_AUX_1; down = JOY_AUX_2; break;
|
||||||
|
case DIJOFS_SLIDER(1): up = JOY_AUX_3; down = JOY_AUX_4; break;
|
||||||
|
default: LOG->MapLog( "unknown input",
|
||||||
|
"Controller '%s' is returning an unknown joystick offset, %i",
|
||||||
|
device.m_sName.c_str(), in.ofs );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
float l = SCALE( int(evtbuf[i].dwData), 0.0f, 100.0f, 0.0f, 1.0f );
|
||||||
|
ButtonPressed( DeviceInput(dev, up, max(-l,0), tm) );
|
||||||
|
ButtonPressed( DeviceInput(dev, down, max(+l,0), tm) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
case in.HAT:
|
||||||
break;
|
|
||||||
|
|
||||||
case in.BUTTON:
|
|
||||||
ButtonPressed( DeviceInput(dev, enum_add2(JOY_BUTTON_1, in.num), !!evtbuf[i].dwData, tm) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case in.AXIS:
|
|
||||||
{
|
|
||||||
DeviceButton up = DeviceButton_Invalid, down = DeviceButton_Invalid;
|
|
||||||
switch(in.ofs)
|
|
||||||
{
|
{
|
||||||
case DIJOFS_X: up = JOY_LEFT; down = JOY_RIGHT; break;
|
const int pos = TranslatePOV( evtbuf[i].dwData );
|
||||||
case DIJOFS_Y: up = JOY_UP; down = JOY_DOWN; break;
|
ButtonPressed( DeviceInput(dev, JOY_HAT_UP, !!(pos & HAT_UP_MASK), tm) );
|
||||||
case DIJOFS_Z: up = JOY_Z_UP; down = JOY_Z_DOWN; break;
|
ButtonPressed( DeviceInput(dev, JOY_HAT_DOWN, !!(pos & HAT_DOWN_MASK), tm) );
|
||||||
case DIJOFS_RX: up = JOY_ROT_UP; down = JOY_ROT_DOWN; break;
|
ButtonPressed( DeviceInput(dev, JOY_HAT_LEFT, !!(pos & HAT_LEFT_MASK), tm) );
|
||||||
case DIJOFS_RY: up = JOY_ROT_LEFT; down = JOY_ROT_RIGHT; break;
|
ButtonPressed( DeviceInput(dev, JOY_HAT_RIGHT, !!(pos & HAT_RIGHT_MASK), tm) );
|
||||||
case DIJOFS_RZ: up = JOY_ROT_Z_UP; down = JOY_ROT_Z_DOWN; break;
|
|
||||||
case DIJOFS_SLIDER(0): up = JOY_AUX_1; down = JOY_AUX_2; break;
|
|
||||||
case DIJOFS_SLIDER(1): up = JOY_AUX_3; down = JOY_AUX_4; break;
|
|
||||||
default: LOG->MapLog( "unknown input",
|
|
||||||
"Controller '%s' is returning an unknown joystick offset, %i",
|
|
||||||
device.m_sName.c_str(), in.ofs );
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float l = SCALE( int(evtbuf[i].dwData), 0.0f, 100.0f, 0.0f, 1.0f );
|
|
||||||
ButtonPressed( DeviceInput(dev, up, max(-l,0), tm) );
|
|
||||||
ButtonPressed( DeviceInput(dev, down, max(+l,0), tm) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case in.HAT:
|
|
||||||
{
|
|
||||||
const int pos = TranslatePOV( evtbuf[i].dwData );
|
|
||||||
ButtonPressed( DeviceInput(dev, JOY_HAT_UP, !!(pos & HAT_UP_MASK), tm) );
|
|
||||||
ButtonPressed( DeviceInput(dev, JOY_HAT_DOWN, !!(pos & HAT_DOWN_MASK), tm) );
|
|
||||||
ButtonPressed( DeviceInput(dev, JOY_HAT_LEFT, !!(pos & HAT_LEFT_MASK), tm) );
|
|
||||||
ButtonPressed( DeviceInput(dev, JOY_HAT_RIGHT, !!(pos & HAT_RIGHT_MASK), tm) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -525,7 +524,7 @@ void InputHandler_DInput::PollAndAcquireDevices( bool bBuffered )
|
|||||||
|
|
||||||
void InputHandler_DInput::Update()
|
void InputHandler_DInput::Update()
|
||||||
{
|
{
|
||||||
/* Handle polled devices. Handle buffered, too, if there's no input thread to do it. */
|
/* Handle polled devices. Handle buffered, too, if there's no input thread to do it. */
|
||||||
PollAndAcquireDevices( false );
|
PollAndAcquireDevices( false );
|
||||||
if( !m_InputThread.IsCreated() )
|
if( !m_InputThread.IsCreated() )
|
||||||
PollAndAcquireDevices( true );
|
PollAndAcquireDevices( true );
|
||||||
@@ -538,7 +537,7 @@ void InputHandler_DInput::Update()
|
|||||||
}
|
}
|
||||||
else if( !m_InputThread.IsCreated() )
|
else if( !m_InputThread.IsCreated() )
|
||||||
{
|
{
|
||||||
/* If we have an input thread, it'll handle buffered devices. */
|
// If we have an input thread, it'll handle buffered devices.
|
||||||
UpdateBuffered( Devices[i], RageZeroTimer );
|
UpdateBuffered( Devices[i], RageZeroTimer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -551,7 +550,6 @@ const float POLL_FOR_JOYSTICK_CHANGES_EVERY_SECONDS = 0.25f;
|
|||||||
|
|
||||||
bool InputHandler_DInput::DevicesChanged()
|
bool InputHandler_DInput::DevicesChanged()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// GetNumJoysticksSlow() blocks DirectInput for a while even if called from a
|
// GetNumJoysticksSlow() blocks DirectInput for a while even if called from a
|
||||||
// different thread, so we can't poll with it.
|
// different thread, so we can't poll with it.
|
||||||
// GetNumHidDevices() is fast, but sometimes the DirectInput joysticks haven't updated by
|
// GetNumHidDevices() is fast, but sometimes the DirectInput joysticks haven't updated by
|
||||||
@@ -564,7 +562,6 @@ bool InputHandler_DInput::DevicesChanged()
|
|||||||
// Note that this "poll for N seconds" method will not work if the Add New Hardware wizard
|
// Note that this "poll for N seconds" method will not work if the Add New Hardware wizard
|
||||||
// halts device installation to wait for a driver. Most of the joysticks people would
|
// halts device installation to wait for a driver. Most of the joysticks people would
|
||||||
// want to use don't prompt for a driver though and the wizard adds them pretty quickly.
|
// want to use don't prompt for a driver though and the wizard adds them pretty quickly.
|
||||||
//
|
|
||||||
|
|
||||||
int iOldNumHidDevices = m_iLastSeenNumHidDevices;
|
int iOldNumHidDevices = m_iLastSeenNumHidDevices;
|
||||||
m_iLastSeenNumHidDevices = GetNumHidDevices();
|
m_iLastSeenNumHidDevices = GetNumHidDevices();
|
||||||
@@ -602,7 +599,7 @@ void InputHandler_DInput::InputThreadMain()
|
|||||||
if(!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST))
|
if(!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST))
|
||||||
LOG->Warn(werr_ssprintf(GetLastError(), "Failed to set DirectInput thread priority"));
|
LOG->Warn(werr_ssprintf(GetLastError(), "Failed to set DirectInput thread priority"));
|
||||||
|
|
||||||
/* Enable priority boosting. */
|
// Enable priority boosting.
|
||||||
SetThreadPriorityBoost( GetCurrentThread(), FALSE );
|
SetThreadPriorityBoost( GetCurrentThread(), FALSE );
|
||||||
|
|
||||||
vector<DIDevice*> BufferedDevices;
|
vector<DIDevice*> BufferedDevices;
|
||||||
@@ -626,7 +623,7 @@ void InputHandler_DInput::InputThreadMain()
|
|||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
if( BufferedDevices.size() )
|
if( BufferedDevices.size() )
|
||||||
{
|
{
|
||||||
/* Update buffered devices. */
|
// Update buffered devices.
|
||||||
PollAndAcquireDevices( true );
|
PollAndAcquireDevices( true );
|
||||||
|
|
||||||
int ret = WaitForSingleObjectEx( Handle, 50, true );
|
int ret = WaitForSingleObjectEx( Handle, 50, true );
|
||||||
@@ -636,15 +633,15 @@ void InputHandler_DInput::InputThreadMain()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update devices even if no event was triggered, since this also checks for focus
|
/* Update devices even if no event was triggered, since this also
|
||||||
* loss. */
|
* checks for focus loss. */
|
||||||
RageTimer now;
|
RageTimer now;
|
||||||
for( unsigned i = 0; i < BufferedDevices.size(); ++i )
|
for( unsigned i = 0; i < BufferedDevices.size(); ++i )
|
||||||
UpdateBuffered( *BufferedDevices[i], now );
|
UpdateBuffered( *BufferedDevices[i], now );
|
||||||
}
|
}
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
|
|
||||||
/* If we have no buffered devices, we didn't delay at WaitForMultipleObjectsEx. */
|
// If we have no buffered devices, we didn't delay at WaitForMultipleObjectsEx.
|
||||||
if( BufferedDevices.size() == 0 )
|
if( BufferedDevices.size() == 0 )
|
||||||
usleep( 50000 );
|
usleep( 50000 );
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
@@ -671,7 +668,7 @@ void InputHandler_DInput::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vD
|
|||||||
|
|
||||||
static wchar_t ScancodeAndKeysToChar( DWORD scancode, unsigned char keys[256] )
|
static wchar_t ScancodeAndKeysToChar( DWORD scancode, unsigned char keys[256] )
|
||||||
{
|
{
|
||||||
static HKL layout = GetKeyboardLayout(0); // 0 == current thread
|
static HKL layout = GetKeyboardLayout(0); // 0 == current thread
|
||||||
UINT vk = MapVirtualKeyEx( scancode, 1, layout );
|
UINT vk = MapVirtualKeyEx( scancode, 1, layout );
|
||||||
|
|
||||||
static bool bInitialized = false;
|
static bool bInitialized = false;
|
||||||
@@ -687,7 +684,7 @@ static wchar_t ScancodeAndKeysToChar( DWORD scancode, unsigned char keys[256] )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned short result[2]; // ToAscii writes a max of 2 chars
|
unsigned short result[2]; // ToAscii writes a max of 2 chars
|
||||||
ZERO( result );
|
ZERO( result );
|
||||||
|
|
||||||
if( pToUnicodeEx != NULL )
|
if( pToUnicodeEx != NULL )
|
||||||
@@ -699,7 +696,7 @@ static wchar_t ScancodeAndKeysToChar( DWORD scancode, unsigned char keys[256] )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int iNum = ToAsciiEx( vk, scancode, keys, result, 0, layout );
|
int iNum = ToAsciiEx( vk, scancode, keys, result, 0, layout );
|
||||||
// iNum == 2 will happen only for dead keys. See MSDN for ToAsciiEx.
|
// iNum == 2 will happen only for dead keys. See MSDN for ToAsciiEx.
|
||||||
if( iNum == 1 )
|
if( iNum == 1 )
|
||||||
{
|
{
|
||||||
RString s = RString()+(char)result[0];
|
RString s = RString()+(char)result[0];
|
||||||
@@ -712,7 +709,7 @@ static wchar_t ScancodeAndKeysToChar( DWORD scancode, unsigned char keys[256] )
|
|||||||
|
|
||||||
wchar_t InputHandler_DInput::DeviceButtonToChar( DeviceButton button, bool bUseCurrentKeyModifiers )
|
wchar_t InputHandler_DInput::DeviceButtonToChar( DeviceButton button, bool bUseCurrentKeyModifiers )
|
||||||
{
|
{
|
||||||
// ToAsciiEx maps these keys to a character. They shouldn't be mapped to any character.
|
// ToAsciiEx maps these keys to a character. They shouldn't be mapped to any character.
|
||||||
switch( button )
|
switch( button )
|
||||||
{
|
{
|
||||||
case KEY_ESC:
|
case KEY_ESC:
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ bool DIDevice::Open()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
hr = Device->SetDataFormat( type == JOYSTICK? &c_dfDIJoystick: &c_dfDIKeyboard );
|
hr = Device->SetDataFormat( type == JOYSTICK? &c_dfDIJoystick: &c_dfDIKeyboard );
|
||||||
if ( hr != DI_OK )
|
if ( hr != DI_OK )
|
||||||
{
|
{
|
||||||
@@ -119,7 +118,7 @@ bool DIDevice::Open()
|
|||||||
|
|
||||||
void DIDevice::Close()
|
void DIDevice::Close()
|
||||||
{
|
{
|
||||||
/* Don't try to close a device that isn't open. */
|
// Don't try to close a device that isn't open.
|
||||||
ASSERT( Device != NULL );
|
ASSERT( Device != NULL );
|
||||||
|
|
||||||
Device->Unacquire();
|
Device->Unacquire();
|
||||||
@@ -138,13 +137,13 @@ static BOOL CALLBACK DIJoystick_EnumDevObjectsProc(LPCDIDEVICEOBJECTINSTANCE dev
|
|||||||
input_t in;
|
input_t in;
|
||||||
const int SupportedMask = DIDFT_BUTTON | DIDFT_POV | DIDFT_AXIS;
|
const int SupportedMask = DIDFT_BUTTON | DIDFT_POV | DIDFT_AXIS;
|
||||||
if(!(dev->dwType & SupportedMask))
|
if(!(dev->dwType & SupportedMask))
|
||||||
return DIENUM_CONTINUE; /* unsupported */
|
return DIENUM_CONTINUE; // unsupported
|
||||||
|
|
||||||
in.ofs = dev->dwOfs;
|
in.ofs = dev->dwOfs;
|
||||||
|
|
||||||
if(dev->dwType & DIDFT_BUTTON) {
|
if(dev->dwType & DIDFT_BUTTON) {
|
||||||
if( device->buttons == 24 )
|
if( device->buttons == 24 )
|
||||||
return DIENUM_CONTINUE; /* too many buttons */
|
return DIENUM_CONTINUE; // too many buttons
|
||||||
|
|
||||||
in.type = in.BUTTON;
|
in.type = in.BUTTON;
|
||||||
in.num = device->buttons;
|
in.num = device->buttons;
|
||||||
@@ -153,7 +152,7 @@ static BOOL CALLBACK DIJoystick_EnumDevObjectsProc(LPCDIDEVICEOBJECTINSTANCE dev
|
|||||||
in.type = in.HAT;
|
in.type = in.HAT;
|
||||||
in.num = device->hats;
|
in.num = device->hats;
|
||||||
device->hats++;
|
device->hats++;
|
||||||
} else { /* dev->dwType & DIDFT_AXIS */
|
} else { // dev->dwType & DIDFT_AXIS
|
||||||
DIPROPRANGE diprg;
|
DIPROPRANGE diprg;
|
||||||
DIPROPDWORD dilong;
|
DIPROPDWORD dilong;
|
||||||
|
|
||||||
@@ -169,9 +168,9 @@ static BOOL CALLBACK DIJoystick_EnumDevObjectsProc(LPCDIDEVICEOBJECTINSTANCE dev
|
|||||||
|
|
||||||
hr = device->Device->SetProperty( DIPROP_RANGE, &diprg.diph );
|
hr = device->Device->SetProperty( DIPROP_RANGE, &diprg.diph );
|
||||||
if ( hr != DI_OK )
|
if ( hr != DI_OK )
|
||||||
return DIENUM_CONTINUE; /* don't use this axis */
|
return DIENUM_CONTINUE; // don't use this axis
|
||||||
|
|
||||||
/* Set dead zone to 0. */
|
// Set dead zone to 0.
|
||||||
dilong.diph.dwSize = sizeof(dilong);
|
dilong.diph.dwSize = sizeof(dilong);
|
||||||
dilong.diph.dwHeaderSize = sizeof(dilong.diph);
|
dilong.diph.dwHeaderSize = sizeof(dilong.diph);
|
||||||
dilong.diph.dwObj = dev->dwOfs;
|
dilong.diph.dwObj = dev->dwOfs;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
virtual bool TryWait() = 0;
|
virtual bool TryWait() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* These functions must be implemented by the thread implementation. */
|
// These functions must be implemented by the thread implementation.
|
||||||
ThreadImpl *MakeThread( int (*fn)(void *), void *data, uint64_t *piThreadID );
|
ThreadImpl *MakeThread( int (*fn)(void *), void *data, uint64_t *piThreadID );
|
||||||
ThreadImpl *MakeThisThread();
|
ThreadImpl *MakeThisThread();
|
||||||
MutexImpl *MakeMutex( RageMutex *pParent );
|
MutexImpl *MakeMutex( RageMutex *pParent );
|
||||||
|
|||||||
@@ -62,15 +62,15 @@ int ThreadImpl_Win32::Wait()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SetThreadName magic comes from VirtualDub. */
|
// SetThreadName magic comes from VirtualDub.
|
||||||
#define MS_VC_EXCEPTION 0x406d1388
|
#define MS_VC_EXCEPTION 0x406d1388
|
||||||
|
|
||||||
typedef struct tagTHREADNAME_INFO
|
typedef struct tagTHREADNAME_INFO
|
||||||
{
|
{
|
||||||
DWORD dwType; // must be 0x1000
|
DWORD dwType; // must be 0x1000
|
||||||
LPCSTR szName; // pointer to name (in same addr space)
|
LPCSTR szName; // pointer to name (in same addr space)
|
||||||
DWORD dwThreadID; // thread ID (-1 caller thread)
|
DWORD dwThreadID; // thread ID (-1 caller thread)
|
||||||
DWORD dwFlags; // reserved for future use, most be zero
|
DWORD dwFlags; // reserved for future use, must be zero
|
||||||
} THREADNAME_INFO;
|
} THREADNAME_INFO;
|
||||||
|
|
||||||
static void SetThreadName( DWORD dwThreadID, LPCTSTR szThreadName )
|
static void SetThreadName( DWORD dwThreadID, LPCTSTR szThreadName )
|
||||||
@@ -114,7 +114,7 @@ static int GetOpenSlot( uint64_t iID )
|
|||||||
|
|
||||||
g_pThreadIdMutex->Lock();
|
g_pThreadIdMutex->Lock();
|
||||||
|
|
||||||
/* Find an open slot in g_ThreadIds. */
|
// Find an open slot in g_ThreadIds.
|
||||||
int slot = 0;
|
int slot = 0;
|
||||||
while( slot < MAX_THREADS && g_ThreadIds[slot] != 0 )
|
while( slot < MAX_THREADS && g_ThreadIds[slot] != 0 )
|
||||||
++slot;
|
++slot;
|
||||||
@@ -173,7 +173,6 @@ ThreadImpl *MakeThread( int (*pFunc)(void *pData), void *pData, uint64_t *piThre
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MutexImpl_Win32::MutexImpl_Win32( RageMutex *pParent ):
|
MutexImpl_Win32::MutexImpl_Win32( RageMutex *pParent ):
|
||||||
MutexImpl( pParent )
|
MutexImpl( pParent )
|
||||||
{
|
{
|
||||||
@@ -200,7 +199,7 @@ static bool SimpleWaitForSingleObject( HANDLE h, DWORD ms )
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
case WAIT_ABANDONED:
|
case WAIT_ABANDONED:
|
||||||
/* The docs aren't particular about what this does, but it should never happen. */
|
// The docs aren't particular about what this does, but it should never happen.
|
||||||
FAIL_M( "WAIT_ABANDONED" );
|
FAIL_M( "WAIT_ABANDONED" );
|
||||||
|
|
||||||
case WAIT_FAILED:
|
case WAIT_FAILED:
|
||||||
@@ -218,7 +217,7 @@ bool MutexImpl_Win32::Lock()
|
|||||||
|
|
||||||
while( tries-- )
|
while( tries-- )
|
||||||
{
|
{
|
||||||
/* Wait for fifteen seconds. If it takes longer than that, we're probably deadlocked. */
|
// Wait for fifteen seconds. If it takes longer than that, we're probably deadlocked.
|
||||||
if( SimpleWaitForSingleObject( mutex, len ) )
|
if( SimpleWaitForSingleObject( mutex, len ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -275,7 +274,7 @@ EventImpl_Win32::~EventImpl_Win32()
|
|||||||
{
|
{
|
||||||
ASSERT_M( m_iNumWaiting == 0, ssprintf("event destroyed while still in use (%i)", m_iNumWaiting) );
|
ASSERT_M( m_iNumWaiting == 0, ssprintf("event destroyed while still in use (%i)", m_iNumWaiting) );
|
||||||
|
|
||||||
/* We don't own m_pParent; don't free it. */
|
// We don't own m_pParent; don't free it.
|
||||||
CloseHandle( m_WakeupSema );
|
CloseHandle( m_WakeupSema );
|
||||||
DeleteCriticalSection( &m_iNumWaitingLock );
|
DeleteCriticalSection( &m_iNumWaitingLock );
|
||||||
CloseHandle( m_WaitersDone );
|
CloseHandle( m_WaitersDone );
|
||||||
@@ -288,7 +287,7 @@ EventImpl_Win32::~EventImpl_Win32()
|
|||||||
static bool PortableSignalObjectAndWait( HANDLE hObjectToSignal, HANDLE hObjectToWaitOn, bool bFirstParamIsMutex, unsigned iMilliseconds = INFINITE )
|
static bool PortableSignalObjectAndWait( HANDLE hObjectToSignal, HANDLE hObjectToWaitOn, bool bFirstParamIsMutex, unsigned iMilliseconds = INFINITE )
|
||||||
{
|
{
|
||||||
static bool bSignalObjectAndWaitUnavailable = false;
|
static bool bSignalObjectAndWaitUnavailable = false;
|
||||||
/* Watch out: SignalObjectAndWait doesn't work when iMilliseconds is zero. */
|
// Watch out: SignalObjectAndWait doesn't work when iMilliseconds is zero.
|
||||||
if( !bSignalObjectAndWaitUnavailable && iMilliseconds != 0 )
|
if( !bSignalObjectAndWaitUnavailable && iMilliseconds != 0 )
|
||||||
{
|
{
|
||||||
DWORD ret = SignalObjectAndWait( hObjectToSignal, hObjectToWaitOn, iMilliseconds, false );
|
DWORD ret = SignalObjectAndWait( hObjectToSignal, hObjectToWaitOn, iMilliseconds, false );
|
||||||
@@ -298,14 +297,14 @@ static bool PortableSignalObjectAndWait( HANDLE hObjectToSignal, HANDLE hObjectT
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case WAIT_ABANDONED:
|
case WAIT_ABANDONED:
|
||||||
/* The docs aren't particular about what this does, but it should never happen. */
|
// The docs aren't particular about what this does, but it should never happen.
|
||||||
FAIL_M( "WAIT_ABANDONED" );
|
FAIL_M( "WAIT_ABANDONED" );
|
||||||
|
|
||||||
case 1: /* bogus Win98 return value */
|
case 1: // bogus Win98 return value
|
||||||
case WAIT_FAILED:
|
case WAIT_FAILED:
|
||||||
if( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED )
|
if( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED )
|
||||||
{
|
{
|
||||||
/* We're probably on 9x. */
|
// We're probably on 9x.
|
||||||
bSignalObjectAndWaitUnavailable = true;
|
bSignalObjectAndWaitUnavailable = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -336,7 +335,7 @@ static bool PortableSignalObjectAndWait( HANDLE hObjectToSignal, HANDLE hObjectT
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case WAIT_ABANDONED:
|
case WAIT_ABANDONED:
|
||||||
/* The docs aren't particular about what this does, but it should never happen. */
|
// The docs aren't particular about what this does, but it should never happen.
|
||||||
FAIL_M( "WAIT_ABANDONED" );
|
FAIL_M( "WAIT_ABANDONED" );
|
||||||
|
|
||||||
case WAIT_TIMEOUT:
|
case WAIT_TIMEOUT:
|
||||||
@@ -347,7 +346,7 @@ static bool PortableSignalObjectAndWait( HANDLE hObjectToSignal, HANDLE hObjectT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Event logic from http://www.cs.wustl.edu/~schmidt/win32-cv-1.html. */
|
// Event logic from http://www.cs.wustl.edu/~schmidt/win32-cv-1.html.
|
||||||
bool EventImpl_Win32::Wait( RageTimer *pTimeout )
|
bool EventImpl_Win32::Wait( RageTimer *pTimeout )
|
||||||
{
|
{
|
||||||
EnterCriticalSection( &m_iNumWaitingLock );
|
EnterCriticalSection( &m_iNumWaitingLock );
|
||||||
@@ -361,7 +360,7 @@ bool EventImpl_Win32::Wait( RageTimer *pTimeout )
|
|||||||
iMilliseconds = (unsigned) max( 0, int( fSecondsInFuture * 1000 ) );
|
iMilliseconds = (unsigned) max( 0, int( fSecondsInFuture * 1000 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unlock the mutex and wait for a signal. */
|
// Unlock the mutex and wait for a signal.
|
||||||
bool bSuccess = PortableSignalObjectAndWait( m_pParent->mutex, m_WakeupSema, true, iMilliseconds );
|
bool bSuccess = PortableSignalObjectAndWait( m_pParent->mutex, m_WakeupSema, true, iMilliseconds );
|
||||||
|
|
||||||
EnterCriticalSection( &m_iNumWaitingLock );
|
EnterCriticalSection( &m_iNumWaitingLock );
|
||||||
@@ -401,7 +400,7 @@ void EventImpl_Win32::Signal()
|
|||||||
|
|
||||||
LeaveCriticalSection( &m_iNumWaitingLock );
|
LeaveCriticalSection( &m_iNumWaitingLock );
|
||||||
|
|
||||||
/* The waiter will touch m_WaitersDone. */
|
// The waiter will touch m_WaitersDone.
|
||||||
WaitForSingleObject( m_WaitersDone, INFINITE );
|
WaitForSingleObject( m_WaitersDone, INFINITE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,8 +418,8 @@ void EventImpl_Win32::Broadcast()
|
|||||||
|
|
||||||
LeaveCriticalSection( &m_iNumWaitingLock );
|
LeaveCriticalSection( &m_iNumWaitingLock );
|
||||||
|
|
||||||
/* The last waiter will touch m_WaitersDone, so we wait for all waiters to wake up and
|
/* The last waiter will touch m_WaitersDone, so we wait for all waiters to
|
||||||
* start waiting for the mutex before returning. */
|
* wake up and start waiting for the mutex before returning. */
|
||||||
WaitForSingleObject( m_WaitersDone, INFINITE );
|
WaitForSingleObject( m_WaitersDone, INFINITE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
HANDLE sem;
|
HANDLE sem;
|
||||||
|
|
||||||
/* We have to track the count ourself, since Windows gives no way to query it. */
|
// We have to track the count ourself, since Windows gives no way to query it.
|
||||||
int m_iCounter;
|
int m_iCounter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user